2 * Declarations for Qt4 based control panel
4 #ifndef _CONTROLPANEL_H
5 #define _CONTROLPANEL_H
7 //#define CONTROLPANEL_DISABLED // To turn off the control panel
9 #ifndef CONTROLPANEL_DISABLED
12 #include <QPushButton>
13 #include <QMainWindow>
18 #include <QApplication>
20 #include <QInputDialog>
21 #include <QFileDialog>
31 * Class to manage Qt control panel
32 * Should be a singleton from the point of view of View, Document, Screen
33 * - Just call "Update"
35 class ControlPanel : public QMainWindow
37 Q_OBJECT // Having this causes shit about undefined vtables
38 // Not having it means things break
39 // Apparently you need "qmake" to build qt applications
40 // Or some bullshit -_-
51 static int Run(void * args);
52 static void Update() {if (g_panel != NULL) g_panel->UpdateAll();}
62 void SetGPURendering();
63 void SetCPURendering();
64 void ToggleShowBezierBounds();
65 void ToggleShowBezierType();
66 void ToggleShowFillBounds();
67 void ToggleShowFillPoints();
68 void ToggleScreenDebugFont();
69 void ToggleEnableShading();
71 void LoadSVGIntoDocument();
72 void SetDocumentFont();
73 void StateInsertText() {ChangeState(INSERT_TEXT);}
74 void StateAbout() {ChangeState(ABOUT);}
75 void StateParseSVG() {ChangeState(PARSE_SVG);}
76 void PressOK() {if (m_on_ok != NULL) (this->*m_on_ok)();}
79 static ControlPanel * g_panel;
80 void paintEvent(QPaintEvent * e);
81 ControlPanel(RunArgs & a, QWidget * p = NULL);
82 virtual ~ControlPanel() {}
84 void ChangeState(State next_state);
95 QMenu * CreateMainMenu();
96 QMenu * CreateViewMenu();
97 QMenu * CreateDocumentMenu();
98 QMenu * CreateScreenMenu();
101 void InsertTextIntoDocument();
102 void InsertSVGIntoDocument();
104 QAction * m_screen_gpu_rendering;
105 QAction * m_screen_cpu_rendering;
106 QAction * m_screen_show_debug;
108 QAction * m_document_set_font;
109 QAction * m_document_insert_text;
110 QAction * m_document_parse_svg;
111 QAction * m_document_load_svg;
112 QAction * m_view_set_bounds;
113 QAction * m_view_show_bezier_bounds;
114 QAction * m_view_show_bezier_type;
115 QAction * m_view_show_fill_bounds;
116 QAction * m_view_show_fill_points;
117 QAction * m_view_enable_shading;
121 QTextEdit * m_text_edit;
122 QPushButton * m_ok_button;
124 void (ControlPanel::* m_on_ok)();
131 #endif //CONTROLPANEL_DISABLED
133 #endif //_CONTROLPANEL_H