SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / kttsd / libkttsd / filterconf.h
blob0e6a5b67973d5ee2e38f626e2c8471b5636b5006
1 /***************************************************** vim:set ts=4 sw=4 sts=4:
2 Filter Configuration class.
3 This is the interface definition for text filter configuration dialogs.
4 -------------------
5 Copyright:
6 (C) 2005 by Gary Cramblitt <garycramblitt@comcast.net>
7 -------------------
8 Original author: Gary Cramblitt <garycramblitt@comcast.net>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************************************************************************/
25 #ifndef FILTERCONF_H
26 #define FILTERCONF_H
28 // Qt includes.
29 #include <QtGui/QWidget>
31 // KDE includes.
32 #include <kconfig.h>
33 #include <kdebug.h>
34 #include <kdemacros.h>
36 class KDE_EXPORT KttsFilterConf : public QWidget{
37 Q_OBJECT
39 public:
40 /**
41 * Constructor
43 explicit KttsFilterConf( QWidget *parent, const QVariantList &);
45 /**
46 * Destructor
48 virtual ~KttsFilterConf();
50 /**
51 * This method is invoked whenever the module should read its
52 * configuration (most of the times from a config file) and update the
53 * user interface. This happens when the user clicks the "Reset" button in
54 * the control center, to undo all of his changes and restore the currently
55 * valid settings. Note that KTTSMGR calls this when the plugin is
56 * loaded, so it not necessary to call it in your constructor.
57 * The plugin should read its configuration from the specified group
58 * in the specified config file.
59 * @param config Pointer to a KConfig object.
60 * @param configGroup Call config->setGroup with this argument before
61 * loading your configuration.
63 * When a plugin is first added to KTTSMGR, @e load will be called with
64 * a Null @e configGroup. In this case, the plugin will not have
65 * any instance-specific parameters to load, but it may still wish
66 * to load parameters that apply to all instances of the plugin.
68 virtual void load(KConfig *config, const QString &configGroup);
70 /**
71 * This function gets called when the user wants to save the settings in
72 * the user interface, updating the config files or wherever the
73 * configuration is stored. The method is called when the user clicks "Apply"
74 * or "Ok". The plugin should save its configuration in the specified
75 * group of the specified config file.
76 * @param config Pointer to a KConfig object.
77 * @param configGroup Call config->setGroup with this argument before
78 * saving your configuration.
80 virtual void save(KConfig *config, const QString &configGroup);
82 /**
83 * This function is called to set the settings in the module to sensible
84 * default values. It gets called when hitting the "Default" button. The
85 * default values should probably be the same as the ones the application
86 * uses when started without a config file. Note that defaults should
87 * be applied to the on-screen widgets; not to the config file.
89 virtual void defaults();
91 /**
92 * Indicates whether the plugin supports multiple instances. Return
93 * False if only one instance of the plugin can be configured.
94 * @return True if multiple instances are possible.
96 virtual bool supportsMultiInstance();
98 /**
99 * Returns the name of the plugin. Displayed in Filters tab of KTTSMgr.
100 * If there can be more than one instance of a filter, it should return
101 * a unique name for each instance. The name should be translated for
102 * the user if possible. If the plugin is not correctly configured,
103 * return an empty string.
104 * @return Filter instance name.
106 virtual QString userPlugInName();
109 * Returns True if this filter is a Sentence Boundary Detector.
110 * @return True if this filter is a SBD.
112 virtual bool isSBD();
114 static QString realFilePath(const QString &filename);
116 public slots:
118 * This slot is used internally when the configuration is changed. It is
119 * typically connected to signals from the widgets of the configuration
120 * and should emit the @ref changed signal.
122 void configChanged(){
123 // kDebug() << "KttsFilterConf::configChanged: Running";
124 emit changed(true);
127 signals:
129 * This signal indicates that the configuration has been changed.
130 * It should be emitted whenever user changes something in the configuration widget.
132 void changed(bool);
134 protected:
136 * Searches the $PATH variable for any file. If that file exists in the PATH, or
137 * is contained in any directory in the PATH, it returns the full path to it.
138 * @param name The name of the file to search for.
139 * @returns The path to the file on success, a blank QString
140 * if it is not found.
142 QString getLocation(const QString &name);
144 /// The system path in a QStringList.
145 QStringList m_path;
148 #endif //FILTERCONF_H