Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui.cc @ 4044

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

orxonox/branches/guiMerge: merged the Gui into the orxonox-binary, but it does not finish nicely (yet)

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