2009-05-08 13:28:41 +00:00
|
|
|
/*
|
|
|
|
* OpenClonk, http://www.openclonk.org
|
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* Copyright (c) 2007-2009, RedWolf Design GmbH, http://www.clonk.de/
|
2016-04-03 18:18:29 +00:00
|
|
|
* Copyright (c) 2010-2016, The OpenClonk Team and contributors
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* Distributed under the terms of the ISC license; see accompanying file
|
|
|
|
* "COPYING" for details.
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
|
|
|
|
* See accompanying file "TRADEMARK" for details.
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* To redistribute this file separately, substitute the full license texts
|
|
|
|
* for the above references.
|
2009-05-08 13:28:41 +00:00
|
|
|
*/
|
|
|
|
// dialogs for update
|
|
|
|
|
|
|
|
#ifndef INC_C4UpdateDialogs
|
|
|
|
#define INC_C4UpdateDialogs
|
|
|
|
|
2010-12-26 20:39:52 +00:00
|
|
|
#ifdef WITH_AUTOMATIC_UPDATE
|
|
|
|
|
2016-04-03 18:07:56 +00:00
|
|
|
#include "game/C4GameVersion.h"
|
2017-04-30 08:49:09 +00:00
|
|
|
#include "gui/C4Gui.h"
|
2016-04-03 18:07:56 +00:00
|
|
|
#include "network/C4Network2Reference.h"
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
// dialog showing info about a connected client
|
|
|
|
class C4UpdateDlg : public C4GUI::InfoDialog
|
2010-03-28 17:58:21 +00:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
virtual const char *GetID() { return "UpdateDialog"; }
|
|
|
|
virtual void UpdateText();
|
|
|
|
virtual void UserClose(bool fOK);
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2010-03-28 17:58:21 +00:00
|
|
|
bool UpdateRunning;
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2010-03-28 17:58:21 +00:00
|
|
|
// Misc process variables which are shared between the static DoUpdate and the update dialog
|
|
|
|
static int pid;
|
|
|
|
static int c4group_output[2];
|
|
|
|
static bool succeeded;
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2010-03-28 17:58:21 +00:00
|
|
|
public:
|
|
|
|
C4UpdateDlg(); // ctor
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2010-03-28 17:58:21 +00:00
|
|
|
public:
|
|
|
|
void Open(C4GUI::Screen *pScreen);
|
|
|
|
void Write(const char *szText);
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2010-03-28 17:58:21 +00:00
|
|
|
public:
|
2010-12-26 23:31:25 +00:00
|
|
|
static bool IsValidUpdate(const char *szVersion); // Returns whether we can update to the specified version
|
2010-03-28 17:58:21 +00:00
|
|
|
static bool CheckForUpdates(C4GUI::Screen *pScreen, bool fAutomatic = false); // Checks for available updates and prompts the user whether to apply
|
2010-12-01 20:37:47 +00:00
|
|
|
static bool DoUpdate(const char *szUpdateURL, C4GUI::Screen *pScreen); // Static funtion for downloading and applying updates
|
2010-03-28 17:58:21 +00:00
|
|
|
static bool ApplyUpdate(const char *strUpdateFile, bool fDeleteUpdate, C4GUI::Screen *pScreen); // Static funtion for applying updates
|
2010-12-26 23:31:25 +00:00
|
|
|
static void RedirectToDownloadPage(); // open browser with download page
|
2010-03-28 17:58:21 +00:00
|
|
|
};
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2010-12-26 20:39:52 +00:00
|
|
|
#endif // WITH_AUTOMATIC_UPDATE
|
2009-05-08 13:28:41 +00:00
|
|
|
#endif // INC_C4UpdateDialogs
|