Show version info in update prompt. Fixes #177
This commit is contained in:
parent
f7f51d5045
commit
a11cd592cb
@ -12,7 +12,7 @@
|
|||||||
#include "PowderToy.h"
|
#include "PowderToy.h"
|
||||||
|
|
||||||
ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDialogueCallback * callback_):
|
ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDialogueCallback * callback_):
|
||||||
ui::Window(ui::Point(-1, -1), ui::Point(250, 50)),
|
ui::Window(ui::Point(-1, -1), ui::Point(250, 35)),
|
||||||
callback(callback_)
|
callback(callback_)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
|
@ -1226,7 +1226,24 @@ void GameController::NotifyUpdateAvailable(Client * sender)
|
|||||||
|
|
||||||
virtual void Action()
|
virtual void Action()
|
||||||
{
|
{
|
||||||
new ConfirmPrompt("Run Updater", "Are you sure you want to run the updater, please save any changes before updating", new UpdateConfirmation(c));
|
std::string currentVersion, newVersion;
|
||||||
|
#ifdef BETA
|
||||||
|
currentVersion = MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) " Beta, Build " MTOS(BUILD_NUM);
|
||||||
|
#elif defined(SNAPSHOT)
|
||||||
|
currentVersion = "Snapshot " MTOS(SNAPSHOT_ID);
|
||||||
|
#else
|
||||||
|
currentVersion = MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) " Stable, Build " MTOS(BUILD_NUM);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UpdateInfo info = Client::Ref().GetUpdateInfo();
|
||||||
|
if(info.Type == UpdateInfo::Beta)
|
||||||
|
newVersion = format::NumberToString<int>(info.Major) + " " + format::NumberToString<int>(info.Minor) + " Beta, Build " + format::NumberToString<int>(info.Build);
|
||||||
|
else if(info.Type == UpdateInfo::Snapshot)
|
||||||
|
newVersion = "Snapshot " + format::NumberToString<int>(info.Time);
|
||||||
|
else if(info.Type == UpdateInfo::Stable)
|
||||||
|
newVersion = format::NumberToString<int>(info.Major) + " " + format::NumberToString<int>(info.Minor) + " Stable, Build " + format::NumberToString<int>(info.Build);
|
||||||
|
|
||||||
|
new ConfirmPrompt("Run Updater", "Are you sure you want to run the updater, please save any changes before updating.\n\nCurrent version:\n " + currentVersion + "\nNew version:\n " + newVersion, new UpdateConfirmation(c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ namespace ui
|
|||||||
pixel * lastBuffer;
|
pixel * lastBuffer;
|
||||||
std::stack<pixel*> prevBuffers;
|
std::stack<pixel*> prevBuffers;
|
||||||
std::stack<Window*> windows;
|
std::stack<Window*> windows;
|
||||||
|
std::stack<Point> mousePositions;
|
||||||
//Window* statequeued_;
|
//Window* statequeued_;
|
||||||
Window* state_;
|
Window* state_;
|
||||||
Point windowTargetPosition;
|
Point windowTargetPosition;
|
||||||
|
@ -80,11 +80,17 @@ void Label::updateMultiline()
|
|||||||
char * lastSpace = NULL;
|
char * lastSpace = NULL;
|
||||||
char * currentWord = rawText;
|
char * currentWord = rawText;
|
||||||
char * nextSpace;
|
char * nextSpace;
|
||||||
|
char oldChar;
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
nextSpace = strchr(currentWord+1, ' ');
|
nextSpace = strchr(currentWord+1, ' ');
|
||||||
|
if(nextSpace > strchr(currentWord+1, '\n'))
|
||||||
|
nextSpace = strchr(currentWord+1, '\n');
|
||||||
if(nextSpace)
|
if(nextSpace)
|
||||||
|
{
|
||||||
|
oldChar = nextSpace[0];
|
||||||
nextSpace[0] = 0;
|
nextSpace[0] = 0;
|
||||||
|
}
|
||||||
int width = Graphics::textwidth(currentWord);
|
int width = Graphics::textwidth(currentWord);
|
||||||
if(width+currentWidth >= Size.X-(Appearance.Margin.Left+Appearance.Margin.Right))
|
if(width+currentWidth >= Size.X-(Appearance.Margin.Left+Appearance.Margin.Right))
|
||||||
{
|
{
|
||||||
@ -95,10 +101,15 @@ void Label::updateMultiline()
|
|||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(oldChar == '\n')
|
||||||
|
{
|
||||||
|
currentWidth = width;
|
||||||
|
lines++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
currentWidth += width;
|
currentWidth += width;
|
||||||
if(nextSpace)
|
if(nextSpace)
|
||||||
nextSpace[0] = ' ';
|
nextSpace[0] = oldChar;
|
||||||
if(!currentWord[0] || !currentWord[1] || !(currentWord = strchr(currentWord+1, ' ')))
|
if(!currentWord[0] || !currentWord[1] || !(currentWord = strchr(currentWord+1, ' ')))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user