Some more autoupdater changes and a button to check for autoupdates

This commit is contained in:
def 2015-03-14 10:45:11 +01:00
parent 0e99b5c908
commit ba4f961594
5 changed files with 21 additions and 4 deletions

View file

@ -126,6 +126,8 @@ public:
// server info
virtual void GetServerInfo(class CServerInfo *pServerInfo) = 0;
virtual void CheckVersionUpdate() = 0;
// snapshot interface
enum

View file

@ -2475,6 +2475,11 @@ void CClient::VersionUpdate()
}
}
void CClient::CheckVersionUpdate()
{
m_VersionInfo.m_State = CVersionInfo::STATE_START;
}
void CClient::RegisterInterfaces()
{
Kernel()->RegisterInterface(static_cast<IDemoRecorder*>(&m_DemoRecorder[RECORDER_MANUAL]));

View file

@ -238,6 +238,7 @@ public:
const char *LatestVersion();
void VersionUpdate();
void CheckVersionUpdate();
// ------ state handling -----
void SetState(int s);

View file

@ -1314,10 +1314,10 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
if(State == IAutoUpdate::CLEAN && NeedUpdate)
{
CUIRect Update;
Part.VSplitLeft(50.0f, &Update, NULL);
Part.VSplitLeft(100.0f, &Update, NULL);
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();
}

View file

@ -1813,17 +1813,26 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView)
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, "Update Now", 0, &Button))
if(DoButton_Menu(&s_ButtonUpdate, "Update now", 0, &Button))
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...");
else if(State == IAutoUpdate::NEED_RESTART){
str_format(aBuf, sizeof(aBuf), "DDNet Client updated!");
m_NeedRestartUpdate = true;
}
else
{
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);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
}