Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: moved the gui to a more usefull directory

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        flags = new GuiFlags();
[4046]84        optionBoxR->fill(flags->getWidget());
85       
[4056]86        update = new GuiUpdate();
[4046]87        optionBoxR->fill(update->getWidget());
[4164]88
89        exec = new GuiExec();
90        optionBoxR->fill(exec->getWidget());
[4046]91      }
92      windowBox->fill(optionBoxR);
93    }
94    orxonoxGUI->fill(windowBox);
95  }
[4132]96
97
[3423]98  // Reading Values from File
[4051]99  exec->setConfDir(GUI_DEFAULT_CONF_DIR);
100  exec->setConfFile(GUI_DEFAULT_CONF_FILE);
[4046]101  exec->readFromFile(Window::mainWindow);
[3423]102  // Merging changes to the Options from appended flags.
103  for (int optCount = 1; optCount < argc; optCount++)
[4058]104    Window::mainWindow->walkThrough(Widget::flagCheck, argv[optCount], 0);
[2018]105
[4046]106  flags->setTextFromFlags(Window::mainWindow);
[4058]107  Window::mainWindow->showall();
108 
109  Window::mainWindow->walkThrough(Widget::redrawOptions, 1);
[2018]110
[3423]111  //// Handling special Cases. ///
[3166]112
[3423]113  // case update //
114#ifdef HAVE_CURL
[4092]115  if (static_cast<Option*>(Window::mainWindow->findWidgetByName(CONFIG_NAME_AUTO_UPDATE, 0))->value == 1)
[3423]116    {
117      update->checkForUpdates();
118    }
119#endif /* HAVE_CURL */
[4132]120}
[3166]121
[4132]122/**
123   \brief starts the OrxonoxGUI
124*/
125void Gui::startGui(void)
126{
[4059]127  mainloopGUI();
[4132]128 
[4062]129#ifndef HAVE_GTK2
130  GuiExec::startOrxonox(NULL, exec);
131#endif /* HAVE_GTK2 */
[2018]132}
[3423]133
[4132]134void Gui::printHelp()
135{
136  Window::mainWindow->walkThrough(Widget::printHelp, 1);
137}
138
139/**
140   \brief a bool that knows if orxonox should be started
141*/
[4056]142bool Gui::startOrxonox = false;
[3423]143
144/**
145   \brief Destructor.
146*/
[4056]147Gui::~Gui(void)
[3423]148{
149  delete video;
150  delete audio;
151  delete exec;
152  delete flags;
153  delete banner;
154  delete keys;
155  delete update;
156}
Note: See TracBrowser for help on using the repository browser.