Commit 41f82745 authored by David Jarvie's avatar David Jarvie
Browse files

Remove all 'speak' functions if text-to-speech not available at build time

parent 83b7b5a2
Pipeline #147867 passed with stage
in 3 minutes and 17 seconds
KAlarm Change Log
=== Version 3.4.0 (KDE Applications 22.04) --- 4 March 2022 ===
=== Version 3.4.0 (KDE Applications 22.04) --- 10 March 2022 ===
* Allow calendars and date picker to be shown together in side panel [KDE Bug 440250]
* Shrink calendar list to remove empty space when too large.
* Cancel sound file playback if audio alarm edit dialogue is closed after clicking Try.
* Remove all 'speak' functions if KAlarm is built with text-to-speech disabled.
* Use threading correctly for playing sound files.
* Incorporate kalarmcal library into KAlarm as a private library.
......
......@@ -31,7 +31,7 @@
</authorgroup>
<copyright>
<year>2001</year><year>2002</year><year>2003</year><year>2004</year><year>2005</year><year>2006</year><year>2007</year><year>2008</year><year>2009</year><year>2010</year><year>2011</year><year>2012</year><year>2013</year><year>2016</year><year>2018</year><year>2019</year><year>2020</year><year>2021</year>
<year>2001</year><year>2002</year><year>2003</year><year>2004</year><year>2005</year><year>2006</year><year>2007</year><year>2008</year><year>2009</year><year>2010</year><year>2011</year><year>2012</year><year>2013</year><year>2016</year><year>2018</year><year>2019</year><year>2020</year><year>2021</year><year>2022</year>
<holder>&David.Jarvie;</holder>
</copyright>
......@@ -39,8 +39,8 @@
<!-- Don't change format of date and version of the documentation -->
<date>2021-7-9</date>
<releaseinfo>3.3.0 (Applications 21.08)</releaseinfo>
<date>2022-3-10</date>
<releaseinfo>3.4.0 (Applications 22.04)</releaseinfo>
<abstract>
<para>&kalarm; is a personal alarm message, command and email scheduler by &kde;.</para>
......@@ -1274,8 +1274,9 @@ displayed. Choose:</para>
<listitem>
<para><guilabel>Speak</guilabel> to have the alarm message spoken as
well as being displayed. This option is only available if you have the
&Qt; Speech module installed and working.</para>
well as being displayed. This option is only available if &kalarm; was
built with speech enabled and you have the &Qt; Speech module installed
and working.</para>
</listitem>
<listitem>
......@@ -3348,10 +3349,10 @@ time.</para>
<row>
<entry><option>-s</option>, <option>--speak</option></entry>
<entry>Speak the message when it is displayed. This option requires
&jovie; to be installed and configured, together with a compatible
speech synthesizer. <option>--beep</option>, <option>--play</option>
and <option>--play-repeat</option> cannot be specified with this
option.</entry>
&kalarm; to have been built with speech enabled and the &Qt; Speech
module to be installed and working. <option>--beep</option>,
<option>--play</option> and <option>--play-repeat</option> cannot be
specified with this option.</entry>
</row>
<row>
<entry><option>-S</option>, <option>--subject
......
This diff is collapsed.
......@@ -9,8 +9,6 @@
#pragma once
#include "editdlg.h"
#include "eventid.h"
#include "kalarmcalendar/kaevent.h"
#include "kalarmcalendar/karecurrence.h"
#include "kalarmcalendar/kadatetime.h"
......@@ -44,7 +42,7 @@ public:
void parse();
void process();
Command command() const { return mCommand; }
QString commandName() const { return optionName(mCommandOpt); }
QString commandName() const;
QString eventId() const { return mEventId; }
QString resourceId() const { return mResourceId; }
QString name() const { return mName; }
......@@ -74,66 +72,10 @@ public:
static void printError(const QString& errmsg);
private:
enum Option
{
ACK_CONFIRM,
ATTACH,
AUTO_CLOSE,
BCC,
BEEP,
COLOUR,
COLOURFG,
OptCANCEL_EVENT,
DISABLE,
DISABLE_ALL,
EXEC,
EXEC_DISPLAY,
OptEDIT,
EDIT_NEW_DISPLAY,
EDIT_NEW_COMMAND,
EDIT_NEW_EMAIL,
EDIT_NEW_AUDIO,
OptEDIT_NEW_PRESET,
FILE,
FROM_ID,
INTERVAL,
KORGANIZER,
LATE_CANCEL,
OptLIST,
LOGIN,
MAIL,
NAME,
NOTIFY,
PLAY,
PLAY_REPEAT,
RECURRENCE,
REMINDER,
REMINDER_ONCE,
REPEAT,
SPEAK,
SUBJECT,
#ifndef NDEBUG
TEST_SET_TIME,
#endif
TIME,
OptTRAY,
OptTRIGGER_EVENT,
UNTIL,
VOLUME,
Num_Options, // number of Option values
Opt_Message // special value representing "message"
};
bool checkCommand(Option, Command, EditAlarmDlg::Type = EditAlarmDlg::NO_TYPE);
void setError(const QString& error);
void setErrorRequires(Option opt, Option opt2, Option opt3 = Num_Options);
void setErrorParameter(Option);
void setErrorIncompatible(Option opt1, Option opt2);
void checkEditType(EditAlarmDlg::Type type, Option opt)
{ checkEditType(type, EditAlarmDlg::NO_TYPE, opt); }
void checkEditType(EditAlarmDlg::Type, EditAlarmDlg::Type, Option);
class Private;
friend class Private;
Private* const d;
QString arg(int n);
QString optionName(Option, bool shortName = false) const;
static CommandOptions* mFirstInstance; // the first instance
QCommandLineParser* mParser {nullptr};
......@@ -142,7 +84,6 @@ private:
QStringList mExecArguments; // arguments for --exec or --exec-display
QString mError; // error message
Command mCommand {NONE}; // the selected command
Option mCommandOpt; // option for the selected command
QString mEventId; // TRIGGER_EVENT, CANCEL_EVENT, EDIT: event ID
QString mResourceId; // TRIGGER_EVENT, CANCEL_EVENT, EDIT: optional resource ID
QString mName; // NEW, EDIT_NEW_PRESET: alarm/template name
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2007-2021 David Jarvie <djarvie@kde.org>
SPDX-FileCopyrightText: 2007-2022 David Jarvie <djarvie@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
-->
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
......@@ -307,7 +307,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<whatsthis context="@info:whatsthis">Default setting in the alarm edit dialog for "show in KOrganizer".</whatsthis>
<default>false</default>
</entry>
<entry name="DefaultSoundType" key="SoundType" type="Enum">
<entry name="Base_DefaultSoundType" key="SoundType" type="Enum">
<label context="@label Label for audio options">Sound</label>
<whatsthis context="@info:whatsthis">Default sound type in the alarm edit dialog.</whatsthis>
<choices name="SoundType" prefix="Sound_">
......
......@@ -1359,7 +1359,7 @@ EditPrefTab::EditPrefTab(StackedScrollGroup* scrollGroup)
mSound->addItem(SoundPicker::i18n_combo_File()); // index 2
#if KPIMTEXTEDIT_TEXT_TO_SPEECH
if (KPIMTextEdit::TextToSpeech::self()->isReady())
mSound->addItem(SoundPicker::i18n_combo_Speak()); // index 3
mSound->addItem(SoundPicker::i18n_combo_Speak()); // index 3
#endif
mSound->setMinimumSize(mSound->sizeHint());
mSound->setWhatsThis(defsetting.subs(SoundPicker::i18n_label_Sound()).toString());
......@@ -1543,7 +1543,9 @@ void EditPrefTab::apply(bool syncToDisc)
Preferences::SoundType snd;
switch (mSound->currentIndex())
{
#if KPIMTEXTEDIT_TEXT_TO_SPEECH
case 3: snd = Preferences::Sound_Speak; break;
#endif
case 2: snd = Preferences::Sound_File; break;
case 1: snd = Preferences::Sound_Beep; break;
case 0:
......@@ -1628,7 +1630,9 @@ int EditPrefTab::soundIndex(Preferences::SoundType type)
{
switch (type)
{
#if KPIMTEXTEDIT_TEXT_TO_SPEECH
case Preferences::Sound_Speak: return 3;
#endif
case Preferences::Sound_File: return 2;
case Preferences::Sound_Beep: return 1;
case Preferences::Sound_None:
......
......@@ -18,6 +18,7 @@
#include <KIdentityManagement/Identity>
#include <KIdentityManagement/IdentityManager>
#include <KHolidays/HolidayRegion>
#include <kpimtextedit/kpimtextedit-texttospeech.h>
#include <KSharedConfig>
#include <KConfigGroup>
......@@ -453,6 +454,24 @@ void Preferences::setCmdXTermCommand(const QString& cmd)
self()->setBase_CmdXTermCommand(translateXTermPath(cmd, true));
}
Preferences::SoundType Preferences::defaultSoundType()
{
#if KPIMTEXTEDIT_TEXT_TO_SPEECH
return self()->base_DefaultSoundType();
#else
SoundType type = self()->base_DefaultSoundType();
return (type == Sound_Speak) ? Sound_None : type;
#endif
}
void Preferences::setDefaultSoundType(SoundType type)
{
#if !KPIMTEXTEDIT_TEXT_TO_SPEECH
if (type == Sound_Speak)
return;
#endif
self()->setBase_DefaultSoundType(type);
}
void Preferences::connect(const char* signal, const QObject* receiver, const char* member)
{
......
......@@ -79,6 +79,8 @@ public:
static bool emailBccUseSystemSettings();
static QString cmdXTermCommand();
static void setCmdXTermCommand(const QString& cmd);
static SoundType defaultSoundType();
static void setDefaultSoundType(SoundType);
static float defaultSoundVolume() { int vol = self()->mBase_DefaultSoundVolume; return (vol < 0) ? -1 : static_cast<float>(vol) / 100; }
static void setDefaultSoundVolume(float v) { self()->setBase_DefaultSoundVolume(v < 0 ? -1 : static_cast<int>(v * 100)); }
......
/*
* soundpicker.cpp - widget to select a sound file or a beep
* Program: kalarm
* SPDX-FileCopyrightText: 2002-2021 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2002-2022 David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -159,6 +159,10 @@ Preferences::SoundType SoundPicker::sound() const
{
if (mTypeCombo->currentIndex() < 0)
return Preferences::Sound_None;
#if !KPIMTEXTEDIT_TEXT_TO_SPEECH
if (mTypeCombo->currentData().toInt() == Preferences::Sound_Speak)
return Preferences::Sound_None;
#endif
return static_cast<Preferences::SoundType>(mTypeCombo->currentData().toInt());
}
......
  • All times we use two digits:

    <date>2022-03-10</date>

    'Applications' is not more used:

    <releaseinfo>3.4.0 (KDE Gear 22.04)</releaseinfo>

    Edited by Antoni Bella Pérez
  • I presume you're referring to the Changelog file? You mention the format of the short form date, whereas Changelog uses the long form date, which is equally valid. I'll change 'Applications' to 'Gear' for appropriate releases.

  • Documentation, package it as KDE Gear

  • I've now changed Applications -> Gear for 21.04 onwards, in Changelog and doc/index.docbook - commit 94aaf938.

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment