summaryrefslogtreecommitdiffstats
path: root/kverbos/kverbos/kverbos.h
blob: fd1a744cb26d5a9e779b84f49e08d6c9985295b6 (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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/***************************************************************************
                          kverbos.h  -  description
                             -------------------
    begin                : Fre Dez 14 19:28:09 CET 2001
    copyright            : (C) 2001 by Arnold Kraschinski
    email                : arnold.k67@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KVERBOS_H
#define KVERBOS_H
 

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

// include files for TQt

// include files for KDE
#include <kapplication.h>
#include <tdemainwindow.h>
#include <tdeaction.h>

// include files for the application
#include "verbspanish.h"

// forward declaration of the KVerbos classes
class KVerbosDoc;
class KVerbosView;
class KErfassen;
class KVerbEdit;
class KFeederControl;

/**
  * The base class for KVerbos application windows. It sets up the main
  * window and reads the config file as well as providing a menubar, toolbar
  * and statusbar. An instance of KVerbosView creates your center view, which is connected
  * to the window's Doc object.
  * KVerbosApp 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 KVerbosApp : public TDEMainWindow
{
  Q_OBJECT
  

  friend class KVerbosView;

  public:
    /** construtor of KVerbosApp, calls all init functions to create the application.
     */
    KVerbosApp(TQWidget* parent=0, const char* name=0);
    ~KVerbosApp();
    /** opens a file specified by commandline option
     */
    void openDocumentFile(const KURL& url/*=0*/);
    /** returns a pointer to the current document connected to the KTMainWindow instance and is used by
     * the View class to access the document object's methods
     */	
    KVerbosDoc *getDocument() const; 	
    /** returns the array with the time options
     */
    void getTimeOptions(bool op[][3]);
    bool doitStrict() const { return correctStrict; }

  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 TDEActions of the application */
    void initActions();
    /** sets up the statusbar for the main window by initialzing a statuslabel.
     */
    void initStatusBar();
    /** initializes the document object of the main window that is connected to the view in initView().
     * @see initView();
     */
    void initDocument();
    /** creates the centerwidget of the KTMainWindow instance and sets it as the view
     */
    void initView();
    /** 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();
    /** saves the window properties for each open window during session end to the session config file, including saving the currently
     * opened file by a temporary filename provided by TDEApplication.
     * @see KTMainWindow#saveProperties
     */
    virtual void saveProperties(TDEConfig *_cfg);
    /** reads the session config file and restores the application's state including the last opened files and documents by reading the
     * temporary files saved by saveProperties()
     * @see KTMainWindow#readProperties
     */
    virtual void readProperties(TDEConfig *_cfg);

  signals:
    /** Dieses Signal zeigt dem Dokument an, dass die Statuszeile mit der richtigen
     *  Verbanzahl aktualisiert werden sollte.
     */
    void testAnzahl(int);
  public slots:
    /** open a new application window by creating a new instance of KVerbosApp */
    void slotFileNewWindow();
    /** clears the document in the actual view to reuse it as the new document */
    void slotFileNew();
    /** open a file and load it into the document*/
    void slotFileOpen();
    /** opens a file from the recent files menu */
    void slotFileOpenRecent(const KURL& url);
    /** opens the standard verb file that is delivered with KVerbos. */
    void slotFileOpenStandard();
    /** save a document */
    void slotFileSave();
    /** save a document by a new filename*/
    void slotFileSaveAs();
    /** asks for saving if the file is modified, then closes the actual file and window*/
    void slotFileClose();
    /** 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();
    /** put the marked text/object into the clipboard and remove
     *	it from the document
     */
    void slotEditCut();
    /** put the marked text/object into the clipboard
     */
    void slotEditCopy();
    /** paste the clipboard into the document
     */
    void slotEditPaste();
    /** 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);
    /** Gibt die Anzahl der Verben in der Statuszeile aus */
    void slotStatusVerbMsg(int);
    /** Gibt die Anzahl der geübten Verben in der Statuszeile aus.
      */
    void slotStatusTrainedMsg(int);
    /** Gibt die Anzahl der richtig eingegebenen Verben in der Statuszeile aus.
      */
    void slotStatusCorrectMsg(int);
    /** öffnet einen Dialog mit dem neue Verben erfasst werden können.
     */
    void slotEditErfassen();
    /** öffnet einen Dialog, der die Liste der Verben anzeigt. Die Verbliste
     *  kann dann bearbeitet werden, Verben löschen, Verben hinzufügen, Einträge
     *  verändern.
     */
    void slotEditBearbeiten();
    /** Opens a dialog. The user can select which times should be trained.
     */
    void slotSettingsOptions();
    /** Opens a dialog. The user can insert his name. Then a user object will be created
     */
    void slotSettingsUsername();
    void slotFeedIt(int n);
    /** Opens a dialog and shows the user his latest ten results. */
    void slotUserResults();

  private:
    /** the configuration object of the application */
    TDEConfig *config;
    /** in this array are the times stored that should be learned
     */
    bool timeOptions[MAX_TIEMPOS][MAX_SUBTYPES];
    /** If 'correctStrict' is true then every missing accent is regarded as an error.
      * If 'correctStrict' is false the program doesn't care about missing accents
      */
    bool correctStrict;
    /** If 'useKFeeder' is true then the KFeeder is used to show the results
      */
    bool useKFeeder;
    /** Is 'true' if the splash screen of the KFeeder should be displayed */
    bool showKFeederSplash;
    /** Is 'true' if automatic food animations are uses for the KFeeder */
    bool automaticKFeeder;
    KFeederControl* kfeederControl;
    /** view is the main widget which represents your working area. The View
     * class should handle all events of the view widget.  It is kept empty so
     * you can create your view according to your application's needs by
     * changing the view class.
     */
    KVerbosView *view;
    /** doc represents your actual document and is created only once. It keeps
     * information such as filename and does the serialization of your files.
     */
    KVerbosDoc *doc;

    // TDEAction pointers to enable/disable actions
    TDEPopupMenu* menuUser;
    TDEAction* fileNewWindow;
    TDEAction* fileNew;
    TDEAction* fileOpen;
    TDERecentFilesAction* fileOpenRecent;
	TDEAction* fileOpenStandard;
    TDEAction* fileSave;
    TDEAction* fileSaveAs;
    TDEAction* fileClose;
    TDEAction* filePrint;
    TDEAction* fileQuit;
    TDEAction* editCut;
    TDEAction* editCopy;
    TDEAction* editPaste;
    TDEAction* editErfassen;
    TDEAction* editBearbeiten;
    TDEAction* settingOptions;
    TDEAction* userUsername;
    TDEAction* userResults;



    static int kverbosCounter;
};
 
#endif // KVERBOS_H