Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/qt_gui/src/lib/gui/qt_gui/qt_gui.cc @ 7600

Last change on this file since 7600 was 7600, checked in by bensch, 18 years ago

save does not work yet

File size: 2.4 KB
Line 
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#include "banner.xpm"
29#include <QtGui/QPainter>
30#include "q_image_widget.h"
31
32namespace OrxGui
33{
34  QtGui::QtGui(int argc, char** argv)
35  : QApplication(argc, argv)
36  {
37
38    this->mainWindow = new QMainWindow();
39    this->mainWindow->setMinimumSize(500, 200);
40
41    QGroupBox* groupBox = new QGroupBox(this->mainWindow);
42    QGridLayout* mainLayout = new QGridLayout(groupBox);
43    {
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
51      QToolBox* toolBox = new QToolBox(groupBox);
52      {
53
54        toolBox->addItem(new GuiVideo(this), "Video");
55        toolBox->addItem(new GuiAudio(this), "Audio");
56        toolBox->addItem(new GuiGeneral(this), "General");
57      }
58      mainLayout->addWidget(toolBox,1,1, 1, 3);
59
60
61      QPushButton* start = new QPushButton("start");
62      connect(start, SIGNAL(released()), this, SLOT(startApp()));
63      mainLayout->addWidget(start, 2,2);
64
65      QPushButton* quit = new QPushButton("quit");
66      connect(quit, SIGNAL(released()), this, SLOT(quitApp()));
67      mainLayout->addWidget(quit, 2,3);
68
69    }
70
71    connect(this->mainWindow, SIGNAL(destroyed()), this, SLOT(quitApp()));
72    this->mainWindow->setCentralWidget(groupBox);
73    this->mainWindow->show();
74
75    this->loadAll();
76    this->exec();
77  }
78
79  QtGui::~QtGui()
80  {
81    this->saveAll();
82
83    delete this->mainWindow;
84  }
85
86  void QtGui::startGui()
87  {
88  }
89
90  void QtGui::stopGui()
91  {}
92
93  void QtGui::suspend()
94  {}
95
96    //! Update the Gui.
97  void QtGui::update()
98  {
99    this->processEvents();
100  }
101
102
103  void QtGui::quitApp()
104  {
105    Gui::quitEvent();
106    this->quit();
107  }
108
109  void QtGui::startApp()
110  {
111    Gui::startEvent();
112    this->quit();
113  }
114
115}
Note: See TracBrowser for help on using the repository browser.