-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.h
102 lines (83 loc) · 2.4 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
95
96
97
98
99
100
101
#pragma once
#include <QMainWindow>
#include <QFileDialog>
#include <QStatusBar>
#include <QToolBar>
#include <QAction>
#include <QScrollArea>
#include <QDockWidget>
#include <QLabel>
#include <QStack>
#include <QPainterPath>
class QtAwesome;
class RsView;
class ColorsWidget;
class MarkerWidget;
class AccentPainter;
class CvModelBuilder;
class CvModel;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
private slots:
void slotActionCapture();
void slotActionPaste();
void slotActionOpen();
void slotActionCopy();
void slotActionSave();
void slotActionCrop();
void slotActionHelp();
void slotSelectionChanged();
void slotSelectionFinished();
void slotMouseMove(const QPoint& pos);
void slotMarkerUndo();
void slotMarkerChanged();
void slotBuildCompleted(QSharedPointer<CvModel> model);
protected:
bool eventFilter(QObject *obj, QEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void closeEvent(QCloseEvent *event);
private:
enum State {
EmptyState,
CropState,
ColorState,
MarkerState
};
bool saveImage(const QString &fileName);
bool openImage(const QString &fileName);
void initializeImageFileDialog(QFileDialog &dialog, QFileDialog::AcceptMode acceptMode);
void delay(int millisecondsToWait);
void updateImage(const QImage& image);
void updateImage(const QRect& selection);
void handleDockWidgetVisibityChange(QDockWidget* dockWidget);
QSharedPointer<AccentPainter> createDefaultAccentPainter();
QSharedPointer<AccentPainter> createMarkerAccentPainter();
void setupUi();
void setupDockWidget(QDockWidget* dockWidget, QIcon icon, QWidget* contentWidget);
void changeState(State state);
QImage _currentImage;
CvModelBuilder* _modelBuilder;
QSharedPointer<CvModel> _model;
State _state;
QStack<QPainterPath> _markers;
QtAwesome* _awesome;
RsView* _rsview;
MarkerWidget* _markerWidget;
ColorsWidget* _colorsWidget;
QDockWidget* _markerDock;
QDockWidget* _colorsDock;
QLabel* _sizeWidget;
QScrollArea* _scrollArea;
QToolBar* _toolbar;
QStatusBar* _statusbar;
QAction* _actionCapture;
QAction* _actionPaste;
QAction* _actionCopy;
QAction* _actionSave;
QAction* _actionCrop;
QAction* _actionHelp;
};