mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 03:28:19 +00:00
Some more autoupdater changes and a button to check for autoupdates
This commit is contained in:
parent
0e99b5c908
commit
ba4f961594
|
@ -126,6 +126,8 @@ public:
|
||||||
// server info
|
// server info
|
||||||
virtual void GetServerInfo(class CServerInfo *pServerInfo) = 0;
|
virtual void GetServerInfo(class CServerInfo *pServerInfo) = 0;
|
||||||
|
|
||||||
|
virtual void CheckVersionUpdate() = 0;
|
||||||
|
|
||||||
// snapshot interface
|
// snapshot interface
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -2475,6 +2475,11 @@ void CClient::VersionUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClient::CheckVersionUpdate()
|
||||||
|
{
|
||||||
|
m_VersionInfo.m_State = CVersionInfo::STATE_START;
|
||||||
|
}
|
||||||
|
|
||||||
void CClient::RegisterInterfaces()
|
void CClient::RegisterInterfaces()
|
||||||
{
|
{
|
||||||
Kernel()->RegisterInterface(static_cast<IDemoRecorder*>(&m_DemoRecorder[RECORDER_MANUAL]));
|
Kernel()->RegisterInterface(static_cast<IDemoRecorder*>(&m_DemoRecorder[RECORDER_MANUAL]));
|
||||||
|
|
|
@ -238,6 +238,7 @@ public:
|
||||||
|
|
||||||
const char *LatestVersion();
|
const char *LatestVersion();
|
||||||
void VersionUpdate();
|
void VersionUpdate();
|
||||||
|
void CheckVersionUpdate();
|
||||||
|
|
||||||
// ------ state handling -----
|
// ------ state handling -----
|
||||||
void SetState(int s);
|
void SetState(int s);
|
||||||
|
|
|
@ -1314,10 +1314,10 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
|
||||||
if(State == IAutoUpdate::CLEAN && NeedUpdate)
|
if(State == IAutoUpdate::CLEAN && NeedUpdate)
|
||||||
{
|
{
|
||||||
CUIRect Update;
|
CUIRect Update;
|
||||||
Part.VSplitLeft(50.0f, &Update, NULL);
|
Part.VSplitLeft(100.0f, &Update, NULL);
|
||||||
|
|
||||||
static int s_ButtonUpdate = 0;
|
static int s_ButtonUpdate = 0;
|
||||||
if(DoButton_Menu(&s_ButtonUpdate, Localize("Update"), 0, &Update))
|
if(DoButton_Menu(&s_ButtonUpdate, Localize("Update now"), 0, &Update))
|
||||||
{
|
{
|
||||||
AutoUpdate()->InitiateUpdate();
|
AutoUpdate()->InitiateUpdate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1813,17 +1813,26 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView)
|
||||||
Label.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1) + 10.0f, &Label, &Button);
|
Label.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1) + 10.0f, &Label, &Button);
|
||||||
Button.VSplitLeft(100.0f, &Button, 0);
|
Button.VSplitLeft(100.0f, &Button, 0);
|
||||||
static int s_ButtonUpdate = 0;
|
static int s_ButtonUpdate = 0;
|
||||||
if(DoButton_Menu(&s_ButtonUpdate, "Update Now", 0, &Button))
|
if(DoButton_Menu(&s_ButtonUpdate, "Update now", 0, &Button))
|
||||||
AutoUpdate()->InitiateUpdate();
|
AutoUpdate()->InitiateUpdate();
|
||||||
}
|
}
|
||||||
else if(State >= IAutoUpdate::CLEAN && State < IAutoUpdate::NEED_RESTART)
|
else if(State >= IAutoUpdate::GETTING_MANIFEST && State < IAutoUpdate::NEED_RESTART)
|
||||||
str_format(aBuf, sizeof(aBuf), "Updating...");
|
str_format(aBuf, sizeof(aBuf), "Updating...");
|
||||||
else if(State == IAutoUpdate::NEED_RESTART){
|
else if(State == IAutoUpdate::NEED_RESTART){
|
||||||
str_format(aBuf, sizeof(aBuf), "DDNet Client updated!");
|
str_format(aBuf, sizeof(aBuf), "DDNet Client updated!");
|
||||||
m_NeedRestartUpdate = true;
|
m_NeedRestartUpdate = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), "No updates available");
|
str_format(aBuf, sizeof(aBuf), "No updates available");
|
||||||
|
Label.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1) + 10.0f, &Label, &Button);
|
||||||
|
Button.VSplitLeft(100.0f, &Button, 0);
|
||||||
|
static int s_ButtonUpdate = 0;
|
||||||
|
if(DoButton_Menu(&s_ButtonUpdate, "Check now", 0, &Button))
|
||||||
|
{
|
||||||
|
Client()->CheckVersionUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
|
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue