summaryrefslogtreecommitdiffstats
path: root/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPage.h
blob: f8818774d654a192514a33fa538fc8f8b1616078 (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
/***************************************************************************

                         edit common properties

    -----------------------------------------------------------------------

    begin          : Mon Jun 28 21:02:16 1999

    copyright      : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
                     (C) 2001 The KDE-EDU team
                     (C) 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 CommonEntryPage_included
#define CommonEntryPage_included

#include "CommonEntryPageForm.h"

#include <QueryManager.h>
#include <UsageManager.h>

class PhoneticEntryPage;
class EntryDlg;

class CommonEntryPage : public CommonEntryPageForm
{
  Q_OBJECT
  TQ_OBJECT

public:
  CommonEntryPage
  (
    EntryDlg     *dlgbook,
    kvoctrainDoc *doc,
    bool          multi_sel,
    TQString       expr,
    int           less,
    TQComboBox    *lessBox,
    TQString       lang,
    TQString       type,
    TQString       pronunce,
    TQString       usage,
    TQString       label,
    QueryManager &querymanager,
    bool          active,
    const TQFont&  ipafont,
    TQWidget* parent = NULL,
    const char* name = NULL
  );

  void setData(
    bool          multi_sel,
    TQString       expr,
    int           less,
    TQComboBox    *lessBox,
    TQString       lang,
    TQString       type,
    TQString       pronunce,
    TQString       usage,
    TQString       label,
    QueryManager &querymanager,
    bool          active);

  bool isDirty() const;
  bool lessonDirty     () const { return lesson_dirty; }
  bool activeDirty     () const { return active_dirty; }
  bool typeDirty       () const { return type_dirty; }
  bool usageDirty      () const { return usage_dirty; }

  int getLesson        () const { return lesson; }
  TQString getType      () const { return type; }
  TQString getExpr      () const { return expression; }
  TQString getPronunce  () const { return pronunce; }
  TQString getUsageLabel() const { return usageCollection; }
  bool    getActive    () const { return entry_active; }

  bool isModified();
  void setModified(bool mod = true);
  void setEnabled(int enable_type);

signals:
  void typeSelected(const TQString &);

protected:
  void setTypeBox(const TQString &act_type);
  void setLessonBox(TQComboBox *lessbox, int lesson);
  void setUsageBox(const TQString & act_type);

protected slots:
  void slotLessonSelected(int);
  void slotExprSelected(const TQString&);
  void slotTypeSelected(int);
  void slotSubTypeSelected(int);
  void slotPronunceSelected (const TQString&);
  void slotUsageChanged();
  void slotActiveChanged(bool state);
  void phoneticSelected(wchar_t);
  void invokeLessDlg();
  void invokeTypeDlg();
  void invokePronDlg();
  void invokeUsageDlg();

signals:
  void sigModified();

protected:
  TQString       pronunce;
  TQString       expression;
  TQString       usageCollection;
  int           lesson;
  TQString       type;
  EntryDlg     *dlgbook;
  bool          lesson_dirty;
  bool          type_dirty;
  kvoctrainDoc *doc;
  QueryManager &querymanager;
  bool          entry_active;
  bool          active_dirty;
  bool          usage_dirty;

  vector<TypeRelation>  all_maintypes;
  vector<TypeRelation>  all_types;
  vector<UsageRelation> usages;
  vector<TQString>       current_subtypes;

  TQFont                 ipafont;
  bool                  modified;
};
#endif // CommonEntryPage_included