File indexing completed on 2024-03-24 03:44:35
0001 /*************************************************************************** 0002 * Copyright (C) 2004-2007 by Albert Astals Cid * 0003 * aacid@kde.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #ifndef ASKWIDGET_H 0012 #define ASKWIDGET_H 0013 0014 #include <QTimer> 0015 #include <QVector> 0016 #include <QWidget> 0017 0018 #include "answer.h" 0019 #include "division.h" 0020 0021 class QLabel; 0022 0023 class KGmap; 0024 0025 class askWidget : public QWidget 0026 { 0027 Q_OBJECT 0028 public: 0029 askWidget(QWidget *parent, KGmap *m, QWidget *w, uint count, bool showLabel = true); 0030 virtual ~askWidget(); 0031 0032 virtual QString getQuestionHook() const = 0; 0033 int correctAnswers() const; 0034 QVector<userAnswer> userAnswers() const; 0035 0036 public Q_SLOTS: 0037 virtual void setMovement(bool b); 0038 virtual void setZoom(bool b); 0039 virtual void setOriginalZoom(); 0040 virtual void setAutomaticZoom(bool b); 0041 0042 Q_SIGNALS: 0043 void setMoveActionChecked(bool b); 0044 void setAutomaticZoomActionChecked(bool b); 0045 void setZoomActionChecked(bool b); 0046 void setMoveActionEnabled(bool b); 0047 void questionsEnded(); 0048 0049 protected: 0050 void clearAsked(); 0051 QString lastDivisionAsked(); 0052 void nextQuestion(); 0053 virtual void nextQuestionHook(const division *div) = 0; 0054 virtual division::askMode askMode() const = 0; 0055 void questionAnswered(bool wasCorrect); 0056 void resetAnswers(); 0057 0058 KGmap *p_map; 0059 userAnswer p_currentAnswer; 0060 QLabel *p_answers; 0061 0062 private Q_SLOTS: 0063 void resetLabelColor(); 0064 private: 0065 void updateLabel(); 0066 0067 int p_correctAnswers, p_incorrectAnswers; 0068 0069 QVector<userAnswer> p_userAnswers; 0070 0071 // the list of asked divisions 0072 QStringList p_asked; 0073 0074 // the number of questions to do 0075 int p_count; 0076 0077 QTimer m_timer; 0078 }; 0079 0080 #endif