-
Notifications
You must be signed in to change notification settings - Fork 9
/
imageviewer.h
92 lines (74 loc) · 2.1 KB
/
imageviewer.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
#ifndef IMAGEVIEWER_H
#define IMAGEVIEWER_H
#include <QMainWindow>
#include <qlabel>
#include <qscrollarea>
#include <QFileDialog>
#include <QDir>
#include <QMessageBox>
#include <QDebug>
#include <QScrollBar>
#include <QMouseEvent>
#include <QStatusBar>
#include <QVector>
namespace Ui {
class ImageViewer;
}
class ImageViewer : public QMainWindow
{
Q_OBJECT
public:
explicit ImageViewer(QWidget *parent = 0);
~ImageViewer();
private slots:
bool eventFilter(QObject* watched, QEvent* event);
void on_actionCrop_triggered();
void on_actionFullscreen_triggered();
void on_actionPaintBlack_triggered();
void on_actionOpen_triggered();
void on_actionRotateLeft_triggered();
void on_actionRotateRight_triggered();
void on_actionSave_triggered();
void on_actionShowToolbar_triggered(bool checked);
void on_actionUndo_triggered();
void on_actionRedo_triggered();
void on_actionZoomIn_triggered();
void on_actionZoomOut_triggered();
void on_actionZoomToFit_triggered();
private:
Ui::ImageViewer *ui;
QPoint croppingStart;
QPoint croppingEnd;
QLabel *imageLabel;
QScrollArea *scrollArea;
QString fileName;
QImage image;
QStatusBar *statusBar;
QToolBar *mainToolBar;
QVector<QImage> history;
QVector<QImage> reverseHistory;
QAction *actionCrop;
QAction *actionOpen;
QAction *actionPaintBlack;
QAction *actionRotateLeft;
QAction *actionRotateRight;
QAction *actionSave;
QAction *actionShowToolbar;
QAction *actionUndo;
QAction *actionRedo;
QAction *actionZoomIn;
QAction *actionZoomOut;
QAction *actionZoomToFit;
double scaleFactor;
bool croppingState;
void adjustScrollBar(QScrollBar *scrollBar, double factor);
void changeCroppingState(bool changeTo);
void refreshLabel();
void rotateImage(int angle);
void saveToHistory(QImage imageToSave);
void saveToHistoryWithClear(QImage imageToSave);
void saveToReverseHistory(QImage imageToSave);
void scaleImage(double factor);
void updateActions(bool updateTo);
};
#endif // IMAGEVIEWER_H