Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3284 in orxonox.OLD for orxonox/branches/updater


Ignore:
Timestamp:
Dec 26, 2004, 12:53:21 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/updater: cleaner code

Location:
orxonox/branches/updater/src/gui
Files:
2 edited

Legend:

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

    r3283 r3284  
    288288      if (!isDownloading)
    289289        {
    290           isDownloading = true;
     290          pthread_join(*downloadThreadFinishID, NULL);
     291
     292          info->stateButton->disconnectSignal(info->buttonSignal);
     293          info->buttonSignal = info->stateButton->connectSignal("button_press_event", info, cancelDownload);
     294#ifdef HAVE_PTHREAD_H
     295          info->stateButton->setTitle("cancel");
     296#else /* HAVE_PTHREAD_H */
     297          info->stateButton->setTitle("please wait");
     298#endif /* HAVE_PTHREAD_H */
     299         
    291300          //! \todo check if threads really were created.
    292301#ifdef HAVE_PTHREAD_H
    293           pthread_join(*downloadThreadFinishID, NULL);
    294302          pthread_create(downloadThreadID, NULL, downloadThread, info);
    295303          pthread_create(downloadThreadFinishID, NULL, downloadThreadFinished, info); 
     
    318326void* OrxonoxGuiUpdate::downloadThread(void* fileInfo)
    319327{
    320 #ifdef HAVE_PTHREAD_H
    321   pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
    322   gdk_threads_enter();
    323 #endif /* HAVE_PTHREAD_H */
    324   FileInfo* info = (FileInfo*)fileInfo;
    325   info->stateButton->disconnectSignal(info->buttonSignal);
    326   info->buttonSignal = info->stateButton->connectSignal("button_press_event", info, cancelDownload);
    327 #ifdef HAVE_PTHREAD_H
    328   info->stateButton->setTitle("cancel");
    329   gdk_threads_leave();
    330 #else /* HAVE_PTHREAD_H */
    331   info->stateButton->setTitle("please wait");
    332 #endif /* HAVE_PTHREAD_H */
    333   pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
    334 
     328  isDownloading = true;
    335329  curl_easy_perform(curlHandle);
    336330}
  • orxonox/branches/updater/src/gui/orxonox_gui_update.h

    r3275 r3284  
    2424{
    2525 private:
    26   Frame* updateFrame;          //!< The Frame that holds the updateOptions.
    27   Box* updateBox;              //!< The Box that holds the updateOptions.
    28   CheckButton* autoUpdate;     //!< A Checkbutton to enable the automatic Updating.
     26  Frame* updateFrame;                   //!< The Frame that holds the updateOptions.
     27  Box* updateBox;                       //!< The Box that holds the updateOptions.
     28  CheckButton* autoUpdate;              //!< A Checkbutton to enable the automatic Updating.
    2929
    3030 
    31   Button* updateDataWindowButton;//!< A Button to update the Data of orxonox.
    32   Window* updateDataWindow;    //!< A Window for the data-update.
    33   Box* updateDataBox;          //!< A Box for the Window for the Data-update.
    34   ProgressBar* updateDataBar;  //!< A Bar to display the progress of the download.
    35   Button* updateDataBegin;     //!< A Button to start the process.
     31  Button* updateDataWindowButton;       //!< A Button to update the Data of orxonox.
     32  Window* updateDataWindow;             //!< A Window for the data-update.
     33  Box* updateDataBox;                   //!< A Box for the Window for the Data-update.
     34  ProgressBar* updateDataBar;           //!< A Bar to display the progress of the download.
     35  Button* updateDataBegin;              //!< A Button to start the process.
    3636
    37   Button* updateSourceWindowButton;//!< A Button to update the Source of orxonox. \todo tricky
    38   Window* updateSourceWindow;  //!< A Window for the Source-update.
    39   Box* updateSourceBox;  //!< A Box for the Window for the Source-update.
    40   ProgressBar* updateSourceBar;//!< A Bar to display the progress of the download.
     37  Button* updateSourceWindowButton;     //!< A Button to update the Source of orxonox. \todo tricky
     38  Window* updateSourceWindow;           //!< A Window for the Source-update.
     39  Box* updateSourceBox;                 //!< A Box for the Window for the Source-update.
     40  ProgressBar* updateSourceBar;         //!< A Bar to display the progress of the download.
    4141
    42   Button* test;  //!< will be deleted soon.
     42  Button* test;                         //!< will be deleted soon.
    4343 
    4444#ifdef HAVE_GTK2
     
    5151  struct FileInfo
    5252  {
    53     char* fileName;       //!< The Name of the file we want to get.
    54     char* webRoot;        //!< The Root of the File on The Web
    55     char* localRoot;      //!< The Root directory to put the files on the local disk.
    56     FILE* fileHandle;     //!< A fileHandler.
     53    char* fileName;                     //!< The Name of the file we want to get.
     54    char* webRoot;                      //!< The Root of the File on The Web
     55    char* localRoot;                    //!< The Root directory to put the files on the local disk.
     56    FILE* fileHandle;                   //!< A fileHandler.
    5757
    58     Button* stateButton;  //!< A button that shows either start or cancel;
    59     long int buttonSignal;//!< The Signal of the stateButton.
    60     ProgressBar* bar;     //!< The ProgressBar, that sould be updated.
     58    Button* stateButton;                //!< A button that shows either start or cancel;
     59    long int buttonSignal;              //!< The Signal of the stateButton.
     60    ProgressBar* bar;                   //!< The ProgressBar, that sould be updated.
    6161  };
    6262
     
    8888  Widget* getWidget ();
    8989 
    90   //  void updateWindowCreate (void);
    91   //  Button* updateWindowGetButton(void);
    92 
    9390  void updateDataWindowCreate (void);
    9491  Button* updateDataWindowGetButton(void);
Note: See TracChangeset for help on using the changeset viewer.