-
Notifications
You must be signed in to change notification settings - Fork 3
/
mainwindow.h
158 lines (138 loc) · 3.69 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
* Localplot - Main UI thread header
* Christopher Bero <bigbero@gmail.com>
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtCore>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QMainWindow>
#include <QFileDialog>
#include <QGuiApplication>
#include <QScreen>
#include <QGraphicsTextItem>
#include <QPushButton>
#include <QGraphicsItem>
#include <QEvent>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QListView>
#include <QModelIndex>
#include <QModelIndexList>
#include <QStringListModel>
#include <QMainWindow>
#include <QTextBrowser>
#include <QMenuBar>
#include <QStatusBar>
#include <QToolBar>
#include <QProgressBar>
#include <QLabel>
#include <QFrame>
#include <QSplitter>
#include <QGraphicsLineItem>
#include <QToolButton>
#include <QImage>
#include <QBrush>
#include <QPixmap>
#include <QProcess>
#include <QDesktopServices>
#include <QUrl>
#include <qtconcurrentrun.h>
#include <QGraphicsDropShadowEffect>
#include <qmath.h>
#include <unistd.h>
#include "settings.h"
#include "ext/plot.h"
#include "ext/loadfile.h"
#include "ext/eta.h"
#include "hpglgraphicsview.h"
#include "hpgllistmodel.h"
#include "ext/binpack.h"
#include "dialog/dialogprogress.h"
QString timeStamp();
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
static QLineF get_widthLine();
/*
* please_ for signals to threads
*/
signals:
void please_plotter_openSerial();
void please_plotter_closeSerial();
void please_plotter_doPlot(hpglListModel *);
void please_plotter_cancelPlot();
void please_plotter_loadFile(const QPersistentModelIndex, const hpglListModel *);
void please_plotter_procEta(hpglListModel *);
/*
* do_ for ui/proc action
* update_ for settings change
* handle_ for ui update
*/
private slots:
void do_openDialogAbout();
void do_openDialogSettings();
void runFinishedCommand();
// UI
void handle_selectFileBtn();
void handle_deleteFileBtn();
void handle_rotateLeftBtn();
void handle_rotateRightBtn();
void handle_duplicateFileBtn();
void handle_cancelBtn();
void handle_flipXbtn();
void handle_flipYbtn();
void handle_newConsoleText(QString text, QColor textColor);
void handle_newConsoleText(QString text);
void handle_zoomChanged(QString text);
void handle_vinylLengthChanged(int length);
void handle_listViewClick();
void handle_plotSceneSelectionChanged();
void handle_plottingEta(double eta);
void handle_splitterMoved();
// View/Scene
void sceneSetup();
void get_pen(QPen *_pen, QString _name);
void sceneSetSceneRect(QRectF rect = QRectF());
void sceneConstrainItems();
void addPolygon(QPersistentModelIndex index, QPolygonF poly);
void newFileToScene(QPersistentModelIndex _index);
void handle_packedRect(QPersistentModelIndex index, QRectF rect);
void handle_cutoutBoxesToggle(bool checked);
void setGrid();
// plotter thread
void do_plot();
void do_jog();
void do_cancelPlot();
void do_procEta();
void do_binpack();
// URLs
void handle_openSourceCode();
void handle_openBugTracker();
void handle_openWiki();
// imports
void checkImportScripts();
protected:
void closeEvent(QCloseEvent *event);
private:
QFrame * statusBarDivider();
QPersistentModelIndex createHpglFile(file_uid _file);
Ui::MainWindow *ui;
QGraphicsScene plotScene;
hpglListModel * hpglModel;
QGraphicsLineItem * widthLine;
QGraphicsRectItem * vinyl;
// Status bar
QLabel * label_eta;
QLabel * label_status;
QLabel * label_zoom;
QLabel * label_length;
};
#endif // MAINWINDOW_H