prototype fake/fast tsp to sort stuff - all this needs to go in class
[robocut:robocut-for-portrait.git] / MainWindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3
4 #include <QtGui/QMainWindow>
5
6 #include <QGraphicsScene>
7 #include <QTimer>
8 #include <QGraphicsItem>
9
10 #include "CutDialog.h"
11
12 namespace Ui
13 {
14         class MainWindow;
15 }
16
17 class MainWindow : public QMainWindow
18 {
19         Q_OBJECT
20
21 public:
22         MainWindow(QWidget *parent = 0);
23         ~MainWindow();
24
25 private:
26         Ui::MainWindow *ui;
27
28         // The cutting paths that were loaded from the SVG.
29         QList<QPolygonF> paths;
30
31         // For displaying the cuts.
32         QGraphicsScene* scene;
33
34         // The dialog that asks what settings to use. We keep this around and reuse it as necessary.
35         CutDialog* cutDialog;
36
37         // The directory that the last file was opened from.
38         QString lastOpenDir;
39
40         // Timer for the cutting animation.
41         QTimer* animationTimer;
42         // The circle that marks where the cutter blade is.
43         QGraphicsItem* cutMarker;
44         // Cut marker progress.
45         int cutMarkerPath; // Current path.
46         int cutMarkerLine; // Current line in path
47         double cutMarkerDistance; // Current distance along edge.
48
49         QSizeF mediaSize;
50         
51         QString filename;
52
53 public:
54         int sortFlag;
55         int tspFlag;
56         int cutFlag;
57         char *fileValue;
58
59 private slots:
60         void on_actionZoom_Out_triggered();
61         void on_actionZoom_In_triggered();
62         void on_actionReset_triggered();
63         void on_actionAnimate_toggled(bool animate);
64         void on_actionManual_triggered();
65         void on_actionCut_triggered();
66         void on_actionExit_triggered();
67         void on_actionAbout_triggered();
68         void on_actionOpen_triggered();
69
70         // Advance the cutting animation frame.
71         void animate();
72
73 private:
74         // Use empty string to indicate no file is loaded.
75         void setFileLoaded(QString filename);
76         bool eventFilter(QObject *o, QEvent *e);
77         void loadFile();
78 public:
79         void optDone();
80 };
81
82 #endif // MAINWINDOW_H