Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3423 in orxonox.OLD for orxonox/trunk/src/gui/orxonox_gui.cc


Ignore:
Timestamp:
Feb 27, 2005, 7:11:19 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/updater back into the trunk
merged with command: svn merge branches/updater trunk -r 3241:HEAD
resolved conflicts in debug.h in favor of the trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/gui/orxonox_gui.cc

    r3187 r3423  
    2424*/
    2525
     26#include <unistd.h>
     27
    2628#include "orxonox_gui.h"
    2729#include "orxonox_gui_video.h"
     
    3133#include "orxonox_gui_banner.h"
    3234#include "orxonox_gui_keys.h"
     35#include "orxonox_gui_update.h"
    3336
    3437  Window* orxonoxGUI;
     
    3942  OrxonoxGuiBanner* banner;
    4043  OrxonoxGuiKeys* keys;
     44  OrxonoxGuiUpdate* update;
     45int verbose = 4;
    4146
    42 int main( int argc, char *argv[] )
     47int main(int argc, char *argv[])
    4348{
    4449  OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv);
     
    5156   \brief Initializes the Gui
    5257*/
    53 OrxonoxGui::OrxonoxGui (int argc, char *argv[])
     58OrxonoxGui::OrxonoxGui(int argc, char *argv[])
    5459{
    55 #ifdef HAVE_GTK2
    56   initGTK(argc, argv);
    57 #endif /* HAVE_GTK2 */
    58   orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION);
    59 #ifdef HAVE_GTK2
    60   orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit);
    61   orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit);
    62 #endif /* HAVE_GTK2 */
     60  initGUI(argc, argv);
     61
     62  orxonoxGUI = new Window( "grafical orxonox loader, "PACKAGE_VERSION);
    6363 
    6464  Box* windowBox = new Box ('h');
     
    6767  windowBox->fill (banner->getWidget());
    6868 
    69   Box* optionBox = new Box ('v');
     69  Box* optionBox = new Box('v');
    7070 
    71   Box* avBox = new Box ('h');
     71  Box* avBox = new Box('h');
    7272
    73   video = new OrxonoxGuiVideo ();
    74   avBox->fill (video->getWidget ());
    75   audio = new OrxonoxGuiAudio ();
    76   avBox->fill (audio->getWidget ());
     73  video = new OrxonoxGuiVideo();
     74  avBox->fill(video->getWidget());
     75  audio = new OrxonoxGuiAudio();
     76  avBox->fill(audio->getWidget());
    7777     
    78   optionBox->fill (avBox);
     78  optionBox->fill(avBox);
    7979
    80   keys = new OrxonoxGuiKeys ();
    81   optionBox->fill (keys->getWidget ());
     80  keys = new OrxonoxGuiKeys();
     81  optionBox->fill(keys->getWidget());
    8282
    83   exec = new OrxonoxGuiExec (orxonoxGUI);
    84   optionBox->fill (exec->getWidget ());
     83  exec = new OrxonoxGuiExec();
     84  optionBox->fill(exec->getWidget());
    8585
    86   flags = new OrxonoxGuiFlags (orxonoxGUI);
     86  flags = new OrxonoxGuiFlags();
     87
     88  optionBox->fill(flags->getWidget());
     89  windowBox->fill(optionBox);
     90
     91  update = new OrxonoxGuiUpdate();
     92  optionBox->fill(update->getWidget());
     93 
     94  orxonoxGUI->fill(windowBox);
     95
     96  // Reading Values from File
     97  exec->setFilename("~/.orxonox.conf");
     98  exec->readFromFile(orxonoxGUI);
     99  // Merging changes to the Options from appended flags.
     100  for (int optCount = 1; optCount < argc; optCount++)
     101    orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0);
     102
     103  flags->setTextFromFlags(orxonoxGUI);
     104  orxonoxGUI->showall();
     105
     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.
     117  if (!access(exec->getConfigFile(), F_OK) && static_cast<Option*>(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0)
     118    OrxonoxGuiExec::startOrxonox(NULL, exec);
     119  else
     120    {
     121      mainloopGUI();
     122    }
     123
     124}
    87125
    88126
    89   optionBox->fill (flags->getWidget ());
    90   windowBox->fill (optionBox);
    91  
    92   orxonoxGUI->fill (windowBox);
    93   flags->setTextFromFlags (orxonoxGUI);
    94 
    95   exec->setFilename ("~/.orxonox.conf");
    96   exec->readFromFile (orxonoxGUI);
    97   //  orxonoxGUI->walkThrough(orxonoxGUI->listOptions);
    98 
    99   orxonoxGUI->showall ();
    100 
    101  
    102 #ifdef HAVE_GTK2
    103   mainloopGTK();
    104 #else /* HAVE_GTK2 */
    105   cout << " Listing all the Orxonox Options: \n";
    106   cout << "  #############################\n";
    107   orxonoxGUI->walkThrough(orxonoxGUI->listOptions);
    108 
    109   cout << "\nDo you want me to save the the above values now? [Yn] ";
    110   char c = getchar();
    111   if ((c == 'y' || c == 'Y' || c== 10) && exec->shouldsave())
    112     exec->writeToFile (Window::mainWindow);
    113  
    114 #endif /* HAVE_GTK2 */
    115 
     127/**
     128   \brief Destructor.
     129*/
     130OrxonoxGui::~OrxonoxGui(void)
     131{
     132  delete video;
     133  delete audio;
     134  delete exec;
     135  delete flags;
     136  delete banner;
     137  delete keys;
     138  delete update;
    116139}
Note: See TracChangeset for help on using the changeset viewer.