1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Benjamin Grauer |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
17 | |
---|
18 | #include "qt_gui.h" |
---|
19 | |
---|
20 | #include <QtGui/QApplication> |
---|
21 | #include <QtGui/QToolBox> |
---|
22 | #include <QtGui/QGridLayout> |
---|
23 | |
---|
24 | #include "qt_gui_elements.h" |
---|
25 | #include "gui_video.h" |
---|
26 | #include "gui_audio.h" |
---|
27 | #include "gui_general.h" |
---|
28 | |
---|
29 | namespace OrxGui |
---|
30 | { |
---|
31 | QtGui::QtGui(int argc, char** argv) |
---|
32 | : QApplication(argc, argv) |
---|
33 | { |
---|
34 | |
---|
35 | this->mainWindow = new QMainWindow(); |
---|
36 | |
---|
37 | |
---|
38 | QGroupBox* groupBox = new QGroupBox(this->mainWindow); |
---|
39 | QGridLayout* mainLayout = new QGridLayout(groupBox); |
---|
40 | { |
---|
41 | QToolBox* toolBox = new QToolBox(groupBox); |
---|
42 | { |
---|
43 | |
---|
44 | toolBox->addItem(new GuiVideo(this), "Video"); |
---|
45 | toolBox->addItem(new GuiAudio(this), "Audio"); |
---|
46 | toolBox->addItem(new GuiGeneral(this), "General"); |
---|
47 | } |
---|
48 | mainLayout->addWidget(toolBox,1,1, 1, 3); |
---|
49 | |
---|
50 | |
---|
51 | QPushButton* start = new QPushButton("start"); |
---|
52 | connect(start, SIGNAL(released()), this, SLOT(startApp())); |
---|
53 | mainLayout->addWidget(start, 2,2); |
---|
54 | |
---|
55 | QPushButton* quit = new QPushButton("quit"); |
---|
56 | connect(quit, SIGNAL(released()), this, SLOT(quitApp())); |
---|
57 | mainLayout->addWidget(quit, 2,3); |
---|
58 | |
---|
59 | } |
---|
60 | |
---|
61 | connect(this->mainWindow, SIGNAL(destroyed()), this, SLOT(quitApp())); |
---|
62 | this->mainWindow->setCentralWidget(groupBox); |
---|
63 | this->mainWindow->show(); |
---|
64 | |
---|
65 | this->exec(); |
---|
66 | } |
---|
67 | |
---|
68 | QtGui::~QtGui() |
---|
69 | { |
---|
70 | delete this->mainWindow; |
---|
71 | } |
---|
72 | |
---|
73 | void QtGui::startGui() |
---|
74 | {} |
---|
75 | |
---|
76 | void QtGui::stopGui() |
---|
77 | {} |
---|
78 | |
---|
79 | void QtGui::suspend() |
---|
80 | {} |
---|
81 | |
---|
82 | //! Update the Gui. |
---|
83 | void QtGui::update() |
---|
84 | { |
---|
85 | this->processEvents(); |
---|
86 | } |
---|
87 | |
---|
88 | |
---|
89 | void QtGui::quitApp() |
---|
90 | { |
---|
91 | Gui::quitEvent(); |
---|
92 | this->quit(); |
---|
93 | } |
---|
94 | |
---|
95 | void QtGui::startApp() |
---|
96 | { |
---|
97 | Gui::startEvent(); |
---|
98 | this->quit(); |
---|
99 | } |
---|
100 | |
---|
101 | } |
---|