Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 3, 2005, 12:13:38 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/updater: code-standartisation updated in all files.

  1. member → this→member
  2. function (bla) → function(bla)
  3. other small fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/updater/src/gui/orxonox_gui_update.cc

    r3303 r3315  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3 
    43   Copyright (C) 2004 orx
    54
     
    3736   \brief Creates an Audio-Frame
    3837*/
    39 OrxonoxGuiUpdate::OrxonoxGuiUpdate ()
     38OrxonoxGuiUpdate::OrxonoxGuiUpdate(void)
    4039{
    4140  this->getSystemInfo();
    4241
    43   this->updateFrame = new Frame ("Update-Options:");
    44   this->updateFrame->setGroupName ("update");
    45   this->updateBox = new Box ('v');
     42  this->updateFrame = new Frame("Update-Options:");
     43  this->updateFrame->setGroupName("update");
     44  this->updateBox = new Box('v');
    4645#ifdef HAVE_CURL
    4746
    4847  // the Button for autoUpdating
    49   this->autoUpdate = new CheckButton ("auto update");
     48  this->autoUpdate = new CheckButton("auto update");
    5049  this->updateBox->fill(this->autoUpdate);
    51   this->autoUpdate->setFlagName ("update", "u", 0);
     50  this->autoUpdate->setFlagName("update", "u", 0);
    5251  this->autoUpdate->saveability();
    5352
    54   this->updateSourceWindowCreate ();
     53  this->updateSourceWindowCreate();
    5554  this->updateBox->fill(this->updateSourceWindowGetButton());
    5655
    57   this->updateDataWindowCreate ();
     56  this->updateDataWindowCreate();
    5857  this->updateBox->fill(this->updateDataWindowGetButton());
    5958
     
    7069   \return Returns the Audio-frame
    7170*/
    72 Widget* OrxonoxGuiUpdate::getWidget ()
    73 {
    74   return updateFrame;
     71Widget* OrxonoxGuiUpdate::getWidget(void)
     72{
     73  return this->updateFrame;
    7574}
    7675
     
    8180{
    8281  PRINTF(3)("Grabbing system information\n");
    83   tmpDir = getenv("TMPDIR");
    84   if (!tmpDir)
    85     tmpDir = "/tmp";
    86   PRINTF(4)("Temporary directory is: %s\n", tmpDir);
     82  this->tmpDir = getenv("TMPDIR");
     83  if(!tmpDir)
     84    this->tmpDir = "/tmp";
     85  PRINTF(4)("Temporary directory is: %s\n", this->tmpDir);
    8786
    8887#ifdef __WIN32__
    89   homeDir = getenv ("USERPROFILE");
     88  this->homeDir = getenv("USERPROFILE");
    9089#else
    91   homeDir = getenv("HOME");
     90  this->homeDir = getenv("HOME");
    9291#endif
    9392  PRINTF(4)("Home directory is %s\n", homeDir);
    9493
    95   installDataDir = "/usr/share/games/orxonox";
    96   PRINTF(4)("Installation of orxonox-data will go to this directory: %s\n", installDataDir);
    97 
    98   installSourceDir = "/usr/games/bin";
    99   PRINTF(4)("Installation of orxonox-source will go to this directory: %s\n", installSourceDir);
    100 
    101   userName = getenv("USER");
    102   PRINTF(4)("Logged in username is: %s\n", userName);
     94  this->installDataDir = "/usr/share/games/orxonox";
     95  PRINTF(4)("Installation of orxonox-data will go to this directory: %s\n", this->installDataDir);
     96
     97  this->installSourceDir = "/usr/games/bin";
     98  PRINTF(4)("Installation of orxonox-source will go to this directory: %s\n", this->installSourceDir);
     99
     100  this->userName = getenv("USER");
     101  PRINTF(4)("Logged in username is: %s\n", this->userName);
    103102}
    104103
     
    119118   \brief Creates a window, and all it contains for the Data-update.
    120119*/
    121 void OrxonoxGuiUpdate::updateDataWindowCreate (void)
    122 {
    123   updateDataWindow = new Window ("update orxonox::Data");   
    124   updateDataBox = new Box ('v');
     120void OrxonoxGuiUpdate::updateDataWindowCreate(void)
     121{
     122  this->updateDataWindow = new Window("update orxonox::Data");   
     123  this->updateDataBox = new Box('v');
    125124
    126125  // the close-Button of the Update Window.
    127   //  updateWindowClose = new Button ("close");
     126  //  updateWindowClose = new Button("close");
    128127#ifdef HAVE_GTK2
    129128  //  updateWindowClose->connectSignal("button_press_event", updateWindow, Window::windowClose);
     
    131130  //  updateWindowBox->fill(updateWindowClose);
    132131
    133   updateDataBar = new ProgressBar ();
    134   updateDataBox->fill(updateDataBar);
     132  this->updateDataBar = new ProgressBar();
     133  this->updateDataBox->fill(this->updateDataBar);
    135134
    136135  FileInfo* dataInfo = new FileInfo;
    137   dataInfo->bar = updateDataBar;
    138 
    139   updateDataBegin = new Button ("begin.");
    140   dataInfo->stateButton = updateDataBegin;
    141 #ifdef HAVE_GTK2
    142   dataInfo->buttonSignal = updateDataBegin->connectSignal ("button_press_event", dataInfo, updateDataFunc);
    143 #endif /* HAVE_GTK2 */
    144   updateDataBox->fill(updateDataBegin);
    145 
    146   updateDataWindow->fill (updateDataBox);
    147 
    148   updateDataWindowButton = new Button ("update orxonox::Data");
    149 #ifdef HAVE_GTK2
    150   updateDataWindowButton->connectSignal("button_press_event", updateDataWindow, Window::windowOpen);
    151   updateDataWindow->connectSignal("destroy", updateDataWindow, Window::windowClose);
    152   updateDataWindow->connectSignal("delete_event", updateDataWindow, Window::windowClose);
     136  dataInfo->bar = this->updateDataBar;
     137
     138  this->updateDataBegin = new Button("begin.");
     139  dataInfo->stateButton = this->updateDataBegin;
     140#ifdef HAVE_GTK2
     141  dataInfo->buttonSignal = updateDataBegin->connectSignal("button_press_event", dataInfo, updateDataFunc);
     142#endif /* HAVE_GTK2 */
     143  this->updateDataBox->fill(this->updateDataBegin);
     144
     145  this->updateDataWindow->fill(this->updateDataBox);
     146
     147  this->updateDataWindowButton = new Button("update orxonox::Data");
     148#ifdef HAVE_GTK2
     149  this->updateDataWindowButton->connectSignal("button_press_event", this->updateDataWindow, Window::windowOpen);
     150  this->updateDataWindow->connectSignal("destroy", this->updateDataWindow, Window::windowClose);
     151  this->updateDataWindow->connectSignal("delete_event", this->updateDataWindow, Window::windowClose);
    153152#endif /* HAVE_GTK2 */
    154153
     
    160159Button* OrxonoxGuiUpdate::updateDataWindowGetButton(void)
    161160{
    162   return updateDataWindowButton;
     161  return this->updateDataWindowButton;
    163162}
    164163
     
    166165   \brief Creates a window, and all it contains for the Source-update.
    167166*/
    168 void OrxonoxGuiUpdate::updateSourceWindowCreate (void)
     167void OrxonoxGuiUpdate::updateSourceWindowCreate(void)
    169168{
    170169  // the button, that opens this Window.
    171   updateSourceWindowButton = new Button ("update orxonox::Source");
     170  this->updateSourceWindowButton = new Button("update orxonox::Source");
    172171
    173172  // the Window itself
    174   updateSourceWindow = new Window ("update orxonox::Source");
    175 
    176   updateSourceBox = new Box ();
    177 
    178   updateSourceBar = new ProgressBar ();
    179   updateSourceBox->fill(updateSourceBar);
    180   test = new Button ("increment");
     173  this->updateSourceWindow = new Window("update orxonox::Source");
     174
     175  this->updateSourceBox = new Box();
     176
     177  this->updateSourceBar = new ProgressBar();
     178  this->updateSourceBox->fill(this->updateSourceBar);
     179  test = new Button("increment");
    181180
    182181#ifdef HAVE_GTK2
     
    184183#endif /* HAVE_GTK2 */
    185184
    186   updateSourceBox->fill(test);
    187   updateSourceWindow->fill(updateSourceBox);
    188 #ifdef HAVE_GTK2
    189   updateSourceWindowButton->connectSignal("button_press_event", updateSourceWindow, Window::windowOpen);
    190   updateSourceWindow->connectSignal("destroy", updateSourceWindow, Window::windowClose);
    191   updateSourceWindow->connectSignal("delete_event", updateSourceWindow, Window::windowClose);
     185  this->updateSourceBox->fill(test);
     186  this->updateSourceWindow->fill(updateSourceBox);
     187#ifdef HAVE_GTK2
     188  this->updateSourceWindowButton->connectSignal("button_press_event", this->updateSourceWindow, Window::windowOpen);
     189  this->updateSourceWindow->connectSignal("destroy", this->updateSourceWindow, Window::windowClose);
     190  this->updateSourceWindow->connectSignal("delete_event", this->updateSourceWindow, Window::windowClose);
    192191#endif /* HAVE_GTK2 */
    193192
     
    199198Button* OrxonoxGuiUpdate::updateSourceWindowGetButton(void)
    200199{
    201   return updateSourceWindowButton;
     200  return this->updateSourceWindowButton;
    202201}
    203202
     
    212211gint OrxonoxGuiUpdate::updateDataFunc(GtkWidget* w, GdkEventKey* event, void* info)
    213212{
    214   FileInfo* dataInfo = (FileInfo*)info;
     213  FileInfo* dataInfo =(FileInfo*)info;
    215214
    216215  dataInfo->fileName = "02%20orxonox%203.mp3";
     
    242241   \param stream Filehandler to write to.
    243242*/
    244 size_t OrxonoxGuiUpdate::curlWriteFunc (void* ptr, size_t size, size_t nmemb, FILE* stream)
     243size_t OrxonoxGuiUpdate::curlWriteFunc(void* ptr, size_t size, size_t nmemb, FILE* stream)
    245244{
    246245  return fwrite(ptr, size, nmemb, stream);
     
    254253   \param stream Filehandler to get data from.
    255254*/
    256 size_t OrxonoxGuiUpdate::curlReadFunc (void* ptr, size_t size, size_t nmemb, FILE* stream)
     255size_t OrxonoxGuiUpdate::curlReadFunc(void* ptr, size_t size, size_t nmemb, FILE* stream)
    257256{
    258257  return fread(ptr, size, nmemb, stream);
     
    268267   \param upProgress not needed
    269268*/
    270 int OrxonoxGuiUpdate::curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress)
    271 {
    272   Bar->setProgress(progress);
    273   Bar->setTotalSize(totalSize);
     269int OrxonoxGuiUpdate::curlProgressFunc(ProgressBar* bar, double totalSize, double progress, double upTotal, double upProgress)
     270{
     271  bar->setProgress(progress);
     272  bar->setTotalSize(totalSize);
    274273#ifdef HAVE_GTK2
    275274#ifndef HAVE_PTHREAD_H
     
    281280
    282281/**
    283    \brief The Curl handle for only one CURL (static).
     282   \brief The Curl handle for only one CURL(static).
    284283*/
    285284CURL* OrxonoxGuiUpdate::curlHandle = NULL;
     
    305304bool OrxonoxGuiUpdate::download(void* fileInfo)
    306305{
    307   if (isDownloading)
     306  if(isDownloading)
    308307    {
    309308      PRINTF(2)("unable to Download. already getting some file\n");
     
    311310    }
    312311  PRINTF(3)("Downloading.\n");
    313   FileInfo* info = (FileInfo*)fileInfo;
     312  FileInfo* info =(FileInfo*)fileInfo;
    314313  CURLcode res;
    315314  CURL* localCurl;
    316315  localCurl = curl_easy_init();
    317316  char* fileOnNet = new char [strlen(info->webRoot)+strlen(info->fileName)+2];
    318   strcpy (fileOnNet, info->webRoot);
    319   if (fileOnNet[strlen(fileOnNet)] != '/') //!< \todo windows-shit
    320     strcat (fileOnNet, "/");
    321   strcat (fileOnNet, info->fileName);
     317  strcpy(fileOnNet, info->webRoot);
     318  if(fileOnNet[strlen(fileOnNet)] != '/') //!< \todo windows-shit
     319    strcat(fileOnNet, "/");
     320  strcat(fileOnNet, info->fileName);
    322321  char* fileOnDisk = new char [strlen(info->localRoot)+strlen(info->fileName)+2];
    323   strcpy (fileOnDisk, info->localRoot);
    324   if (fileOnDisk[strlen(fileOnDisk)] != '/') //!< \todo windows-shit
    325     strcat (fileOnDisk, "/");
    326   strcat (fileOnDisk, info->fileName);
     322  strcpy(fileOnDisk, info->localRoot);
     323  if(fileOnDisk[strlen(fileOnDisk)] != '/') //!< \todo windows-shit
     324    strcat(fileOnDisk, "/");
     325  strcat(fileOnDisk, info->fileName);
    327326 
    328327  if(localCurl)
     
    340339
    341340      curl_easy_cleanup(localCurl);
    342       fclose (info->fileHandle);
     341      fclose(info->fileHandle);
    343342    }
    344343}
     
    353352bool OrxonoxGuiUpdate::downloadWithStyle(void* fileInfo)
    354353{
    355   if (isDownloading)
     354  if(isDownloading)
    356355    {
    357356      PRINTF(2)("unable to Download. already getting some file\n");
     
    359358    }
    360359  PRINTF(3)("Downloading.\n");
    361   FileInfo* info = (FileInfo*)fileInfo;
     360  FileInfo* info =(FileInfo*)fileInfo;
    362361  CURLcode res;
    363362  curlHandle = curl_easy_init();
    364363  char* fileOnNet = new char [strlen(info->webRoot)+strlen(info->fileName)+1];
    365   strcpy (fileOnNet, info->webRoot);
    366   strcat (fileOnNet, info->fileName);
     364  strcpy(fileOnNet, info->webRoot);
     365  strcat(fileOnNet, info->fileName);
    367366  char* fileOnDisk = new char [strlen(info->localRoot)+strlen(info->fileName)+1];
    368   strcpy (fileOnDisk, info->localRoot);
    369   strcat (fileOnDisk, info->fileName);
     367  strcpy(fileOnDisk, info->localRoot);
     368  strcat(fileOnDisk, info->fileName);
    370369
    371370  if(curlHandle)
     
    382381      curl_easy_setopt(curlHandle, CURLOPT_PROGRESSDATA, info->bar);
    383382
    384       if (!isDownloading)
     383      if(!isDownloading)
    385384        {
    386385#ifdef HAVE_PTHREAD_H     
     
    418417
    419418/**
    420    \brief The downloading process (either threaded or not).
     419   \brief The downloading process(either threaded or not).
    421420   \param fileInfo the FileInfo.
    422421
     
    435434void* OrxonoxGuiUpdate::downloadThreadFinished(void* fileInfo)
    436435{
    437   FileInfo* info = (FileInfo*)fileInfo;
    438 #ifdef HAVE_PTHREAD_H
    439   pthread_join (*downloadThreadID, NULL);
     436  FileInfo* info =(FileInfo*)fileInfo;
     437#ifdef HAVE_PTHREAD_H
     438  pthread_join(*downloadThreadID, NULL);
    440439#ifdef HAVE_GTK2
    441440  gdk_threads_enter();
    442441#endif /* HAVE_GTK2 */
    443442#endif /* HAVE_PTHREAD_H */
    444   if (curlHandle)
     443  if(curlHandle)
    445444    curl_easy_cleanup(curlHandle);
    446445 
     
    448447  fclose(info->fileHandle);
    449448
    450   if (isDownloading)
     449  if(isDownloading)
    451450    info->stateButton->setTitle("go on");
    452451  //  else
Note: See TracChangeset for help on using the changeset viewer.