Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/gui/gui/gui.cc @ 4132

Last change on this file since 4132 was 4132, checked in by bensch, 19 years ago

orxonox/trunk: orxonox —help now shows something more usefull… still cleaning up the GUI

File size: 3.5 KB
RevLine 
[2581]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   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software Foundation,
18   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
19
20
21   ### File Specific:
22   main-programmer: Benjamin Grauer
23
24*/
[3166]25
[3423]26#include <unistd.h>
27
[4047]28#include "gui_gtk.h"
29#include "gui.h"
30#include "gui_video.h"
31#include "gui_audio.h"
32#include "gui_exec.h"
33#include "gui_flags.h"
34#include "gui_banner.h"
35#include "gui_keys.h"
36#include "gui_update.h"
[2018]37
[4046]38// GUI-modules
[4058]39GuiFlags* flags   = NULL;
40GuiVideo* video   = NULL;
41GuiAudio* audio   = NULL;
42GuiExec* exec     = NULL;
[4056]43GuiBanner* banner = NULL;
[4058]44GuiKeys* keys     = NULL;
[4056]45GuiUpdate* update = NULL;
[2018]46
47/* ORXONOXGUI */
48
[2588]49/**
[2623]50   \brief Initializes the Gui
[2588]51*/
[4056]52Gui::Gui(int argc, char *argv[])
[2018]53{
[4046]54  Window* orxonoxGUI = NULL;
[4132]55  executable = NULL;
56 
[3423]57  initGUI(argc, argv);
58
[4058]59  orxonoxGUI = new Window( "grafical " PACKAGE_NAME " loader, "PACKAGE_VERSION);
[4046]60  {
61    Box* windowBox = new Box ('h');
62    {
[4056]63      banner = new GuiBanner();
[4046]64      windowBox->fill (banner->getWidget());
[2018]65     
[4046]66      Box* optionBoxL = new Box('v');
67      {
68        Box* avBox = new Box('h');
69       
[4056]70        video = new GuiVideo();
[4046]71        avBox->fill(video->getWidget());
[4056]72        audio = new GuiAudio();
[4046]73        avBox->fill(audio->getWidget());
74     
75        optionBoxL->fill(avBox);
[2613]76
[4056]77        keys = new GuiKeys();
[4046]78        optionBoxL->fill(keys->getWidget());
79        windowBox->fill(optionBoxL);
80      }
81      Box* optionBoxR = new Box('v');
82      {
[4056]83        exec = new GuiExec();
[4046]84        optionBoxR->fill(exec->getWidget());
85       
[4056]86        flags = new GuiFlags();
[4046]87       
88        optionBoxR->fill(flags->getWidget());
89       
[4056]90        update = new GuiUpdate();
[4046]91        optionBoxR->fill(update->getWidget());
92      }
93      windowBox->fill(optionBoxR);
94    }
95    orxonoxGUI->fill(windowBox);
96  }
[4132]97
98
[3423]99  // Reading Values from File
[4051]100  exec->setConfDir(GUI_DEFAULT_CONF_DIR);
101  exec->setConfFile(GUI_DEFAULT_CONF_FILE);
[4046]102  exec->readFromFile(Window::mainWindow);
[3423]103  // Merging changes to the Options from appended flags.
104  for (int optCount = 1; optCount < argc; optCount++)
[4058]105    Window::mainWindow->walkThrough(Widget::flagCheck, argv[optCount], 0);
[2018]106
[4046]107  flags->setTextFromFlags(Window::mainWindow);
[4058]108  Window::mainWindow->showall();
109 
110  Window::mainWindow->walkThrough(Widget::redrawOptions, 1);
[2018]111
[3423]112  //// Handling special Cases. ///
[3166]113
[3423]114  // case update //
115#ifdef HAVE_CURL
[4092]116  if (static_cast<Option*>(Window::mainWindow->findWidgetByName(CONFIG_NAME_AUTO_UPDATE, 0))->value == 1)
[3423]117    {
118      update->checkForUpdates();
119    }
120#endif /* HAVE_CURL */
[4132]121}
[3166]122
[4132]123/**
124   \brief starts the OrxonoxGUI
125*/
126void Gui::startGui(void)
127{
[4059]128  mainloopGUI();
[4132]129 
[4062]130#ifndef HAVE_GTK2
131  GuiExec::startOrxonox(NULL, exec);
132#endif /* HAVE_GTK2 */
[2018]133}
[3423]134
[4132]135void Gui::printHelp()
136{
137  Window::mainWindow->walkThrough(Widget::printHelp, 1);
138}
139
140/**
141   \brief a bool that knows if orxonox should be started
142*/
[4056]143bool Gui::startOrxonox = false;
[3423]144
145/**
146   \brief Destructor.
147*/
[4056]148Gui::~Gui(void)
[3423]149{
150  delete video;
151  delete audio;
152  delete exec;
153  delete flags;
154  delete banner;
155  delete keys;
156  delete update;
157}
Note: See TracBrowser for help on using the repository browser.