PreferencesDialog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef PREFERENCES_DIALOG_H
00008 #define PREFERENCES_DIALOG_H
00009
00010 #include <iostream.h>
00011 #include <qaction.h>
00012 #include <qcheckbox.h>
00013 #include <qcombobox.h>
00014 #include <qdialog.h>
00015 #include <qfontdatabase.h>
00016 #include <qgrid.h>
00017 #include <qhbox.h>
00018 #include <qheader.h>
00019 #include <qhgroupbox.h>
00020 #include <qlabel.h>
00021 #include <qlayout.h>
00022 #include <qlist.h>
00023 #include <qmessagebox.h>
00024 #include <qobjectlist.h>
00025 #include <qpushbutton.h>
00026 #include <qscrollview.h>
00027 #include <qslider.h>
00028 #include <qstring.h>
00029 #include <qstringlist.h>
00030 #include <qtabwidget.h>
00031 #include <qtooltip.h>
00032 #include <qvbox.h>
00033 #include <qvgroupbox.h>
00034 #include "KeyActionListViewItem.h"
00035 #include "Preferences.h"
00036 #include "SequenceDialog.h"
00037 #include "SequenceListItem.h"
00038 #include "SmartListView.h"
00039 #include "StudyLanguageItem.h"
00040 #include "TermScheduler.h"
00041
00042 extern QAction* action[ ACTION_COUNT ];
00043
00044 class PreferencesDialog : public QDialog {
00045
00046 Q_OBJECT
00047
00048 public:
00049
00050 static const QString fontSizeNameList[];
00051 static const QString interfaceLanguageList[];
00052 static const QString interfaceLanguageCodeList[];
00053 static const QString firstLanguageList[];
00054 static const QString studyLanguageList[];
00055 static const QString studyLanguageCodeList[];
00056
00057 PreferencesDialog( QWidget* parent, Preferences* prefs );
00058 ~PreferencesDialog();
00059
00060 public slots:
00061
00062 protected slots:
00063
00064 virtual void accept();
00065
00066 protected:
00067
00068 virtual void resizeEvent( QResizeEvent* evt );
00069
00070 private slots:
00071
00072 void resetDefaultLabelsFont();
00073 void resetDefaultFont();
00074 void addFontOverride( const QString& language );
00075 void removeFontOverride( const QString& language );
00076 void clearAccelKey();
00077 void setAccelKey();
00078 void resetAccelKey();
00079 void cancelSetAccelKey();
00080 void keyActionClicked( QListViewItem* );
00081 void addSequence();
00082 void removeSequence();
00083 void updateUi();
00084
00085 private:
00086
00087 void init();
00088 void initFontFamilyValues( QComboBox* comboBox, bool withEmptyEntry = false ) const;
00089 void initFontSizeValues( QComboBox* comboBox, bool withEmptyEntry = false ) const;
00090 void initFontOverrides();
00091 void initSequences();
00092 void initStudyLanguageValues() const;
00093 void selectFontFamily( QComboBox* comboBox, const QString& fontFamily );
00094 void selectFontSize( QComboBox* comboBox, int fontSizeModifier, bool withEmptyEntry = false );
00095 void selectLanguage( QComboBox* comboBox, const QString& langCode );
00096 bool isRevealingSequenceSelectionValid() const;
00097 bool isRevealingSequenceDefined( const QString& seqStr ) const;
00098 bool isStudyLanguageSelectionValid() const;
00099 void keyPressEvent( QKeyEvent *evt );
00100
00101 Preferences* prefs;
00102 LanguageUpdateNotifier* languageUpdateNotifier;
00103
00104 QVBoxLayout* mainLayout;
00105 QTabWidget* tab;
00106
00107 QWidget* languagePage;
00108 QWidget* quizPage;
00109 QWidget* fontPage;
00110 QWidget* interfacePage;
00111
00112 QVBoxLayout* languageLayout;
00113
00114 QVBox* languagesPanel;
00115
00116 QWidget* languagesRightPanel;
00117 QVBoxLayout* languagesRightPanelLayout;
00118
00119 SmartListView* studyLanguagesListView;
00120
00121 QVBoxLayout* quizLayout;
00122
00123 QVGroupBox* quizLengthOptionsPanel;
00124 QHGroupBox* revealingOptionsPanel;
00125
00126 QVBox* sequencesViewPanel;
00127 SmartListView* sequencesView;
00128 QHBox* sequencesViewButtons;
00129 QWidget* sequencesViewButtonsFiller;
00130 QPushButton* addSequenceButton;
00131 QPushButton* removeSequenceButton;
00132
00133 QVGroupBox* sequencesLabelBox;
00134 QLabel* sequencesLabel;
00135
00136 QSlider* quizLengthSlider;
00137 QHBox* quizLengthLabelsPanel;
00138 QLabel* quizLengthShortestLabel;
00139 QLabel* quizLengthMediumLabel;
00140 QLabel* quizLengthLongestLabel;
00141
00142 QVBoxLayout* fontPageLayout;
00143 QVBoxLayout* interfacePageLayout;
00144 QHBoxLayout* keyboardAccelButtonPanelLayout;
00145
00146 QHBox* labelsFontPanel;
00147 QLabel* labelsFontLabel;
00148 QComboBox* labelsFontFamilyComboBox;
00149 QComboBox* labelsFontSizeComboBox;
00150 QPushButton* resetDefaultLabelsFontButton;
00151
00152 QVBox* fontsPanel;
00153
00154 QHBox* fontPanel;
00155 QLabel* fontLabel;
00156 QComboBox* fontFamilyComboBox;
00157 QComboBox* fontSizeComboBox;
00158 QPushButton* resetDefaultFontButton;
00159
00160 QVGroupBox* fontOverridesPanel;
00161 QScrollView* fontOverridesScrollView;
00162 QWidget* fontOverridesBox;
00163 QVBoxLayout* fontOverridesBoxLayout;
00164 QWidget* fontOverridesBoxFiller;
00165
00166 QList<QHBox> fontOverrideBoxes;
00167 QList<QLabel> fontOverrideLabels;
00168 QList<QComboBox> fontOverrideFamilyComboBoxes;
00169 QList<QComboBox> fontOverrideSizeComboBoxes;
00170
00171 QGrid* miscInterfaceOptionsPanel;
00172
00173 QVGroupBox* digraphPanel;
00174 QCheckBox* digraphCheckBox;
00175
00176 QVGroupBox* hideQuizButtonPanel;
00177 QCheckBox* hideQuizButtonCheckBox;
00178
00179 QVGroupBox* showAltTextInTermListPanel;
00180 QCheckBox* showAltTextInTermListCheckBox;
00181
00182 QVGroupBox* keyboardAccelPanel;
00183
00184 QListViewItem* grabAccelKeyFor;
00185 SmartListView* keyboardAccelListView;
00186 bool ignoreReturn;
00187 bool keyboardAccelModified;
00188
00189 QWidget* keyboardAccelButtonPanel;
00190 QWidget* keyboardAccelButtonPanelFiller;
00191 QButton* clearAccelKeyButton;
00192 QButton* setAccelKeyButton;
00193 QButton* resetAccelKeyButton;
00194
00195 QWidget* languagePageFiller;
00196 QWidget* languagesRightPanelFiller;
00197 QWidget* quizPageFiller;
00198 QWidget* fontPageFiller;
00199 QWidget* interfacePageFiller;
00200
00201 };
00202
00203 #endif