Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: orxonox —help now shows something more usefull… still cleaning up the GUI

File size: 3.5 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  executable = NULL;
56 
57  initGUI(argc, argv);
58
59  orxonoxGUI = new Window( "grafical " PACKAGE_NAME " loader, "PACKAGE_VERSION);
60  {
61    Box* windowBox = new Box ('h');
62    {
63      banner = new GuiBanner();
64      windowBox->fill (banner->getWidget());
65     
66      Box* optionBoxL = new Box('v');
67      {
68        Box* avBox = new Box('h');
69       
70        video = new GuiVideo();
71        avBox->fill(video->getWidget());
72        audio = new GuiAudio();
73        avBox->fill(audio->getWidget());
74     
75        optionBoxL->fill(avBox);
76
77        keys = new GuiKeys();
78        optionBoxL->fill(keys->getWidget());
79        windowBox->fill(optionBoxL);
80      }
81      Box* optionBoxR = new Box('v');
82      {
83        exec = new GuiExec();
84        optionBoxR->fill(exec->getWidget());
85       
86        flags = new GuiFlags();
87       
88        optionBoxR->fill(flags->getWidget());
89       
90        update = new GuiUpdate();
91        optionBoxR->fill(update->getWidget());
92      }
93      windowBox->fill(optionBoxR);
94    }
95    orxonoxGUI->fill(windowBox);
96  }
97
98
99  // Reading Values from File
100  exec->setConfDir(GUI_DEFAULT_CONF_DIR);
101  exec->setConfFile(GUI_DEFAULT_CONF_FILE);
102  exec->readFromFile(Window::mainWindow);
103  // Merging changes to the Options from appended flags.
104  for (int optCount = 1; optCount < argc; optCount++)
105    Window::mainWindow->walkThrough(Widget::flagCheck, argv[optCount], 0);
106
107  flags->setTextFromFlags(Window::mainWindow);
108  Window::mainWindow->showall();
109 
110  Window::mainWindow->walkThrough(Widget::redrawOptions, 1);
111
112  //// Handling special Cases. ///
113
114  // case update //
115#ifdef HAVE_CURL
116  if (static_cast<Option*>(Window::mainWindow->findWidgetByName(CONFIG_NAME_AUTO_UPDATE, 0))->value == 1)
117    {
118      update->checkForUpdates();
119    }
120#endif /* HAVE_CURL */
121}
122
123/**
124   \brief starts the OrxonoxGUI
125*/
126void Gui::startGui(void)
127{
128  mainloopGUI();
129 
130#ifndef HAVE_GTK2
131  GuiExec::startOrxonox(NULL, exec);
132#endif /* HAVE_GTK2 */
133}
134
135void Gui::printHelp()
136{
137  Window::mainWindow->walkThrough(Widget::printHelp, 1);
138}
139
140/**
141   \brief a bool that knows if orxonox should be started
142*/
143bool Gui::startOrxonox = false;
144
145/**
146   \brief Destructor.
147*/
148Gui::~Gui(void)
149{
150  delete video;
151  delete audio;
152  delete exec;
153  delete flags;
154  delete banner;
155  delete keys;
156  delete update;
157}
Note: See TracBrowser for help on using the repository browser.