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
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   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*/
25
26#include <unistd.h>
27
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"
37
38// GUI-modules
39GuiFlags* flags   = NULL;
40GuiVideo* video   = NULL;
41GuiAudio* audio   = NULL;
42GuiExec* exec     = NULL;
43GuiBanner* banner = NULL;
44GuiKeys* keys     = NULL;
45GuiUpdate* update = NULL;
46
47/* ORXONOXGUI */
48
49/**
50   \brief Initializes the Gui
51*/
52Gui::Gui(int argc, char *argv[])
53{
54  Window* orxonoxGUI = NULL;
55
56  initGUI(argc, argv);
57
58  orxonoxGUI = new Window( "grafical " PACKAGE_NAME " loader, "PACKAGE_VERSION);
59  {
60    Box* windowBox = new Box ('h');
61    {
62      banner = new GuiBanner();
63      windowBox->fill (banner->getWidget());
64     
65      Box* optionBoxL = new Box('v');
66      {
67        Box* avBox = new Box('h');
68       
69        video = new GuiVideo();
70        avBox->fill(video->getWidget());
71        audio = new GuiAudio();
72        avBox->fill(audio->getWidget());
73     
74        optionBoxL->fill(avBox);
75
76        keys = new GuiKeys();
77        optionBoxL->fill(keys->getWidget());
78        windowBox->fill(optionBoxL);
79      }
80      Box* optionBoxR = new Box('v');
81      {
82        exec = new GuiExec();
83        optionBoxR->fill(exec->getWidget());
84       
85        flags = new GuiFlags();
86       
87        optionBoxR->fill(flags->getWidget());
88       
89        update = new GuiUpdate();
90        optionBoxR->fill(update->getWidget());
91      }
92      windowBox->fill(optionBoxR);
93    }
94    orxonoxGUI->fill(windowBox);
95  }
96  // Reading Values from File
97  exec->setConfDir(GUI_DEFAULT_CONF_DIR);
98  exec->setConfFile(GUI_DEFAULT_CONF_FILE);
99  exec->readFromFile(Window::mainWindow);
100  // Merging changes to the Options from appended flags.
101  for (int optCount = 1; optCount < argc; optCount++)
102    Window::mainWindow->walkThrough(Widget::flagCheck, argv[optCount], 0);
103
104  flags->setTextFromFlags(Window::mainWindow);
105  Window::mainWindow->showall();
106 
107  Window::mainWindow->walkThrough(Widget::redrawOptions, 1);
108
109  //// Handling special Cases. ///
110
111  // case update //
112#ifdef HAVE_CURL
113  if (static_cast<Option*>(Window::mainWindow->findWidgetByName("auto update", 0))->value == 1)
114    {
115      update->checkForUpdates();
116    }
117#endif /* HAVE_CURL */
118
119  // case start-with-gui.
120  if (!access(exec->getConfigFile(), F_OK) && 
121      static_cast<Option*>(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0)
122    GuiExec::startOrxonox(NULL, exec);
123  else
124    {
125      mainloopGUI();
126    }
127
128}
129
130bool Gui::startOrxonox = false;
131
132/**
133   \brief Destructor.
134*/
135Gui::~Gui(void)
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.