Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4774 in orxonox.OLD for orxonox/trunk/src/lib/gui


Ignore:
Timestamp:
Jul 2, 2005, 6:28:26 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better ebuild, and the default data-dir can now be specified through ./configure —datadir=bla

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/gui/gui_update.cc

    r4746 r4774  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33   Copyright (C) 2004 orx
     
    1515   You should have received a copy of the GNU General Public License
    1616   along with this program; if not, write to the Free Software Foundation,
    17    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
     17   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    1818
    1919
     
    4040  Button* dataDirButton;       //!< A Button for the selection of the DataRepos
    4141  OptionLabel* dataDirLabel;   //!< A Label fot the selection of the DataRepos
    42  
     42
    4343
    4444  this->tmpDir = NULL;
     
    6161  dataDirDialog->setDefaultFileName("data");
    6262  dataDirDialog->setMask(DATA_IDENTIFIER);
    63   this->checkDataDir("../data/" DATA_IDENTIFIER, dataDirLabel);
     63  this->checkDataDir(DEFAULT_DATA_DIR DATA_IDENTIFIER, dataDirLabel);
    6464  dataDirDialog->disableFileOpts();
    6565  dataDirDialog->setOpenUpButton(dataDirButton);
     
    7878  this->autoUpdate->saveability();
    7979
    80  
     80
    8181
    8282
     
    8989#else /* HAVE_CURL */
    9090  Label* noCurlLabel = new Label("since you do not have cURL-support,\nupdate options are not availible");
    91   this->updateBox->fill(noCurlLabel); 
     91  this->updateBox->fill(noCurlLabel);
    9292#endif /* HAVE_CURL */
    9393  this->updateFrame->fill(this->updateBox);
     
    107107/**
    108108   \brief checks if the Folder containing selected File is data.oxd, and if so sets it.
    109    \param 
     109   \param
    110110*/
    111111bool GuiUpdate::checkDataDir(const char* fileName, void* object)
     
    115115      char* tmpName = new char[strlen(fileName)-strlen(DATA_IDENTIFIER)+1];
    116116      strncpy(tmpName, fileName, strlen(fileName)-strlen(DATA_IDENTIFIER));
    117       tmpName[strlen(fileName)-strlen(DATA_IDENTIFIER)] = '\0'; 
     117      tmpName[strlen(fileName)-strlen(DATA_IDENTIFIER)] = '\0';
    118118      static_cast<OptionLabel*>(object)->setValue(tmpName);
    119119      delete tmpName;
     
    125125
    126126
    127 /** 
     127/**
    128128    \brief Look what info we can get from this system
    129129*/
     
    162162  updateFileInfo.webRoot = "http://www.orxonox.ethz.ch/files/data";
    163163  updateFileInfo.localRoot = this->tmpDir;
    164  
     164
    165165  download(&updateFileInfo);
    166166}
     
    171171void GuiUpdate::updateDataWindowCreate()
    172172{
    173   this->updateDataWindow = new Window("update orxonox::Data");   
     173  this->updateDataWindow = new Window("update orxonox::Data");
    174174  this->updateDataBox = new Box('v');
    175175
     
    230230  test = new Button("increment");
    231231
    232 #ifdef HAVE_GTK2 
     232#ifdef HAVE_GTK2
    233233  test->connectSignal("button_press_event", updateSourceBar, updateSourceFunc);
    234234#endif /* HAVE_GTK2 */
    235235
    236236  this->updateSourceBox->fill(test);
    237   this->updateSourceWindow->fill(updateSourceBox); 
    238 #ifdef HAVE_GTK2 
     237  this->updateSourceWindow->fill(updateSourceBox);
     238#ifdef HAVE_GTK2
    239239  this->updateSourceWindowButton->connectSignal("button_press_event", this->updateSourceWindow, Window::windowOpen);
    240240  this->updateSourceWindow->connectSignal("destroy", this->updateSourceWindow, Window::windowClose);
     
    253253
    254254
    255 #ifdef HAVE_GTK2 
     255#ifdef HAVE_GTK2
    256256/**
    257257   \brief updates the Data of orxonox.
     
    367367    strcat(fileOnDisk, "/");
    368368  strcat(fileOnDisk, info->fileName);
    369  
     369
    370370  if(localCurl)
    371371    {
    372      
     372
    373373      info->fileHandle = fopen(fileOnDisk, "w");
    374      
     374
    375375      curl_easy_setopt(localCurl, CURLOPT_URL, fileOnNet);
    376376      curl_easy_setopt(localCurl, CURLOPT_WRITEDATA, info->fileHandle);
     
    378378      curl_easy_setopt(localCurl, CURLOPT_READFUNCTION, curlReadFunc);
    379379      curl_easy_setopt(localCurl, CURLOPT_NOPROGRESS, true);
    380      
     380
    381381      curl_easy_perform(localCurl);
    382382
     
    413413  if(curlHandle)
    414414    {
    415      
     415
    416416      info->fileHandle = fopen(fileOnDisk, "w");
    417      
     417
    418418      curl_easy_setopt(curlHandle, CURLOPT_URL, fileOnNet);
    419419      curl_easy_setopt(curlHandle, CURLOPT_WRITEDATA, info->fileHandle);
     
    425425
    426426      if(!isDownloading)
    427         {
    428 #ifdef HAVE_GTK2 
    429           info->stateButton->disconnectSignal(info->buttonSignal);
    430           info->buttonSignal = info->stateButton->connectSignal("button_press_event", info, cancelDownload);
    431 #endif /* HAVE_GTK2 */
    432           info->stateButton->setTitle("please wait");
    433          
    434           downloadThread(info);
    435           downloadThreadFinished(info);
    436          
    437           //      res = curl_easy_perform(curlHandle);
    438          
    439           //      fclose(outfile);
    440         }
    441       else 
    442         PRINTF(1)("thread already in use\n");
     427        {
     428#ifdef HAVE_GTK2
     429          info->stateButton->disconnectSignal(info->buttonSignal);
     430          info->buttonSignal = info->stateButton->connectSignal("button_press_event", info, cancelDownload);
     431#endif /* HAVE_GTK2 */
     432          info->stateButton->setTitle("please wait");
     433
     434          downloadThread(info);
     435          downloadThreadFinished(info);
     436
     437          //      res = curl_easy_perform(curlHandle);
     438
     439          //      fclose(outfile);
     440        }
     441      else
     442        PRINTF(1)("thread already in use\n");
    443443
    444444    }
     
    459459
    460460/**
    461    \brief Finishes a downloading process. 
     461   \brief Finishes a downloading process.
    462462   \param fileInfo the FileInfo.
    463463*/
    464464void* GuiUpdate::downloadThreadFinished(void* fileInfo)
    465 { 
     465{
    466466  FileInfo* info =(FileInfo*)fileInfo;
    467467  if(curlHandle)
    468468    curl_easy_cleanup(curlHandle);
    469  
     469
    470470  PRINTF(4)("Closing the downloaded file.\n");
    471471  fclose(info->fileHandle);
     
    475475  //  else
    476476  //    info->stateButton->setTitle("done");
    477 #ifdef HAVE_GTK2 
     477#ifdef HAVE_GTK2
    478478  info->stateButton->disconnectSignal(info->buttonSignal);
    479479  info->buttonSignal = info->stateButton->connectSignal("button_press_event", info, updateDataFunc);
Note: See TracChangeset for help on using the changeset viewer.