summaryrefslogtreecommitdiff
path: root/src/study/SpacedRepetitionWindow.h
blob: 942b7f27e9e938ffcec0de8ecdde64454bb4712b (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
#ifndef SPACED_REPETITION_WINDOW_H
#define SPACED_REPETITION_WINDOW_H

#include <QtCore>
#include <QtWidgets>

#include "IStudyWindow.h"
#include "StudyRecord.h"
#include "StudySettings.h"
#include "SpacedRepetitionModel.h"
#include "CardSideView.h"

class CardsStatusBar;
class NumberFrame;
class WarningPanel;

class SpacedRepetitionWindow: public IStudyWindow
{
    Q_OBJECT
    
public:
    SpacedRepetitionWindow( SpacedRepetitionModel* aModel, QWidget* aParent );
    ~SpacedRepetitionWindow();

protected:
    QVBoxLayout*  createLowerPanel();
    void processState();
    void ReadSettings();
    void WriteSettings();
    QWidget* getAnswerEdit();
    QWidget* getUserAnswerLabel();

private:
    static QString getProgressBarTooltip();

private:
    QBoxLayout* createProgressLayout();
    QBoxLayout* createStatsLayout();
    QBoxLayout* createProgressBarLayout();
    void createGradeButtons();
    QPushButton* createGradeButton(int i, const QString& iconName,
            const QString& label, const QString& toolTip);
    void setEnabledGradeButtons();
    void layoutGradeButtons();
    void putGradeButtonsIntoLayouts(QBoxLayout* higherLt);
    void replaceGradesLayout(QBoxLayout* higherLt);
    void setGoodButtonText();
    void updateCardsProgress();
    void displayAnswer();
    void displayNoRemainedCards();
    void showLimitWarnings();
    bool dayLimitReached(int todayReviewed);
    void createExactAnswerWidget();
    void showExactAnswer(const QStringList& correctAnswers);
    void focusAnswerWidget();
    void processIsNewCard();

private slots:
    void displayQuestion();

private:
    static const int PosX = 200;
    static const int PosY = 200;
    static const int Width = 600;
    static const int Height = 430;
    static const int GradeButtonMinWidth = 100;

private:
    bool dayCardsLimitShown;

    WarningPanel* warningPanel;
    QLabel* progressLabel;
    NumberFrame* todayNewLabel;
    NumberFrame* learningCardsLabel;
    QLabel* timeToNextLearningLabel;
    NumberFrame* scheduledCardsLabel;
    NumberFrame* scheduledNewLabel;
    QVBoxLayout* controlLt;
    CardsStatusBar* coloredProgressBar;
    QPushButton* gradeBtns[StudyRecord::GradesNum];
    QPushButton* goodBtn;
    QSignalMapper* cardGradedSM;
    bool usesExactAnswer;
    CardSideView* exactAnswerLabel;
    QLineEdit* exactAnswerEdit;
    QTime m_answerTime;
};

#endif