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 | using namespace std; |
---|
12 | |
---|
13 | //! Class that creates the execute-Options. |
---|
14 | class OrxonoxGuiUpdate |
---|
15 | { |
---|
16 | private: |
---|
17 | Frame* updateFrame; //!< The Frame that holds the updateOptions. |
---|
18 | Box* updateBox; //!< The Box that holds the updateOptions. |
---|
19 | CheckButton* autoUpdate; //!< A Checkbutton to enable the automatic Updating. |
---|
20 | |
---|
21 | |
---|
22 | Button* updateDataWindowButton;//!< A Button to update the Data of orxonox. |
---|
23 | Window* updateDataWindow; //!< A Window for the data-update. |
---|
24 | Box* updateDataBox; //!< A Box for the Window for the Data-update. |
---|
25 | ProgressBar* updateDataBar; //!< A Bar to display the progress of the download. |
---|
26 | Button* updateDataBegin; //!< A Button to start the process. |
---|
27 | |
---|
28 | Button* updateSourceWindowButton;//!< A Button to update the Source of orxonox. \todo tricky |
---|
29 | Window* updateSourceWindow; //!< A Window for the Source-update. |
---|
30 | Box* updateSourceBox; //!< A Box for the Window for the Source-update. |
---|
31 | ProgressBar* updateSourceBar;//!< A Bar to display the progress of the download. |
---|
32 | |
---|
33 | Button* test; //!< will be deleted soon. |
---|
34 | |
---|
35 | #ifdef HAVE_GTK2 |
---|
36 | static gint updateDataFunc (GtkWidget* w, GdkEventKey* event, void* bar); |
---|
37 | static gint updateSourceFunc (GtkWidget* w, GdkEventKey* event, void* bar); |
---|
38 | #endif /* HAVE_GTK2 */ |
---|
39 | |
---|
40 | #ifdef HAVE_CURL |
---|
41 | //! A Struct to hold information about one File to download. |
---|
42 | struct FileInfo |
---|
43 | { |
---|
44 | char* fileName; //!< The Name of the file we want to get. |
---|
45 | char* webRoot; //!< The Root of the File on The Web |
---|
46 | char* localRoot; //!< The Root directory to put the files on the local disk. |
---|
47 | |
---|
48 | ProgressBar* Bar; //!< The ProgressBar, that sould be updated. |
---|
49 | }; |
---|
50 | |
---|
51 | static size_t curlWriteFunc (void* ptr, size_t size, size_t nmemb, FILE* stream); |
---|
52 | static size_t curlReadFunc (void* ptr, size_t size, size_t nmemb, FILE* stream); |
---|
53 | static int curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress); |
---|
54 | |
---|
55 | static GThread* downloadThreadID; |
---|
56 | static void* downloadThread (void* fileInfo); |
---|
57 | |
---|
58 | #endif /* HAVE_CURL */ |
---|
59 | |
---|
60 | public: |
---|
61 | OrxonoxGuiUpdate (); |
---|
62 | ~OrxonoxGuiUpdate (); |
---|
63 | |
---|
64 | Widget* getWidget (); |
---|
65 | |
---|
66 | void updateWindowCreate (void); |
---|
67 | Button* updateWindowGetButton(void); |
---|
68 | |
---|
69 | void updateDataWindowCreate (void); |
---|
70 | Button* updateDataWindowGetButton(void); |
---|
71 | |
---|
72 | void updateSourceWindowCreate (void); |
---|
73 | Button* updateSourceWindowGetButton(void); |
---|
74 | }; |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | #endif /* _ORXONOX_GUI_UPDATE_H */ |
---|