1/***************************************************************************
2 kmouth.h - description
3 -------------------
4 begin : Mon Aug 26 15:41:23 CEST 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18
19#ifndef KMOUTH_H
20#define KMOUTH_H
21
22// include files for Qt
23#include <QtGui/QPrinter>
24
25// include files for KDE
26#include <kxmlguiwindow.h>
27#include <kaction.h>
28#include <kurl.h>
29#include <kconfig.h>
30#include <ksharedconfig.h>
31
32// forward declaration of the KMouth classes
33class PhraseList;
34class OptionsDialog;
35class TextToSpeechSystem;
36class PhraseBook;
37class KToggleAction;
38class KActionCollection;
39/**
40 * The base class for KMouth application windows. It sets up the main
41 * window and reads the config file as well as providing a menubar, toolbar
42 * and statusbar.
43 * KMouthApp reimplements the methods that KXmlGuiWindow provides for main window handling and supports
44 * full session management as well as using KActions.
45 * @see KXmlGuiWindow
46 * @see KApplication
47 * @see KConfig
48 *
49 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
50 * @version KDevelop version 1.2 code generation
51 */
52class KMouthApp : public KXmlGuiWindow
53{
54 Q_OBJECT
55
56 public:
57 /** construtor of KMouthApp, calls all init functions to create the application.
58 */
59 explicit KMouthApp(QWidget* parent=0, const char* name=0);
60 ~KMouthApp();
61 /** Returns true if the configuration wizard was not needed or when it
62 * was successfully completed.
63 */
64 bool configured();
65 /** opens a file specified by commandline option
66 */
67 void openDocumentFile(const KUrl& url=KUrl());
68
69 TextToSpeechSystem *getTTSSystem() const;
70
71 /** called by PhraseList in order to enable or disable the actions depending
72 * on the contents of the phrase list.
73 */
74 void enableMenuEntries(bool existSelectedEntries, bool existDeselectedEntries);
75
76 protected:
77 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
78 * file
79 */
80 void saveOptions();
81 /** read general Options again and initialize all variables like the recent file list
82 */
83 void readOptions();
84 /** initializes the phrase list */
85 void initPhraseList();
86 /** initializes the KActions of the application */
87 void initActions();
88 /** sets up the statusbar for the main window by initialzing a statuslabel.
89 */
90 void initStatusBar();
91 /** queryClose is called by KMainWindow on each closeEvent of a window. Against the
92 * default implementation (only returns true), this calles saveModified() on the document object to ask if the document shall
93 * be saved if Modified; on cancel the closeEvent is rejected.
94 * @see KMainWindow#queryClose
95 * @see KMainWindow#closeEvent
96 */
97 virtual bool queryClose();
98
99 public slots:
100 /** open a file and load it into the history */
101 void slotFileOpen();
102 /** save a document */
103 void slotFileSaveAs();
104 /** print the actual file */
105 void slotFilePrint();
106 /** closes all open windows by calling close() on each memberList item until the list is empty, then quits the application.
107 * If queryClose() returns false because the user canceled the saveModified() dialog, the closing breaks.
108 */
109 void slotFileQuit();
110 /** edits the phrase books
111 */
112 void slotEditPhrasebook ();
113 /** toggles the menu bar
114 */
115 void slotViewMenuBar();
116 /** toggles the toolbar
117 */
118 void slotViewToolBar();
119 /** toggles the phrasebook bar
120 */
121 void slotViewPhrasebookBar();
122 /** toggles the statusbar
123 */
124 void slotViewStatusBar();
125 /** configures the TTS system
126 */
127 void slotConfigureTTS();
128 /** changes the statusbar contents for the standard label permanently, used to indicate current actions.
129 * @param text the text that is displayed in the statusbar
130 */
131 void slotStatusMsg(const QString &text);
132
133 void slotPhrasebookConfirmed (PhraseBook &book);
134
135 void slotConfigurationChanged();
136
137 void slotPhraseSelected (const QString &phrase);
138
139 private:
140 bool isConfigured;
141 /** the configuration object of the application */
142 KSharedConfigPtr config;
143 /** The phrase list */
144 PhraseList *phraseList;
145 /** The configuration dialog */
146 OptionsDialog *optionsDialog;
147
148 // KAction pointers to enable/disable actions
149 KAction* fileOpen;
150 KAction* fileSaveAs;
151 KAction* filePrint;
152 QAction* fileQuit;
153
154 QAction* editCut;
155 QAction* editCopy;
156 QAction* editPaste;
157 QAction* editSpeak;
158
159 KActionCollection *phrases;
160 QAction* phrasebookEdit;
161
162 KToggleAction* viewMenuBar;
163 KToggleAction* viewToolBar;
164 KToggleAction* viewPhrasebookBar;
165 KToggleAction* viewStatusBar;
166 QAction* configureTTS;
167
168 QAction* phraseListSpeak;
169 QAction* phraseListRemove;
170 QAction* phraseListCut;
171 QAction* phraseListCopy;
172 QAction* phraselistSelectAll;
173 QAction* phraselistDeselectAll;
174
175 // Keep QPrinter so settings persist
176 QPrinter *printer;
177};
178
179#endif // KMOUTH_H
180