Fix include
[kdeaccessibility.git] / kttsd / plugins / hadifix / hadifixconf.h
blob275156346e5ca4718b63ffbe6335f0196c0d73ae
1 #ifndef _HADIFIXCONF_H_
2 #define _HADIFIXCONF_H_
4 // Qt includes.
6 // KTTS includes.
7 #include <pluginconf.h>
9 // Hadifix includes.
10 #include "ui_hadifixconfigui.h"
12 class KConfig;
13 class KProgressDialog;
14 class HadifixProc;
16 class HadifixConfPrivate : public QWidget, public Ui::HadifixConfigUI {
17 friend class HadifixConf;
19 Q_OBJECT
21 private:
22 HadifixConfPrivate(QWidget *parent);
23 virtual ~HadifixConfPrivate();
25 void setConfiguration (QString hadifixExec, QString mbrolaExec,
26 QString voice, bool male,
27 int volume, int time, int pitch,
28 QString codecName);
29 void initializeVoices ();
30 void initializeCharacterCodes();
31 void setDefaultEncodingFromVoice();
32 void setDefaults ();
33 void load (KConfig *config, const QString &configGroup);
34 void save (KConfig *config, const QString &configGroup);
36 void findInitialConfig();
37 QString findHadifixDataPath ();
38 QString findExecutable (const QStringList &names, const QString &possiblePath);
39 QStringList findVoices(QString mbrolaExec, const QString &hadifixDataPath);
40 QStringList findSubdirs (const QStringList &baseDirs);
42 private slots:
43 int percentToSlider (int percentValue);
44 int sliderToPercent (int sliderValue);
45 void volumeBox_valueChanged (int percentValue);
46 void timeBox_valueChanged (int percentValue);
47 void frequencyBox_valueChanged (int percentValue);
48 void volumeSlider_valueChanged (int sliderValue);
49 void timeSlider_valueChanged (int sliderValue);
50 void frequencySlider_valueChanged (int sliderValue);
51 void init ();
52 void addVoice (const QString &filename, bool isMale);
53 void addVoice (const QString &filename, bool isMale, const QString &displayname);
54 void setVoice (const QString &filename, bool isMale);
55 QString getVoiceFilename();
56 bool isMaleVoice();
58 private:
59 QString languageCode;
60 QString defaultHadifixExec;
61 QString defaultMbrolaExec;
62 QStringList defaultVoices;
63 QStringList codecList;
65 // Wave file playing on play object.
66 QString waveFile;
67 // Synthesizer.
68 HadifixProc* hadifixProc;
69 // Progress Dialog.
70 KProgressDialog* progressDlg;
72 QMap<QString,int> maleVoices;
73 QMap<int,QString> defaultVoicesMap;
74 QMap<QString,int> femaleVoices;
77 class HadifixConf : public PlugInConf {
78 Q_OBJECT
80 public:
81 /** Constructor */
82 HadifixConf( QWidget* parent = 0, const QStringList &args = QStringList());
84 /** Destructor */
85 ~HadifixConf();
87 /** This method is invoked whenever the module should read its
88 configuration (most of the times from a config file) and update the
89 user interface. This happens when the user clicks the "Reset" button in
90 the control center, to undo all of his changes and restore the currently
91 valid settings. NOTE that this is not called after the modules is loaded,
92 so you probably want to call this method in the constructor.*/
93 void load(KConfig *config, const QString &configGroup);
95 /** This function gets called when the user wants to save the settings in
96 the user interface, updating the config files or wherever the
97 configuration is stored. The method is called when the user clicks "Apply"
98 or "Ok". */
99 void save(KConfig *config, const QString &configGroup);
101 /** This function is called to set the settings in the module to sensible
102 default values. It gets called when hitting the "Default" button. The
103 default values should probably be the same as the ones the application
104 uses when started without a config file. */
105 void defaults();
108 * This function informs the plugin of the desired language to be spoken
109 * by the plugin. The plugin should attempt to adapt itself to the
110 * specified language code, choosing sensible defaults if necessary.
111 * If the passed-in code is QString(), no specific language has
112 * been chosen.
113 * @param lang The desired language code or Null if none.
115 * If the plugin is unable to support the desired language, that is OK.
116 * Language codes are given by ISO 639-1 and are in lowercase.
117 * The code may also include an ISO 3166 country code in uppercase
118 * separated from the language code by underscore (_). For
119 * example, en_GB. If your plugin supports the given language, but
120 * not the given country, treat it as though the country
121 * code were not specified, i.e., adapt to the given language.
123 void setDesiredLanguage(const QString &lang);
126 * Return fully-specified talker code for the configured plugin. This code
127 * uniquely identifies the configured instance of the plugin and distinquishes
128 * one instance from another. If the plugin has not been fully configured,
129 * i.e., cannot yet synthesize, return QString().
130 * @return Fully-specified talker code.
132 QString getTalkerCode();
134 public slots:
135 void configChanged(bool t = true){emit changed(t);}
137 private slots:
138 virtual void voiceButton_clicked();
139 virtual void testButton_clicked();
140 virtual void voiceCombo_activated(int index);
141 void slotSynthFinished();
142 void slotSynthStopped();
144 private:
145 HadifixConfPrivate *d;
147 #endif