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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
/***************************************************************************
main part of kvoctrain
-----------------------------------------------------------------------
begin : Thu Mar 11 20:50:53 MET 1999
copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
(C) 2001 The KDE-EDU team
(C) 2004-2005 Peter Hedlund <peter.hedlund@kdemail.net>
-----------------------------------------------------------------------
***************************************************************************/
/***************************************************************************
* *
* 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 KVOCTRAIN_H
#define KVOCTRAIN_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// include files for QT
#include <tqpainter.h>
// include files for KDE
#include <kapplication.h>
#include <kmainwindow.h>
#include <kaction.h>
#include <kmenubar.h>
#include <kmessagebox.h>
#include <krandomsequence.h>
// application specific includes
#include "kvoctrainview.h"
#include "kvoctraintable.h"
#include "query-dialogs/QueryDlgBase.h"
#include "kvtnewstuff.h"
#include "langset.h"
class TQTimer;
class KLined;
class ProgressDlg;
class kvoctrainDoc;
class SimpleQueryDlg;
class MCQueryDlg;
class VerbQueryDlg;
class RandomQueryDlg;
class AdjQueryDlg;
class ArtQueryDlg;
class EntryDlg;
class KLineEdit;
class KComboBox;
class KProgress;
class KVTNewStuff;
/**
* This Class is the base class for your application. It sets up the main
* window and reads the config file as well as providing a menubar, toolbar
* and statusbar. For the main view, an instance of class kvoctrainView is
* created which creates your view.
*/
class kvoctrainApp : public KMainWindow
{
Q_OBJECT
TQ_OBJECT
public:
/** construtor */
kvoctrainApp(TQWidget *parent = NULL, const char *name = NULL);
/** destructor */
~kvoctrainApp();
void initActions();
/** setup the statusbar */
void initStatusBar();
/** setup the main document*/
void initDoc();
/** setup the main view*/
void initView();
/** save the app-specific options on slotAppExit or by an Options dialog */
void saveOptions();
/** read the app-specific options on init() or by an Options dialog */
void readOptions();
void saveLanguages();
void readLanguages();
/** 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 KApplication.
* @see KMainWindow#saveProperties
*/
virtual void saveProperties(KConfig* );
/** 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 KMainWindow#readProperties
*/
virtual void readProperties(KConfig* );
/** Whether the user has selected a range of items. **/
bool hasSelection();
signals:
void progressChanged (kvoctrainDoc *, int curr_percent);
public slots:
void keyPressEvent( TQKeyEvent *e );
void keyReleaseEvent( TQKeyEvent *e );
void slotModifiedDoc(bool mod);
void slotCurrentCellChanged(int row, int col);
// void slotSelectEntry (int row, int col, int key_state);
/** edit an entry */
void slotEditEntry(int row, int col);
void slotEditCallBack(int res);
void commitEntryDlg(bool force);
void createEntryDlg(int row, int col);
void setDataEntryDlg (int row, int col);
void removeEntryDlg();
/** select an entry */
void slotSaveSelection ();
void slotCancelSelection ();
void slotSelectAll();
void slotProgress(kvoctrainDoc*,int);
void slotResumeSearch(const TQString&);
void slotSearchNext();
void slotInitSearch();
void slotCreateLesson(int header);
void slotCleanVocabulary ();
void slotChooseLesson(int id);
// void slotSearchClip();
void slotSetHeaderProp (int header_and_id);
void slotHeaderCallBack (int cmd_and_id);
void slotHeaderStatus (int cmd_and_id);
void slotHeaderMenu(int header, int x, int y);
/** append language to table */
void slotAppendLang(int header);
/** exit query mode */
void slotStopQuery(bool show_view);
bool queryClose();
/** overloaded for Message box on last window exit */
bool queryExit();
/** set up options */
void slotGeneralOptionsPage(int index);
void slotGeneralOptions();
//void slotQueryOptions();
//void slotQueryOptions(int pageindex);
void slotApplyPreferences();
void slotDocProps();
void slotDocPropsLang();
void slotShowStatist();
void slotCreateRandom();
/** set up vocabulary and learning submenus */
void aboutToShowVocabAppendLanguage();
void aboutToShowVocabSetLanguage();
void aboutToShowVocabRemoveLanguage();
void aboutToShowLearn();
/** starts random query mode */
void slotRestartQuery();
void slotStartTypeQuery(int col, const TQString & type);
void slotStartPropertyQuery(int col, QueryType property);
void slotStartQuery(const TQString & trans, const TQString & org, bool create_new);
void slotTimeOutRandomQuery(QueryDlgBase::Result res);
void slotTimeOutMultipleChoice(QueryDlgBase::Result res);
void slotTimeOutQuery(QueryDlgBase::Result res);
void slotTimeOutType(QueryDlgBase::Result res);
void slotTimeOutProperty(QueryDlgBase::Result res);
void slotTimeOutBackup();
/** open a new application window */
void slotFileNew();
/** open a document */
void slotFileOpen();
/** opens a file from the recent files menu */
void slotFileOpenRecent(const KURL& url);
/** open a sample document */
void slotFileOpenExample();
/** download new vocabularies */
void slotGHNS();
void loadfileFromPath(const KURL &, bool addRecent=true);
/** merge a document */
void slotFileMerge();
/** save a document */
void slotFileSave();
/** save a document under a different filename*/
void slotFileSaveAs();
void slotFilePrint();
void slotFileQuit();
/** put the marked text/object into the clipboard*/
void slotEditCopy();
void slotSmartSearchClip();
void slotAppendRow();
void slotRemoveRow();
void slotEditRow();
/** paste the clipboard into the document*/
void slotEditPaste();
/** change the status message to text */
void slotStatusMsg(const TQString &text);
/** change the status message of the whole statusbar temporary */
void slotStatusHelpMsg(const TQString &text);
public:
void removeProgressBar();
void prepareProgressBar();
void fillLessonBox(kvoctrainDoc *);
void loadDocProps(kvoctrainDoc *);
void saveDocProps(kvoctrainDoc *);
static vector<int> getCsvOrder(kvoctrainDoc *);
private:
// KAction pointers to enable/disable actions
KAction* fileNew;
KAction* fileOpen;
KAction* fileOpenExample;
KAction* fileGHNS;
KRecentFilesAction* fileOpenRecent;
KAction* fileMerge;
KAction* fileSave;
KAction* fileSaveAs;
KAction* filePrint;
KAction* fileQuit;
KAction* editCopy;
KAction* editPaste;
KAction* editSelectAll;
KAction* editClearSelection;
KAction* editSearchFromClipboard;
KAction* editAppend;
KAction* editEditSelectedArea;
KAction* editRemoveSelectedArea;
KAction* editSaveSelectedArea;
KAction* vocabShowStatistics;
KAction* vocabAssignLessons;
KAction* vocabCleanUp;
KSelectAction* vocabAppendLanguage;
KSelectAction* vocabSetLanguage;
KSelectAction* vocabRemoveLanguage;
KAction* vocabDocumentProperties;
KAction* vocabLanguageProperties;
KWidgetAction* vocabLessons;
KWidgetAction* vocabSearch;
//KAction* learningResumeQuery;
//KAction* learningResumeMultipleChoice;
KAction* configToolbar;
KAction* configNotifications;
KAction* configApp;
//KAction* configQueryOptions;
TQString lastPixName;
TQPopupMenu *learn_menu;
/** 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. */
kvoctrainView *view;
/** doc represents your actual document and is created only once. It keeps
* information such as filename and does the serialization of your files.
*/
kvoctrainDoc *doc;
friend class kvoctrainView;
vector<QueryEntryRef> random_expr1, random_expr2;
// Vectors for use in Leitner style learning. There is no
// correct_0_times, we simply reuse random_expr1.
vector<QueryEntryRef> correct_1_times, correct_2_times, correct_3_times;
QuerySelection queryList;
//KNewStuff *m_GHNS;
TQTimer *btimer;
int random_query_nr;
bool querymode;
bool querying;
TQString def_lang;
TQPopupMenu *header_m;
int act_query_col;
TQString act_query_trans;
TQString act_query_org;
LangSet langset;
int searchpos;
TQString searchstr;
KLineEdit *searchLine;
KComboBox *lessons;
int act_lesson;
QueryManager querymanager;
bool controlActive;
bool shiftActive;
bool altActive;
ProgressDlg *pdlg;
KProgress *pbar;
TQLabel *vslide_label;
TQLabel *pron_label;
TQLabel *rem_label;
TQLabel *type_label;
SimpleQueryDlg *simpleQueryDlg;
EntryDlg *entryDlg;
MCQueryDlg *mcQueryDlg;
VerbQueryDlg *verbQueryDlg;
RandomQueryDlg *randomQueryDlg;
AdjQueryDlg *adjQueryDlg;
ArtQueryDlg *artQueryDlg;
int num_queryTimeout;
int query_cycle;
int query_num;
int query_startnum;
QueryType queryType;
KRandomSequence random;
KVTNewStuff *m_newStuff;
};
#endif // KVOCTRAIN_H
|