[4744] | 1 | /* |
---|
[1853] | 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. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[7149] | 12 | main-programmer: Benjamin Grauer |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[3955] | 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
[1853] | 17 | |
---|
[7140] | 18 | #include "qt_gui.h" |
---|
[1853] | 19 | |
---|
[7534] | 20 | #include <QtGui/QApplication> |
---|
| 21 | #include <QtGui/QToolBox> |
---|
| 22 | #include <QtGui/QGridLayout> |
---|
[7478] | 23 | |
---|
[7542] | 24 | #include "qt_gui_elements.h" |
---|
[7636] | 25 | #include "q_image_widget.h" |
---|
| 26 | |
---|
[7855] | 27 | #include "gui_general.h" |
---|
[7484] | 28 | #include "gui_video.h" |
---|
[7495] | 29 | #include "gui_audio.h" |
---|
[7636] | 30 | #include "gui_control.h" |
---|
| 31 | |
---|
[7594] | 32 | #include "banner.xpm" |
---|
[7484] | 33 | |
---|
[7447] | 34 | namespace OrxGui |
---|
| 35 | { |
---|
[7478] | 36 | QtGui::QtGui(int argc, char** argv) |
---|
| 37 | : QApplication(argc, argv) |
---|
[7473] | 38 | { |
---|
[1853] | 39 | |
---|
[7479] | 40 | this->mainWindow = new QMainWindow(); |
---|
[7594] | 41 | this->mainWindow->setMinimumSize(500, 200); |
---|
[7480] | 42 | |
---|
[7493] | 43 | QGroupBox* groupBox = new QGroupBox(this->mainWindow); |
---|
[7480] | 44 | QGridLayout* mainLayout = new QGridLayout(groupBox); |
---|
[7484] | 45 | { |
---|
[7594] | 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 | |
---|
[7493] | 53 | QToolBox* toolBox = new QToolBox(groupBox); |
---|
[7484] | 54 | { |
---|
[7855] | 55 | toolBox->addItem(new GuiGeneral(this), "General"); |
---|
[7549] | 56 | toolBox->addItem(new GuiVideo(this), "Video"); |
---|
| 57 | toolBox->addItem(new GuiAudio(this), "Audio"); |
---|
[7636] | 58 | toolBox->addItem(new GuiControl(this), "Control"); |
---|
[7484] | 59 | } |
---|
[7542] | 60 | mainLayout->addWidget(toolBox,1,1, 1, 3); |
---|
| 61 | |
---|
| 62 | |
---|
[7548] | 63 | QPushButton* start = new QPushButton("start"); |
---|
| 64 | connect(start, SIGNAL(released()), this, SLOT(startApp())); |
---|
| 65 | mainLayout->addWidget(start, 2,2); |
---|
| 66 | |
---|
[7542] | 67 | QPushButton* quit = new QPushButton("quit"); |
---|
[7548] | 68 | connect(quit, SIGNAL(released()), this, SLOT(quitApp())); |
---|
| 69 | mainLayout->addWidget(quit, 2,3); |
---|
[7542] | 70 | |
---|
[7484] | 71 | } |
---|
[7480] | 72 | |
---|
[7555] | 73 | connect(this->mainWindow, SIGNAL(destroyed()), this, SLOT(quitApp())); |
---|
[7480] | 74 | this->mainWindow->setCentralWidget(groupBox); |
---|
[7479] | 75 | this->mainWindow->show(); |
---|
[7447] | 76 | |
---|
[7598] | 77 | this->loadAll(); |
---|
[7479] | 78 | this->exec(); |
---|
[7604] | 79 | this->saveAll(); |
---|
| 80 | |
---|
[7473] | 81 | } |
---|
[7478] | 82 | |
---|
[7473] | 83 | QtGui::~QtGui() |
---|
| 84 | { |
---|
[7480] | 85 | delete this->mainWindow; |
---|
[7473] | 86 | } |
---|
| 87 | |
---|
| 88 | void QtGui::startGui() |
---|
[7598] | 89 | { |
---|
| 90 | } |
---|
[7473] | 91 | |
---|
| 92 | void QtGui::stopGui() |
---|
| 93 | {} |
---|
| 94 | |
---|
| 95 | void QtGui::suspend() |
---|
| 96 | {} |
---|
| 97 | |
---|
| 98 | //! Update the Gui. |
---|
| 99 | void QtGui::update() |
---|
[7478] | 100 | { |
---|
| 101 | this->processEvents(); |
---|
| 102 | } |
---|
[7473] | 103 | |
---|
[7548] | 104 | |
---|
| 105 | void QtGui::quitApp() |
---|
| 106 | { |
---|
| 107 | Gui::quitEvent(); |
---|
| 108 | this->quit(); |
---|
| 109 | } |
---|
[7549] | 110 | |
---|
[7548] | 111 | void QtGui::startApp() |
---|
| 112 | { |
---|
| 113 | Gui::startEvent(); |
---|
| 114 | this->quit(); |
---|
| 115 | } |
---|
| 116 | |
---|
[7447] | 117 | } |
---|