]> git.sur5r.net Git - fstl/blob - src/window.h
New upstream version 0.9.3
[fstl] / src / window.h
1 #ifndef WINDOW_H
2 #define WINDOW_H
3
4 #include <QMainWindow>
5 #include <QActionGroup>
6 #include <QFileSystemWatcher>
7
8 class Canvas;
9
10 class Window : public QMainWindow
11 {
12     Q_OBJECT
13 public:
14     explicit Window(QWidget* parent=0);
15     bool load_stl(const QString& filename, bool is_reload=false);
16
17 protected:
18     void dragEnterEvent(QDragEnterEvent* event);
19     void dropEvent(QDropEvent* event);
20
21 public slots:
22     void on_open();
23     void on_about();
24     void on_bad_stl();
25     void on_empty_mesh();
26     void on_missing_file();
27     void on_confusing_stl();
28
29     void enable_open();
30     void disable_open();
31
32     void set_watched(const QString& filename);
33
34 private slots:
35     void on_projection(QAction* proj);
36     void on_watched_change(const QString& filename);
37     void on_reload();
38     void on_autoreload_triggered(bool r);
39     void on_clear_recent();
40     void on_load_recent(QAction* a);
41
42 private:
43     void rebuild_recent_files();
44
45     QAction* const open_action;
46     QAction* const about_action;
47     QAction* const quit_action;
48     QAction* const perspective_action;
49     QAction* const orthogonal_action;
50     QAction* const reload_action;
51     QAction* const autoreload_action;
52
53     QMenu* const recent_files;
54     QActionGroup* const recent_files_group;
55     QAction* const recent_files_clear_action;
56     const static int MAX_RECENT_FILES=8;
57     const static QString RECENT_FILE_KEY;
58
59     QFileSystemWatcher* watcher;
60
61     Canvas* canvas;
62 };
63
64 #endif // WINDOW_H