Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: menus now show something useFull…

File size: 3.4 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;
55
[3423]56  initGUI(argc, argv);
57
[4058]58  orxonoxGUI = new Window( "grafical " PACKAGE_NAME " loader, "PACKAGE_VERSION);
[4046]59  {
60    Box* windowBox = new Box ('h');
61    {
[4056]62      banner = new GuiBanner();
[4046]63      windowBox->fill (banner->getWidget());
[2018]64     
[4046]65      Box* optionBoxL = new Box('v');
66      {
67        Box* avBox = new Box('h');
68       
[4056]69        video = new GuiVideo();
[4046]70        avBox->fill(video->getWidget());
[4056]71        audio = new GuiAudio();
[4046]72        avBox->fill(audio->getWidget());
73     
74        optionBoxL->fill(avBox);
[2613]75
[4056]76        keys = new GuiKeys();
[4046]77        optionBoxL->fill(keys->getWidget());
78        windowBox->fill(optionBoxL);
79      }
80      Box* optionBoxR = new Box('v');
81      {
[4056]82        exec = new GuiExec();
[4046]83        optionBoxR->fill(exec->getWidget());
84       
[4056]85        flags = new GuiFlags();
[4046]86       
87        optionBoxR->fill(flags->getWidget());
88       
[4056]89        update = new GuiUpdate();
[4046]90        optionBoxR->fill(update->getWidget());
91      }
92      windowBox->fill(optionBoxR);
93    }
94    orxonoxGUI->fill(windowBox);
95  }
[3423]96  // Reading Values from File
[4051]97  exec->setConfDir(GUI_DEFAULT_CONF_DIR);
98  exec->setConfFile(GUI_DEFAULT_CONF_FILE);
[4046]99  exec->readFromFile(Window::mainWindow);
[3423]100  // Merging changes to the Options from appended flags.
101  for (int optCount = 1; optCount < argc; optCount++)
[4058]102    Window::mainWindow->walkThrough(Widget::flagCheck, argv[optCount], 0);
[2018]103
[4046]104  flags->setTextFromFlags(Window::mainWindow);
[4058]105  Window::mainWindow->showall();
106 
107  Window::mainWindow->walkThrough(Widget::redrawOptions, 1);
[2018]108
[3423]109  //// Handling special Cases. ///
[3166]110
[3423]111  // case update //
112#ifdef HAVE_CURL
[4046]113  if (static_cast<Option*>(Window::mainWindow->findWidgetByName("auto update", 0))->value == 1)
[3423]114    {
115      update->checkForUpdates();
116    }
117#endif /* HAVE_CURL */
[3166]118
[3423]119  // case start-with-gui.
[4046]120  if (!access(exec->getConfigFile(), F_OK) && 
121      static_cast<Option*>(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0)
[4056]122    GuiExec::startOrxonox(NULL, exec);
[3423]123  else
124    {
125      mainloopGUI();
126    }
127
[2018]128}
[3423]129
[4056]130bool Gui::startOrxonox = false;
[3423]131
132/**
133   \brief Destructor.
134*/
[4056]135Gui::~Gui(void)
[3423]136{
137  delete video;
138  delete audio;
139  delete exec;
140  delete flags;
141  delete banner;
142  delete keys;
143  delete update;
144}
Note: See TracBrowser for help on using the repository browser.