1 /***************************************************************************
2 kwordquiz.h - description
4 begin : Wed Jul 24 20:12:30 PDT 2002
5 copyright : (C) 2002-2003 by Peter Hedlund
6 email : peter@peterandlinda.com
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
26 // include files for Qt
27 #include <qsignalmapper.h>
29 // include files for KDE
30 #include <kapplication.h>
31 #include <kmainwindow.h>
33 #include <kdirwatch.h>
36 // forward declaration of the KWordQuiz classes
46 * The base class for KWordQuiz application windows. It sets up the main
47 * window and reads the config file as well as providing a menubar, toolbar
48 * and statusbar. An instance of KWordQuizView creates your center view, which is connected
49 * to the window's Doc object.
50 * KWordQuizApp reimplements the methods that KMainWindow provides for main window handling and supports
51 * full session management as well as using KActions.
56 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
57 * @version KDevelop version 1.2 code generation
59 class KWordQuizApp
: public KMainWindow
63 friend class KWordQuizView
;
66 /** construtor of KWordQuizApp, calls all init functions to create the application.
68 KWordQuizApp(QWidget
* parent
=0, const char* name
=0);
70 /** opens a file specified by commandline option
72 void openDocumentFile(const KURL
& url
=0);
73 /** returns a pointer to the current document connected to the KTMainWindow instance and is used by
74 * the View class to access the document object's methods
76 KWordQuizDoc
*getDocument() const;
78 bool saveAsFileName();
80 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
84 /** read general Options again and initialize all variables like the recent file list
87 /** initializes the KActions of the application */
90 /** sets up the statusbar for the main window by initialzing a statuslabel.
93 /** initializes the document object of the main window that is connected to the view in initView().
97 /** creates the centerwidget of the KTMainWindow instance and sets it as the view
100 /** queryClose is called by KTMainWindow on each closeEvent of a window. Against the
101 * default implementation (only returns true), this calles saveModified() on the document object to ask if the document shall
102 * be saved if Modified; on cancel the closeEvent is rejected.
103 * @see KTMainWindow#queryClose
104 * @see KTMainWindow#closeEvent
106 virtual bool queryClose();
107 /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
108 * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
110 * @see KTMainWindow#queryExit
111 * @see KTMainWindow#closeEvent
113 virtual bool queryExit();
114 /** saves the window properties for each open window during session end to the session config file, including saving the currently
115 * opened file by a temporary filename provided by KApplication.
116 * @see KTMainWindow#saveProperties
118 virtual void saveProperties(KConfig
*_cfg
);
119 /** reads the session config file and restores the application's state including the last opened files and documents by reading the
120 * temporary files saved by saveProperties()
121 * @see KTMainWindow#readProperties
123 virtual void readProperties(KConfig
*_cfg
);
126 void settingsChanged();
129 /** open a new application window by creating a new instance of KWordQuizApp */
131 /** open a file and load it into the document*/
133 /** opens a file from the recent files menu */
134 void slotFileOpenRecent(const KURL
& url
);
135 /** save a document */
137 /** save a document by a new filename*/
138 void slotFileSaveAs();
139 /** asks for saving if the file is modified, then closes the actual file and window*/
140 void slotFileClose();
141 /** print the actual file */
142 void slotFilePrint();
143 /** closes all open windows by calling close() on each memberList item until the list is empty, then quits the application.
144 * If queryClose() returns false because the user canceled the saveModified() dialog, the closing breaks.*/
147 /** undo the last command */
149 /** put the marked text/object into the clipboard and remove it from the document */
151 /** put the marked text/object into the clipboard */
153 /** paste the clipboard into the document */
154 void slotEditPaste();
155 /** clear the grid selection */
156 void slotEditClear();
157 /** insert a new row */
158 void slotEditInsert();
159 /** delete selected row(s) */
160 void slotEditDelete();
161 /** mark word as blank */
162 void slotEditMarkBlank();
163 /** unmark word as blank */
164 void slotEditUnmarkBlank();
165 /** find and replace text */
168 /** define vocabulary languages */
169 void slotVocabLanguages();
170 /** define vocabulary fonts */
171 void slotVocabFont();
172 /** define keyboard layouts */
173 void slotVocabKeyboard();
174 /** define special characters */
175 void slotVocabChar();
176 /** define row and column properties */
178 /** sort vocabulary */
179 void slotVocabSort();
180 /** shuffle the vocabulary */
181 void slotVocabShuffle();
195 /** editor session */
196 void slotQuizEditor();
197 /** flashcard session */
198 void slotQuizFlash();
199 /** multiple choice session */
200 void slotQuizMultiple();
201 /** question and answer session */
204 /** configure notifications */
205 void slotConfigureNotifications();
206 /** configure kwordquiz */
207 void slotConfigure();
210 /** changes the statusbar contents for the standard label permanently, used to indicate current actions.
211 * @param text the text that is displayed in the statusbar */
212 void slotStatusMsg(const QString
&text
);
214 /** applies changes from the preferences dialog */
215 void slotApplyPreferences();
217 void slotUndoChange(const QString
& text
, bool enabled
);
219 void slotInsertChar(int i
);
221 void slotActionHighlighted(KAction
*, bool);
223 void slotContextMenuRequested(int, int, const QPoint
&);
226 WQQuiz::QuizType m_quizType
;
230 /** view is the main widget which represents your working area. The View
231 * class should handle all events of the view widget. It is kept empty so
232 * you can create your view according to your application's needs by
233 * changing the view class.
235 KWordQuizView
*m_editView
;
236 FlashView
*m_flashView
;
237 MultipleView
*m_multipleView
;
240 KWordQuizPrefs
*m_prefDialog
;
242 /** doc represents your actual document and is created only once. It keeps
243 * information such as filename and does the serialization of your files.
247 // KAction pointers to enable/disable actions
250 KRecentFilesAction
* fileOpenRecent
;
264 KAction
* editMarkBlank
;
265 KAction
* editUnmarkBlank
;
268 KAction
* vocabLanguages
;
270 //KAction* vocabKeyboard;
273 KAction
* vocabShuffle
;
275 KToolBarPopupAction
* mode
;
276 KToggleAction
* mode1
;
277 KToggleAction
* mode2
;
278 KToggleAction
* mode3
;
279 KToggleAction
* mode4
;
280 KToggleAction
* mode5
;
284 KAction
* quizMultiple
;
288 KAction
* quizRestart
;
289 KAction
* quizRepeatErrors
;
292 KAction
* flashDontKnow
;
296 QSignalMapper
* charMapper
;
297 KAction
* specialChar1
;
298 KAction
* specialChar2
;
299 KAction
* specialChar3
;
300 KAction
* specialChar4
;
301 KAction
* specialChar5
;
302 KAction
* specialChar6
;
303 KAction
* specialChar7
;
304 KAction
* specialChar8
;
305 KAction
* specialChar9
;
307 KDirWatch
* m_dirWatch
;
309 void updateMode(int m
);
310 void updateSession(WQQuiz::QuizType qt
);
311 void updateActions(WQQuiz::QuizType qt
);
312 void updateSpecialCharIcons();
313 QString
charIcon(const QChar
&);
314 void openURL(const KURL
& url
);
317 #endif // KWORDQUIZ_H