-
Notifications
You must be signed in to change notification settings - Fork 32
/
mainwindow.h
94 lines (79 loc) · 2.45 KB
/
mainwindow.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*!
MainWindow - class representing the main window.
All functions that can be called up via the menu or
toolbar, are described here. It includes rendering,
printing, saving, calling other windows, error output, etc.
The Font Editor window is represented by class FontEditor,
the Settings windows - by class PreferencesDialog. Class
SvgView is used to display a sheet with handwritten text
and to place characters on a sheet correctly.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtCore/QTime>
#include <QtCore/QTextStream>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QScrollBar>
#include <QtWidgets/QErrorMessage>
#include <QtWidgets/QLabel>
#include <QtPrintSupport/QPrintDialog>
#include <QtPrintSupport/QPrinter>
#include <QtGui/QWheelEvent>
#include "preferencesdialog.h"
#include "fontdialog.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
private:
const QString version = "1.1.1";
enum ToolButton : int {
Render,
Print,
Save,
Separator,
Previous,
SheetNumber,
Next
};
Ui::MainWindow *ui;
PreferencesDialog *preferencesDialog;
FontDialog *fontDialog;
QErrorMessage *errorMessage;
QLabel *sheetNumberLabel;
QVector<int> sheetPointers; //!< pointers to the first character of the sheets
int currentSheetNumber; //!< number of sheet that is displaying or rendering now
QString text;
void saveAllSheetsToImages(const QString &fileName);
void saveAllSheetsToPDF(const QString &fileName);
void preparePrinter(QPrinter *printer);
QString simplifyEnd(const QString &str); //!< returns string without whitespaces at the end
private slots:
void showAboutBox();
void showLicensesBox();
void showHowToBox();
void renderFirstSheet();
void renderNextSheet();
void renderPreviousSheet();
void updateCurrentSheet();
void loadFont();
void saveSheet(QString fileName = QString());
void saveAllSheets();
void printSheet();
void printAllSheets();
void loadTextFromFile();
void loadSettings();
void countMissedCharacters();
void showSheetNumber(int number);
void on_actionShortcuts_triggered();
};
#endif // MAINWINDOW_H