SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / ksayit / src / ksayit.h
blob74fe2291250884fd46d986a7f57faacefa17ef50
1 //Added by qt3to4:
2 #include <QByteArray>
3 #include <QCloseEvent>
4 /***************************************************************************
5 ksayit.h - description
6 -------------------
7 begin : Son Aug 10 13:26:57 EDT 2003
8 copyright : (C) 2003 by Robert Vogl
9 email : voglrobe@saphir
10 ***************************************************************************/
12 /***************************************************************************
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 ***************************************************************************/
21 #ifndef KSAYIT_H
22 #define KSAYIT_H
24 #include <config.h>
26 using namespace std;
28 // include files for Qt
29 #include <QStringList>
30 #include <QClipboard>
32 // include files for KDE
33 #include <kapplication.h>
34 #include <kmainwindow.h>
35 #include <kaction.h>
37 #include <kurl.h>
38 #include <kbookmarkmanager.h>
39 #include <kbookmarkmenu.h>
41 // App specific includes
43 // appended to $HOME
44 #define KSAYIT_BOOKMARKXMLFILE "/.ksayitbookmarks.xml"
46 // forward declaration of the KSayIt classes
47 class KSayItViewImpl;
48 class DocTreeViewImpl;
49 class KSayItSystemTray;
50 // class FXPluginHandler;
51 // class EffectStack;
52 class KTTSDLib;
53 class KSayItBookmarkHandler;
55 /**
56 * The base class for KSayIt application windows. It sets up the main
57 * window and reads the config file as well as providing a menubar, toolbar
58 * and statusbar. An instance of KSayItView creates the center view.
59 * KSayItApp reimplements the methods that KMainWindow provides for main window handling and supports
60 * full session management as well as using KActions.
61 * @see KMainWindow
62 * @see KApplication
63 * @see KConfig
65 * @author Robert Vogl
67 class KSayItApp : public KMainWindow
69 Q_OBJECT
70 // K_DCOP
72 public:
73 /** construtor of KSayItApp, calls all init functions to create the application.
75 KSayItApp(QWidget* parent=0, const char* name=0, Qt::WFlags f=0,
76 const QByteArray &objID=0);
77 ~KSayItApp();
79 // TODO: Replace with DBUS.
80 // k_dcop:
81 // /** DCOP interface for say operation
82 // \param msg The text to speak.
83 // */
84 // ASYNC dcopSayText(QString msg);
86 // /** DCOP interface for stop operation
87 // */
88 // ASYNC dcopStop();
89 //
90 // /** DCOP interface to say DocBook file
91 // */
92 // ASYNC dcopSayXmlFile(KUrl url);
95 signals:
96 /** emitted when the Configuration was modified
98 void signalConfigChanged();
100 private slots:
101 /** Puts the given text on the Job-Stack of KTTSD.
102 * \param text The text to say.
104 void slotSetText(const QString &text);
106 /** Called from the ListView widget after one or many
107 * 'setText'-Calls. Starts to say the text.
109 void slotSayNode();
111 /** Called when a node in the treeview was clicked and
112 * new content in the edit window must be shown.
113 * \str The new content of the EditView.
115 void slotTreeViewChanged(const QString &str);
117 /** save general Options like all bar positions and status as well as the geometry to
118 * the configuration file.
120 void slotSaveOptions();
122 /** closes the windows , then quits the application.
124 void slotFileQuit();
126 /** changes the statusbar contents for the standard label permanently, used to indicate
127 * current actions.
128 * @param text the text that is displayed in the statusbar
130 void slotStatusMsg(const QString &text);
132 /** opens the Preferences-Dialog.
134 void slotPreferences();
136 /** activated if "say" from tray was clicked.
138 void slotSayClipboard();
140 /** activated if "say" from app-window was clicked.
142 void slotSayText();
144 /** activated if "shut up" was clicked.
146 void slotStopActivated();
148 /** activated if "pause" was clicked.
150 void slotPauseActivated();
152 /** activated if "next sentence" was clicked.
154 void slotNextSentenceActivated();
156 /** activated if "previous sentence" was clicked.
158 void slotPrevSentenceActivated();
160 /** called if text processing was finished.
162 void slotFinished();
164 /** called to enable the copy/cut action, if text is selected in the TextEdit-View
165 \param enable Enable actions if true, disable actions if false.
167 void slotEnableCopyCut(bool enable);
169 /** sets the Caption of the MainWindow */
170 void slotSetCaption(const QString &caption);
172 /** called when the Text was changed.
173 * \param empty True if the TextEdit view is empty.
175 void slotTextChanged(bool empty);
177 /** enabled/disables the textedit window;
178 * \param enable true=enabled, false=disabled
180 void slotEnableTextedit(bool enable);
182 /** toggles the statusbar
184 void slotToggleStatusBar();
186 /** Called when the ToolBar shall be configured by the user.
188 void slotConfigureToolbar();
190 /** Called to add a bookmark.
192 void slotAddBookmark();
194 /** Called to delete a bookmark
196 void slotDeleteBookmark(const QString &url, const QString &title);
198 /** Called to edit bookmarks.
200 void slotEditBookmarks();
202 /** Called from slotConfigureToolbar() if we have a new ToolBar-configuration.
204 void slotNewToolbarConfig();
206 /** called whenever the content of the clipboard changes.
207 * Checks if the content of the Clipboard is of type text/plain.
208 * Disables and enables the SystemTray-object.
210 void slotClipboardChanged();
212 /** Deletes the content of the Textview.
214 void slotClear();
216 /** Hides the MainWindow
218 void slotCloseMainWindow();
220 /** Dialog to edit the Key associations
222 void slotEditKeys();
224 /** Open file action
226 void slotFileOpen();
228 /** Save file
230 void slotFileSave();
232 /** Save file as
234 void slotFileSaveAs();
236 /** Called, when the TTS Library has finished processing.
238 void slotTTSFinished();
240 /** Edit mode switched on/off.
242 void slotEditToggled();
245 * Catches the signal from the TreeView object
246 * and forwards it to the BookmarkHandler object.
248 void slotNotifyBookmarkHandler(const QString &ID, const QString &title);
251 * Copies the content of the current bookmark file to the
252 * file designated by \p newname and install a new
253 * BookmarkHandler.
254 * \param newname The name of the new bookmark file.
256 void slotChangeBookmarkFilename(const QString &newname);
258 /** Loads bookmark file corresponding to the given file.
259 * \param newname The name of the new file.
261 void slotSetBookmarkFilename(const QString &newname);
263 public:
265 * Selects the item with the given ID in the TreeView.
266 * \param ID The ID of the item to select.
267 * \param title The title of the bookmark.
268 * \returns <tt>QString()</tt>, if the operation was successfull,
269 * an error message, if the ID was not found.
271 QString setItemByBookmark( const QString &ID, const QString &title );
273 private: // Methods
274 /** read general Options again and initialize all variables.
276 void readOptions();
278 /** initializes the KActions of the application */
279 void initActions();
281 /** sets up the statusbar for the main window by initialzing a statuslabel.
283 void initStatusBar();
287 void initBookmarkManager(const QString &filename);
289 /** creates the centerwidget of the KTMainWindow instance and sets it as the view.
291 void initView();
293 /** resets the editor. Do not create an empty document.
295 void resetView();
297 /** start to say the text on the KTTSD's Job-Stack.
299 void sayActivated();
301 /** reimplemented from baseclass
303 virtual void closeEvent(QCloseEvent *ce);
305 /** disable/enable Actions.
306 * \param actions An OR'ed integer of enum ACTIONS. A '1' is supposed
307 * as 'Action enabled'.
309 void setActions(int actions);
312 * Returns the absolute pathname of the given bookmarkfile.
313 * This is the first KDE resource directory \p (share/apps) in which
314 * the user has write permissions. The relative path is
315 * \p ksayit/ksayit_bookmarks/.
316 * \param filename The name of the bookmark file.
317 * \returns The absolute pathname of the given bookmark file.
318 * Returns \p QString() if the operation was not successfull.
320 QString getBookmarkDir(const QString &filename);
323 private:
324 KConfig *config;
325 KSayItViewImpl *view;
326 KSayItSystemTray *tray;
327 // EffectStack *es;
328 DocTreeViewImpl *treeview;
329 KBookmarkManager *bkManager;
330 KSayItBookmarkHandler *bkHandler;
331 KBookmarkMenu *bkMenu;
333 // KAction pointers
334 KToggleAction *statusBarAction;
335 KAction *say;
336 KAction *pause;
337 KAction *shutup;
338 KAction *next_sentence;
339 KAction *prev_sentence;
340 KAction *clear;
341 KAction *copy;
342 KAction *cut;
343 KAction *paste;
344 KAction *open;
345 KAction *save;
346 KAction *saveAs;
347 KAction *preferences;
348 KToggleAction *edit;
349 KActionMenu *bookmarkmenu;
351 // Misc stuff
352 QClipboard *cb;
353 QString clip;
354 KTTSDLib *m_kttslib;
355 // FXPluginHandler *m_fxpluginhandler;
356 bool m_ap_saying;
357 bool m_ap_paused;
358 bool m_textview_empty;
359 bool m_enableChangeNotifications;
360 QString m_currentBookmarkFile;
364 #endif // KSAYIT_H