summaryrefslogtreecommitdiffstats
path: root/kmouth/kmouth.h
blob: 4155e96dff40a61cbe475a46e627c9bd0949fbce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/***************************************************************************
                          kmouth.h  -  description
                             -------------------
    begin                : Mon Aug 26 15:41:23 CEST 2002
    copyright            : (C) 2002 by Gunnar Schmi Dt
    email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef KMOUTH_H
#define KMOUTH_H

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

// include files for TQt

// include files for KDE
#include <tdeapplication.h>
#include <tdemainwindow.h>
#include <tdeaccel.h>
#include <tdeaction.h>
#include <kurl.h>

// forward declaration of the KMouth classes
class PhraseList;
class OptionsDialog;
class TextToSpeechSystem;
class PhraseBookDialog;
class PhraseBook;

/**
  * The base class for KMouth application windows. It sets up the main
  * window and reads the config file as well as providing a menubar, toolbar
  * and statusbar.
  * KMouthApp reimplements the methods that TDEMainWindow provides for main window handling and supports
  * full session management as well as using TDEActions.
  * @see TDEMainWindow
  * @see TDEApplication
  * @see TDEConfig
  *
  * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
  * @version KDevelop version 1.2 code generation
  */
class KMouthApp : public TDEMainWindow
{
  TQ_OBJECT
  

  public:
    /** construtor of KMouthApp, calls all init functions to create the application.
     */
    KMouthApp(TQWidget* parent=0, const char* name=0);
    ~KMouthApp();
    /** Returns true if the configuration wizard was not needed or when it
     * was successfully completed.
     */
    bool configured();
    /** opens a file specified by commandline option
     */
    void openDocumentFile(const KURL& url=KURL());

    TextToSpeechSystem *getTTSSystem() const;

    /** called by PhraseList in order to enable or disable the actions depending
     * on the contents of the phrase list.
     */
    void enableMenuEntries(bool existSelectedEntries, bool existDeselectedEntries);

  protected:
    /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
     * file
     */
    void saveOptions();
    /** read general Options again and initialize all variables like the recent file list
     */
    void readOptions();
    /** initializes the phrase list */
    void initPhraseList();
    /** initializes the TDEActions of the application */
    void initActions();
    /** sets up the statusbar for the main window by initialzing a statuslabel.
     */
    void initStatusBar();
    /** queryClose is called by KTMainWindow on each closeEvent of a window. Against the
     * default implementation (only returns true), this calles saveModified() on the document object to ask if the document shall
     * be saved if Modified; on cancel the closeEvent is rejected.
     * @see KTMainWindow#queryClose
     * @see KTMainWindow#closeEvent
     */
    virtual bool queryClose();
    /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
     * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
     * properties.
     * @see KTMainWindow#queryExit
     * @see KTMainWindow#closeEvent
     */
    virtual bool queryExit();

  public slots:
    /** open a file and load it into the history */
    void slotFileOpen();
    /** save a document */
    void slotFileSaveAs();
    /** print the actual file */
    void slotFilePrint();
    /** closes all open windows by calling close() on each memberList item until the list is empty, then quits the application.
     * If queryClose() returns false because the user canceled the saveModified() dialog, the closing breaks.
     */
    void slotFileQuit();
    /** edits the phrase books
     */
    void slotEditPhrasebook ();
    /** toggles the menu bar
     */
    void slotViewMenuBar();
    /** toggles the toolbar
     */
    void slotViewToolBar();
    /** toggles the phrasebook bar
     */
    void slotViewPhrasebookBar();
    /** toggles the statusbar
     */
    void slotViewStatusBar();
    /** configures the TTS system
     */
    void slotConfigureTTS();
    /** changes the statusbar contents for the standard label permanently, used to indicate current actions.
     * @param text the text that is displayed in the statusbar
     */
    void slotStatusMsg(const TQString &text);

    void slotPhrasebookConfirmed (PhraseBook &book);

    void slotConfigurationChanged();

    void slotPhraseSelected (const TQString &phrase);

  private:
    bool isConfigured;
    /** the configuration object of the application */
    TDEConfig *config;
    /** The phrase list */
    PhraseList *phraseList;
    /** The configuration dialog */
    OptionsDialog *optionsDialog;

    // TDEAction pointers to enable/disable actions
    TDEAction* fileOpen;
    TDEAction* fileSaveAs;
    TDEAction* filePrint;
    TDEAction* fileQuit;

    TDEAction* editCut;
    TDEAction* editCopy;
    TDEAction* editPaste;
    TDEAction* editSpeak;

    TDEActionCollection *phrases;
    TDEAction* phrasebookEdit;

    TDEToggleAction* viewMenuBar;
    TDEToggleAction* viewToolBar;
    TDEToggleAction* viewPhrasebookBar;
    TDEToggleAction* viewStatusBar;
    TDEAction*       configureTTS;

    TDEAction* phraseListSpeak;
    TDEAction* phraseListRemove;
    TDEAction* phraseListCut;
    TDEAction* phraseListCopy;
    TDEAction* phraselistSelectAll;
    TDEAction* phraselistDeselectAll;
};

#endif // KMOUTH_H