Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/updater/src/gui/orxonox_gui.cc @ 3379

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

orxonox/branches/updater: implemented advanced-Video-Options. Patrick I believe you will need them…
could not resist, during looking StarTreck TNG, after listening to graphical data processing.

File size: 3.3 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
[3296]26#include <unistd.h>
27
[2018]28#include "orxonox_gui.h"
29#include "orxonox_gui_video.h"
30#include "orxonox_gui_audio.h"
31#include "orxonox_gui_exec.h"
32#include "orxonox_gui_flags.h"
[2580]33#include "orxonox_gui_banner.h"
[2613]34#include "orxonox_gui_keys.h"
[3251]35#include "orxonox_gui_update.h"
[2018]36
37  Window* orxonoxGUI;
38  OrxonoxGuiVideo* video;
39  OrxonoxGuiAudio* audio;
40  OrxonoxGuiExec* exec;
[2580]41  OrxonoxGuiFlags* flags;
42  OrxonoxGuiBanner* banner;
[2613]43  OrxonoxGuiKeys* keys;
[3251]44  OrxonoxGuiUpdate* update;
[3263]45int verbose = 4;
[2018]46
[3315]47int main(int argc, char *argv[])
[2018]48{
49  OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv);
50  return 0;
51}
52
53/* ORXONOXGUI */
54
[2588]55/**
[2623]56   \brief Initializes the Gui
[2588]57*/
[3315]58OrxonoxGui::OrxonoxGui(int argc, char *argv[])
[2018]59{
[3305]60  initGUI(argc, argv);
[3263]61
[3379]62  orxonoxGUI = new Window( "grafical orxonox loader, "PACKAGE_VERSION);
[2018]63 
[2024]64  Box* windowBox = new Box ('h');
65
[2580]66  banner = new OrxonoxGuiBanner();
[2595]67  windowBox->fill (banner->getWidget());
[2580]68 
[3315]69  Box* optionBox = new Box('v');
[2018]70 
[3315]71  Box* avBox = new Box('h');
[2018]72
[3315]73  video = new OrxonoxGuiVideo();
74  avBox->fill(video->getWidget());
75  audio = new OrxonoxGuiAudio();
76  avBox->fill(audio->getWidget());
[2018]77     
[3315]78  optionBox->fill(avBox);
[2613]79
[3315]80  keys = new OrxonoxGuiKeys();
81  optionBox->fill(keys->getWidget());
[2613]82
[3315]83  exec = new OrxonoxGuiExec();
84  optionBox->fill(exec->getWidget());
[2018]85
[3315]86  flags = new OrxonoxGuiFlags();
[2024]87
[3315]88  optionBox->fill(flags->getWidget());
89  windowBox->fill(optionBox);
[3251]90
[3315]91  update = new OrxonoxGuiUpdate();
[3252]92  optionBox->fill(update->getWidget());
[2018]93 
[3315]94  orxonoxGUI->fill(windowBox);
[2018]95
[3296]96  // Reading Values from File
[3315]97  exec->setFilename("~/.orxonox.conf");
98  exec->readFromFile(orxonoxGUI);
[3296]99  // Merging changes to the Options from appended flags.
[3295]100  for (int optCount = 1; optCount < argc; optCount++)
101    orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0);
[3251]102
[3379]103  flags->setTextFromFlags(orxonoxGUI);
[3315]104  orxonoxGUI->showall();
[2018]105
[3298]106  //// Handling special Cases. ///
107
108  // case update //
109#ifdef HAVE_CURL
110  if (static_cast<Option*>(orxonoxGUI->findWidgetByName("auto update", 0))->value == 1)
111    {
112      update->checkForUpdates();
113    }
114#endif /* HAVE_CURL */
115
116  // case start-with-gui.
[3296]117  if (!access(exec->getConfigFile(), F_OK) && static_cast<Option*>(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0)
[3303]118    OrxonoxGuiExec::startOrxonox(NULL, exec);
[3296]119  else
[3305]120    {
121      mainloopGUI();
122    }
123
[2018]124}
[3315]125
126
127/**
[3317]128   \brief Destructor.
[3315]129*/
130OrxonoxGui::~OrxonoxGui(void)
131{
[3318]132  delete video;
133  delete audio;
134  delete exec;
135  delete flags;
136  delete banner;
137  delete keys;
138  delete update;
[3315]139}
Note: See TracBrowser for help on using the repository browser.