-
Notifications
You must be signed in to change notification settings - Fork 28
/
MainWindow.h
100 lines (81 loc) · 3.15 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
/***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt <tdhutt@gmail.com> *
* Copyright (C) 2010 Markus Schulz <schulz@alpharesearch.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
#include <QMainWindow>
#include <QGraphicsScene>
#include <QTimer>
#include <QGraphicsItem>
#include "CutDialog.h"
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
// The cutting paths that were loaded from the SVG.
QList<QPolygonF> paths;
// For displaying the cuts.
QGraphicsScene* scene;
// The dialog that asks what settings to use. We keep this around and reuse it as necessary.
CutDialog* cutDialog;
// The directory that the last file was opened from.
QString lastOpenDir;
// Timer for the cutting animation.
QTimer* animationTimer;
// The circle that marks where the cutter blade is.
QGraphicsItem* cutMarker;
// Cut marker progress.
int cutMarkerPath; // Current path.
int cutMarkerLine; // Current line in path
double cutMarkerDistance; // Current distance along edge.
QSizeF mediaSize;
QString filename;
public:
int sortFlag;
int tspFlag;
int cutFlag;
char *fileValue;
private slots:
void on_actionZoom_Out_triggered();
void on_actionZoom_In_triggered();
void on_actionReset_triggered();
void on_actionAnimate_toggled(bool animate);
void on_actionManual_triggered();
void on_actionCut_triggered();
void on_actionExit_triggered();
void on_actionAbout_triggered();
void on_actionOpen_triggered();
void on_actionReload_triggered();
void on_actionIdentify_triggered();
// Advance the cutting animation frame.
void animate();
private:
// Use empty string to indicate no file is loaded.
void setFileLoaded(QString filename);
bool eventFilter(QObject *o, QEvent *e);
void loadFile();
};