moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kvoctrain / kvoctrain / entry-dialogs / EntryDlg.h
blobe0af91ef652d592c537a6f17d5246c9e7034fc19
1 /***************************************************************************
3 entry dialog for table cell contents
5 -----------------------------------------------------------------------
7 begin : Thu Mar 11 20:50:53 MET 1999
9 copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
10 (C) 2001 The KDE-EDU team
11 (C) 2005 Peter Hedlund <peter@peterandlinda.com>
13 -----------------------------------------------------------------------
15 ***************************************************************************
17 ***************************************************************************
18 * *
19 * This program is free software; you can redistribute it and/or modify *
20 * it under the terms of the GNU General Public License as published by *
21 * the Free Software Foundation; either version 2 of the License, or *
22 * (at your option) any later version. *
23 * *
24 ***************************************************************************/
26 #ifndef EntryDlg_included
27 #define EntryDlg_included
29 #include <qtable.h>
31 #include <kdialogbase.h>
33 #include "FromToEntryPage.h"
34 #include "CommonEntryPage.h"
35 #include "AuxInfoEntryPage.h"
36 #include "TenseEntryPage.h"
37 #include "AdjEntryPage.h"
38 #include "MCEntryPage.h"
40 class LangSet;
41 class QTabWidget;
42 class KMainWindow;
43 class kvoctrainDoc;
45 class EntryDlg : public KDialogBase
47 Q_OBJECT
49 public:
51 enum EditResult {EditCancel, EditApply, EditUndo, EditPageUp, EditPageDown, EditUp, EditDown, EditLeft, EditRight};
53 enum EnableType {EnableAll, EnableOnlyCommon, EnableNone, EnableOnlyOriginal };
55 EntryDlg
56 ( KMainWindow *main,
57 kvoctrainDoc *doc,
58 bool multi_sel,
59 bool origin,
60 grade_t f_grd,
61 grade_t t_grd,
62 count_t f_qcount,
63 count_t t_qcount,
64 count_t f_bcount,
65 count_t t_bcount,
66 time_t f_qdate,
67 time_t t_qdate,
68 QString f_faux_ami,
69 QString t_faux_ami,
70 QString _expr,
71 int _lesson,
72 QComboBox *_lessonBox,
73 QString lang,
74 LangSet &langset,
75 QString remark,
76 QString _type,
77 QString pronunce,
78 QString synonym,
79 QString antonym,
80 QString example,
81 QString usagelabel,
82 QString paraphrase,
83 const Conjugation &con_prefix,
84 const Conjugation &conjugations,
85 const Article &article,
86 const Comparison &comp,
87 const MultipleChoice &mc,
88 QueryManager &querymanager,
89 const QString &title,
90 bool active,
91 const QFont& ipafont,
92 QWidget *parent = 0,
93 const char *name = 0,
94 bool modal = false
97 ~EntryDlg ();
99 void setData
100 (kvoctrainDoc *doc,
101 bool multi_sel,
102 bool origin,
103 grade_t f_grd,
104 grade_t t_grd,
105 count_t f_qcount,
106 count_t t_qcount,
107 count_t f_bcount,
108 count_t t_bcount,
109 time_t f_qdate,
110 time_t t_qdate,
111 QString f_faux_ami,
112 QString t_faux_ami,
113 QString _expr,
114 int _lesson,
115 QComboBox *_lessonBox,
116 QString lang,
117 LangSet &langset,
118 QString remark,
119 QString _type,
120 QString pronunce,
121 QString synonym,
122 QString antonym,
123 QString example,
124 QString usagelabel,
125 QString paraphrase,
126 const Conjugation &con_prefix,
127 const Conjugation &conjugations,
128 const Article &article,
129 const Comparison &comp,
130 const MultipleChoice &mc,
131 QueryManager &querymanager,
132 const QString &title,
133 bool active);
135 bool fromDateDirty () const { return from_page ? from_page->dateDirty() : false; }
136 bool fromGradeDirty () const { return from_page ? from_page->gradeDirty() : false; }
137 bool fromBCountDirty () const { return from_page ? from_page->bCountDirty() : false; }
138 bool fromQCountDirty () const { return from_page ? from_page->qCountDirty() : false; }
139 QString getFromFauxAmi () const { return from_page ? from_page->getFauxAmi() : QString(""); }
141 time_t getFromDate () const { return from_page ? from_page->getDate() : 0; }
142 grade_t getFromGrade () const { return from_page ? from_page->getGrade() : KV_NORM_GRADE; }
143 count_t getFromBCount () const { return from_page ? from_page->getBCount() : 0; }
144 count_t getFromQCount () const { return from_page ? from_page->getQCount() : 0; }
146 bool toDateDirty () const { return to_page ? to_page->dateDirty() : false; }
147 bool toGradeDirty () const { return to_page ? to_page->gradeDirty() : false; }
148 bool toBCountDirty () const { return to_page ? to_page->bCountDirty() : false; }
149 bool toQCountDirty () const { return to_page ? to_page->qCountDirty() : false; }
150 QString getToFauxAmi () const { return to_page ? to_page->getFauxAmi() : QString(""); }
152 time_t getToDate () const { return to_page ? to_page->getDate() : 0; }
153 grade_t getToGrade () const { return to_page ? to_page->getGrade() : KV_NORM_GRADE; }
154 count_t getToBCount () const { return to_page ? to_page->getBCount() : 0; }
155 count_t getToQCount () const { return to_page ? to_page->getQCount() : 0; }
157 bool lessonDirty () const { return comm_page->lessonDirty(); }
158 bool usageDirty () const { return comm_page->usageDirty(); }
159 bool typeDirty () const { return comm_page->typeDirty (); }
160 bool activeDirty () const { return comm_page->activeDirty (); }
162 int getLesson () const { return comm_page->getLesson(); }
163 QString getType () const { return comm_page->getType(); }
164 QString getExpr () const { return comm_page->getExpr(); }
165 QString getPronunce () const { return comm_page->getPronunce(); }
166 QString getUsageLabel() const { return comm_page->getUsageLabel(); }
167 bool getActive() const { return comm_page->getActive(); }
169 QString getSynonym () const { return aux_page->getSynonym(); }
170 QString getAntonym () const { return aux_page->getAntonym(); }
171 QString getRemark () const { return aux_page->getRemark(); }
172 QString getExample () const { return aux_page->getExample(); }
173 QString getParaphrase () const { return aux_page->getParaphrase(); }
175 Conjugation getConjugation() const { return tense_page->getConjugation(); }
177 Comparison getComparison() const { return adj_page->getComparison(); }
179 MultipleChoice getMultipleChoice() const { return mc_page->getMultipleChoice(); }
181 bool isModified();
182 void setModified(bool mod);
183 void setEnabled(int);
185 void setCell(int row, int col, const vector<QTableSelection>& sel);
186 void getCell(int &row, int &col, vector<QTableSelection>& sel) const;
188 signals:
189 void sigEditChoice(int);
191 public slots:
192 void slotDisplayModified();
193 void slotApply();
194 void slotUndo();
195 void slotDockHorizontal();
196 void slotDockVertical();
198 protected slots:
199 void updatePages(const QString &type);
200 virtual void reject ();
202 protected:
203 virtual void closeEvent (QCloseEvent*e);
205 FromToEntryPage *from_page,
206 *to_page;
207 CommonEntryPage *comm_page;
208 AuxInfoEntryPage *aux_page;
209 TenseEntryPage *tense_page;
210 AdjEntryPage *adj_page;
211 MCEntryPage *mc_page;
212 int edit_row, edit_col;
213 QTabWidget *tabber;
215 vector<QTableSelection> selections;
216 KMainWindow *mainwin;
217 QSize oldMainSize;
218 QPoint oldMainPos;
219 bool docked;
222 #endif // EntryDlg_included