OpenClonk
C4UpdateDlg.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2007-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2010-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 // dialogs for update
17 
18 #ifndef INC_C4UpdateDialogs
19 #define INC_C4UpdateDialogs
20 
21 #ifdef WITH_AUTOMATIC_UPDATE
22 
23 #include "game/C4GameVersion.h"
24 #include "gui/C4Gui.h"
26 
27 // dialog showing info about a connected client
28 class C4UpdateDlg : public C4GUI::InfoDialog
29 {
30 protected:
31  virtual const char *GetID() { return "UpdateDialog"; }
32  virtual void UpdateText();
33  virtual void UserClose(bool fOK);
34 
35  bool UpdateRunning;
36 
37  // Misc process variables which are shared between the static DoUpdate and the update dialog
38  static int pid;
39  static int c4group_output[2];
40  static bool succeeded;
41 
42 public:
43  C4UpdateDlg(); // ctor
44 
45 public:
46  void Open(C4GUI::Screen *pScreen);
47  void Write(const char *szText);
48 
49 public:
50  static bool IsValidUpdate(const char *szVersion); // Returns whether we can update to the specified version
51  static bool CheckForUpdates(C4GUI::Screen *pScreen, bool fAutomatic = false); // Checks for available updates and prompts the user whether to apply
52  static bool DoUpdate(const char *szUpdateURL, C4GUI::Screen *pScreen); // Static funtion for downloading and applying updates
53  static bool ApplyUpdate(const char *strUpdateFile, bool fDeleteUpdate, C4GUI::Screen *pScreen); // Static funtion for applying updates
54  static void RedirectToDownloadPage(); // open browser with download page
55 };
56 
57 #endif // WITH_AUTOMATIC_UPDATE
58 #endif // INC_C4UpdateDialogs
virtual void UserClose(bool fOK)
Definition: C4Gui.h:2207
virtual const char * GetID()
Definition: C4Gui.h:2108
virtual void UpdateText()
Definition: C4Gui.h:2446