Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/updater/src/gui/orxonox_gui_update.h @ 3275

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

orxonox/branches/updater: doxygen tags

File size: 3.3 KB
Line 
1/*!
2  \file orxonox_gui_update.h
3  \brief File that holds the class that creates the update-menu.
4*/
5
6#ifndef _ORXONOX_GUI_UPDATE_H
7#define _ORXONOX_GUI_UPDATE_H
8
9#include "orxonox_gui.h"
10#include <stdio.h>
11#ifdef HAVE_CURL
12#include <curl/curl.h>
13#include <curl/types.h>
14#include <curl/easy.h>
15#endif /* HAVE_CURL */
16#ifdef HAVE_PTHREAD_H
17#define _MULTI_THREADED
18#include <pthread.h>
19#endif /* HAVE_PTHREAD_H */
20using namespace std;
21
22//! Class that creates the execute-Options.
23class OrxonoxGuiUpdate
24{
25 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.
29
30 
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.
36
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.
41
42  Button* test;  //!< will be deleted soon.
43 
44#ifdef HAVE_GTK2
45  static gint updateDataFunc (GtkWidget* w, GdkEventKey* event, void* info);
46  static gint updateSourceFunc (GtkWidget* w, GdkEventKey* event, void* info);
47#endif /* HAVE_GTK2 */
48
49#ifdef HAVE_CURL
50  //! A Struct to hold information about one File to download.
51  struct FileInfo
52  {
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.
57
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.
61  };
62
63  static size_t curlWriteFunc (void* ptr, size_t size, size_t nmemb, FILE* stream);
64  static size_t curlReadFunc (void* ptr, size_t size, size_t nmemb, FILE* stream);
65  static int curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress);
66
67  static CURL* curlHandle;
68#ifdef HAVE_GTK2
69  static gint cancelDownload(GtkWidget* w, GdkEventKey* event, void* bar);
70#endif /* HAVE_GTK2 */ 
71#ifdef HAVE_PTHREAD_H
72  static pthread_t* downloadThreadID;
73  static pthread_t* downloadThreadFinishID;
74#endif /* HAVE_PTHREAD_H */
75  static bool isDownloading;
76
77  static bool download (void* fileInfo);
78  static void* downloadThread (void* fileInfo);
79  static void* downloadThreadFinished(void* fileInfo);
80
81 
82#endif /* HAVE_CURL */
83
84 public:
85  OrxonoxGuiUpdate ();
86  ~OrxonoxGuiUpdate ();
87 
88  Widget* getWidget ();
89 
90  //  void updateWindowCreate (void);
91  //  Button* updateWindowGetButton(void);
92
93  void updateDataWindowCreate (void);
94  Button* updateDataWindowGetButton(void);
95
96  void updateSourceWindowCreate (void);
97  Button* updateSourceWindowGetButton(void);
98};
99
100
101
102#endif /* _ORXONOX_GUI_UPDATE_H */
Note: See TracBrowser for help on using the repository browser.