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