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 "q_image_widget.h" |
---|
26 | |
---|
27 | #include "gui_video.h" |
---|
28 | #include "gui_audio.h" |
---|
29 | #include "gui_control.h" |
---|
30 | #include "gui_general.h" |
---|
31 | |
---|
32 | #include "banner.xpm" |
---|
33 | |
---|
34 | namespace OrxGui |
---|
35 | { |
---|
36 | QtGui::QtGui(int argc, char** argv) |
---|
37 | : QApplication(argc, argv) |
---|
38 | { |
---|
39 | |
---|
40 | this->mainWindow = new QMainWindow(); |
---|
41 | this->mainWindow->setMinimumSize(500, 200); |
---|
42 | |
---|
43 | QGroupBox* groupBox = new QGroupBox(this->mainWindow); |
---|
44 | QGridLayout* mainLayout = new QGridLayout(groupBox); |
---|
45 | { |
---|
46 | QImageWidget* bannerWidget = new QImageWidget(); |
---|
47 | QImage bannerImage(banner_xpm); |
---|
48 | bannerImage.save("test.bmp", "bmp"); |
---|
49 | bannerWidget->setImage(bannerImage); |
---|
50 | mainLayout->addWidget(bannerWidget, 0,0, 3, 1); |
---|
51 | |
---|
52 | |
---|
53 | QToolBox* toolBox = new QToolBox(groupBox); |
---|
54 | { |
---|
55 | |
---|
56 | toolBox->addItem(new GuiVideo(this), "Video"); |
---|
57 | toolBox->addItem(new GuiAudio(this), "Audio"); |
---|
58 | toolBox->addItem(new GuiControl(this), "Control"); |
---|
59 | toolBox->addItem(new GuiGeneral(this), "General"); |
---|
60 | } |
---|
61 | mainLayout->addWidget(toolBox,1,1, 1, 3); |
---|
62 | |
---|
63 | |
---|
64 | QPushButton* start = new QPushButton("start"); |
---|
65 | connect(start, SIGNAL(released()), this, SLOT(startApp())); |
---|
66 | mainLayout->addWidget(start, 2,2); |
---|
67 | |
---|
68 | QPushButton* quit = new QPushButton("quit"); |
---|
69 | connect(quit, SIGNAL(released()), this, SLOT(quitApp())); |
---|
70 | mainLayout->addWidget(quit, 2,3); |
---|
71 | |
---|
72 | } |
---|
73 | |
---|
74 | connect(this->mainWindow, SIGNAL(destroyed()), this, SLOT(quitApp())); |
---|
75 | this->mainWindow->setCentralWidget(groupBox); |
---|
76 | this->mainWindow->show(); |
---|
77 | |
---|
78 | this->loadAll(); |
---|
79 | this->exec(); |
---|
80 | this->saveAll(); |
---|
81 | |
---|
82 | } |
---|
83 | |
---|
84 | QtGui::~QtGui() |
---|
85 | { |
---|
86 | delete this->mainWindow; |
---|
87 | } |
---|
88 | |
---|
89 | void QtGui::startGui() |
---|
90 | { |
---|
91 | } |
---|
92 | |
---|
93 | void QtGui::stopGui() |
---|
94 | {} |
---|
95 | |
---|
96 | void QtGui::suspend() |
---|
97 | {} |
---|
98 | |
---|
99 | //! Update the Gui. |
---|
100 | void QtGui::update() |
---|
101 | { |
---|
102 | this->processEvents(); |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | void QtGui::quitApp() |
---|
107 | { |
---|
108 | Gui::quitEvent(); |
---|
109 | this->quit(); |
---|
110 | } |
---|
111 | |
---|
112 | void QtGui::startApp() |
---|
113 | { |
---|
114 | Gui::startEvent(); |
---|
115 | this->quit(); |
---|
116 | } |
---|
117 | |
---|
118 | } |
---|