Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/gui/gtk_gui/gui.cc @ 6225

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

orxonox/trunk: renamed all the \param → @param and so on in Doxygen tags.
Thanks a lot to the kDevelop team. this took since the last commit :)

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