-
Notifications
You must be signed in to change notification settings - Fork 0
/
reader.h
72 lines (59 loc) · 1.59 KB
/
reader.h
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
#ifndef READER_H
#define READER_H
#include <QWidget>
#include <QApplication>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QTextEdit>
#include <QProgressBar>
#include <QScreen>
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include <QFont>
#include <QFontMetrics>
#include <QTextFrame>
#include <QTextFrameFormat>
#include <QTextDocumentFragment>
#include "configman.h"
class Reader : public QWidget {
Q_OBJECT
public:
Reader(QWidget* parent = nullptr,
QApplication* app = nullptr,
QString stackPath = "",
ConfigMan* cfgMan = nullptr,
QString cfgDir = "");
void makeUI(QWidget* parent, QApplication* app, QString stackPath);
QString getStackName(QString stackPath);
void readStack(QString stackPath);
void loadFlashcard(int i, bool turnOver );
int getMaximumFontSize(QString text, QWidget* flashcardView);
int getTextHeight(QString text, int ptSize);
void setProgress();
void previous();
void next();
void turnOver();
~Reader();
bool mTurnedOver = false;
ConfigMan* mCfgMan;
QString mCfgDir;
private:
QWidget* mParent;
QJsonObject mStackObj;
int mCurrentIndex = 1;
QTextEdit* mFlashcardView;
QProgressBar* mProgressBar;
QPushButton* mProgressButton;
QPushButton* mBackButton;
QPushButton* mForwardButton;
QPushButton* mTurnOverButton;
QPushButton* mQuickEditButton;
QString mText;
protected:
void resizeEvent(QResizeEvent* event);
void closeEvent(QCloseEvent* event);
};
#endif // READER_H