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 ToggleScreenDebugFont();
66 void LoadSVGIntoDocument();
67 void SetDocumentFont();
68 void StateInsertText() {ChangeState(INSERT_TEXT);}
69 void StateAbout() {ChangeState(ABOUT);}
70 void StateParseSVG() {ChangeState(PARSE_SVG);}
71 void PressOK() {if (m_on_ok != NULL) (this->*m_on_ok)();}
74 static ControlPanel * g_panel;
75 void paintEvent(QPaintEvent * e);
76 ControlPanel(RunArgs & a, QWidget * p = NULL);
77 virtual ~ControlPanel() {}
79 void ChangeState(State next_state);
90 QMenu * CreateMainMenu();
91 QMenu * CreateViewMenu();
92 QMenu * CreateDocumentMenu();
93 QMenu * CreateScreenMenu();
96 void InsertTextIntoDocument();
97 void InsertSVGIntoDocument();
99 QAction * m_screen_gpu_rendering;
100 QAction * m_screen_cpu_rendering;
101 QAction * m_screen_show_debug;
103 QAction * m_document_set_font;
104 QAction * m_document_insert_text;
105 QAction * m_document_parse_svg;
106 QAction * m_document_load_svg;
107 QAction * m_view_set_bounds;
110 QTextEdit * m_text_edit;
111 QPushButton * m_ok_button;
113 void (ControlPanel::* m_on_ok)();
120 #endif //CONTROLPANEL_DISABLED
122 #endif //_CONTROLPANEL_H