ToolMap
Loading...
Searching...
No Matches
update.h
1/***************************************************************************
2 update.h
3 Deals with update process by cheking internet for new versions
4 -------------------
5 copyright : (C) 2009 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8#ifndef _WEBUPDATE_H_
9#define _WEBUPDATE_H_
10
11// For compilers that support precompilation, includes "wx/wx.h".
12#include <wx/wxprec.h>
13
14// Include wxWidgets' headers
15#ifndef WX_PRECOMP
16#include <wx/wx.h>
17#endif
18
19#include <curl/curl.h> // for web acces
20#include <wx/infobar.h>
21#include <wx/sstream.h>
22
23const long WEBUPDATE_CONNECTION_TIMEOUT = 2000;
24const wxString WEBUPDATE_SERVER_DOWNLOAD = "http://www.toolmap.ch";
25const wxString WEBUPDATE_SERVER_UPDATE = "https://www.terranum.ch/toolmap/latestversion2.txt";
26
27const int INFOBAR_DOWNLOAD_BUTTON = wxID_HIGHEST + 10;
28
29class WebUpdateInformationBar : public wxInfoBar {
30 private:
31 wxWindow* m_Parent;
32
33 void _ClearBar();
34
35 void OnCommandDownload(wxCommandEvent& event);
36
37 void OnInternetFailed(wxThreadEvent& event);
38
39 void OnNewVersion(wxThreadEvent& event);
40
41 void OnNoNewVersion(wxThreadEvent& event);
42
43 DECLARE_EVENT_TABLE();
44
45 public:
46 WebUpdateInformationBar(wxWindow* parent);
47
49};
50
51// CALLBACK FOR CURL
52size_t wxcurl_str_write(void* ptr, size_t size, size_t nmemb, void* stream);
53
54const int THREAD_MESSAGE_NEW_VERSION = wxID_HIGHEST + 11;
55const int THREAD_MESSAGE_NONEW_VERSION = wxID_HIGHEST + 12;
56const int THREAD_MESSAGE_NO_INTERNET = wxID_HIGHEST + 13;
57
58class WebUpdateThread : public wxThread {
59 private:
60 CURL* m_CurlHandle;
61 wxWindow* m_Parent;
62 wxStringOutputStream m_Buffer;
63
64 bool m_msgNewVersion;
65 bool m_msgNoNewVersion;
66 bool m_msgNoInternet;
67
68 long m_ActualVersion;
69
70 protected:
71 virtual ExitCode Entry();
72
73 public:
74 WebUpdateThread(wxWindow* parent, const wxString& proxy = wxEmptyString);
75
76 virtual ~WebUpdateThread();
77
78 bool CheckNewVersion(long actualversion, bool msgNewVersion = true, bool msgNoNewVersion = true,
79 bool msgNoInternet = true);
80};
81
82#endif
Definition update.h:29
Definition update.h:58