kanagram
kanagram.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #ifndef KANAGRAM_H
00028 #define KANAGRAM_H
00029
00030 #include <QMouseEvent>
00031 #include <QPaintEvent>
00032
00033 #include <KMainWindow>
00034 #include <KRandomSequence>
00035
00036 using namespace std;
00037
00038 namespace Phonon
00039 {
00040 class MediaObject;
00041 }
00042
00043 class KanagramGame;
00044 class VocabSettings;
00045
00046 class QSvgRenderer;
00047
00048 class KAction;
00049 class KActionCollection;
00050 class KConfigDialog;
00051 class KHelpMenu;
00052 class KLineEdit;
00053 class KShortcutsEditor;
00054
00059 class Kanagram : public KMainWindow
00060 {
00061 Q_OBJECT
00062 public:
00064 Kanagram();
00065
00067 ~Kanagram();
00068
00070 virtual QSize sizeHint() const;
00071
00072 private slots:
00073
00075 void checkWord();
00076
00078 void reloadSettings();
00079
00081 void hideHint();
00082
00084 void resetInputBox();
00085
00089 void refreshVocabularies();
00090
00092 void slotShowSettings();
00093
00099 void slotFileError(const QString &filename);
00100
00102 void slotChooseVocabulary();
00103
00105 void slotNextAnagram();
00106
00108 void slotRevealWord();
00109
00111 void slotNextVocabulary();
00112
00114 void slotPrevVocabulary();
00115
00117 void slotToggleHint();
00118
00120 void slotSaveSettings();
00121
00123 void slotSettingsCancelled();
00124
00126 void slotEnableApplyButton();
00127
00128 private:
00129
00135 void loadSettings();
00136
00138 void setupActions();
00139
00152 void drawTextNew(QPainter &p, const QString &text, int textAlign, int xMargin,
00153 int yMargin, const QRect &rect, bool highlight, int fontSize = 18);
00154
00158 void play(const QString &filename);
00159
00163 void paintEvent(QPaintEvent *);
00164
00168 void resizeEvent(QResizeEvent *);
00169
00174 void mousePressEvent(QMouseEvent *e);
00175
00180 void mouseMoveEvent(QMouseEvent *e);
00181
00186 void randomHintImage();
00187
00192 void drawHelpText(QPainter &p, const QString &text);
00193
00199 void drawSwitcher(QPainter &p, const int xMargin, const int yMargin);
00200
00206 QRect innerRect(const QRect &rect, const int xMargin, const int yMargin);
00207
00209 void CheckRect(const QRect &rect, const QPoint &p, bool &flag, bool &changed);
00210
00212 void FixFontSize(int &fontSize);
00213
00217 QString stripAccents(const QString & original);
00218
00224 KanagramGame *m_game;
00225
00230 QString m_hintOverlayName;
00231
00236 QString m_arrowName;
00237
00239 QRect m_nextRect;
00240 QRect m_configRect;
00241 QRect m_helpRect;
00242 QRect m_quitRect;
00243 QRect m_revealRect;
00244 QRect m_hintRect;
00245 QRect m_upRect;
00246 QRect m_aboutKDERect;
00247 QRect m_aboutAppRect;
00248 QRect m_handbookRect;
00249 QRect m_switcherRect;
00250 QRect m_arrowRect;
00251 QRect m_logoRect;
00252 QRect m_hintBoxRect;
00253 QRect m_blackboardRect;
00254
00256 bool m_overNext;
00257 bool m_overConfig;
00258 bool m_overHelp;
00259 bool m_overQuit;
00260 bool m_overReveal;
00261 bool m_overHint;
00262 bool m_overUp;
00263 bool m_overAboutKDE;
00264 bool m_overAboutApp;
00265 bool m_overHandbook;
00266 bool m_overSwitcher;
00267 bool m_overLogo;
00268 bool m_overHintBox;
00269
00270 bool m_showHint;
00271
00273 QColor m_fillColor;
00274 QColor m_fontColor;
00275 QColor m_fontHighlightColor;
00276 QColor m_chalkColor;
00277 QColor m_chalkHighlightColor;
00278
00280 int m_hintHideTime;
00281 bool m_useSounds;
00282
00284 KHelpMenu *m_helpMenu;
00285
00287 KLineEdit *m_inputBox;
00288
00290 KConfigDialog *m_configDialog;
00291
00293 VocabSettings *m_vocabSettings;
00294 KShortcutsEditor *m_shortcutsEditor;
00295
00300 KRandomSequence m_randomImage;
00301
00303 QTimer *m_hintTimer;
00304
00306 Phonon::MediaObject *m_player;
00307
00309 QSvgRenderer * m_renderer;
00310
00314 int m_cornerFontSize;
00315
00320 double m_xRatio;
00321 double m_yRatio;
00322
00323 KActionCollection * m_actionCollection;
00324 };
00325
00326 #endif
00327