mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-02 08:19:19 +00:00
GUI: Add SaveLoadCloudSyncProgress in ScummModern theme
ScummVM would probably crash when using a theme without SaveLoadCloudSyncProgress dialog described.
This commit is contained in:
parent
b614869de8
commit
f5cb5be393
@ -216,7 +216,7 @@ void GuiManager::redraw() {
|
||||
// Tanoku: Do not apply shading more than once when opening many dialogs
|
||||
// on top of each other. Screen ends up being too dark and it's a
|
||||
// performance hog.
|
||||
if (_redrawStatus == kRedrawOpenDialog && _dialogStack.size() > 2)
|
||||
if (_redrawStatus == kRedrawOpenDialog && _dialogStack.size() > 3)
|
||||
shading = ThemeEngine::kShadingNone;
|
||||
|
||||
switch (_redrawStatus) {
|
||||
|
@ -44,47 +44,16 @@ enum {
|
||||
kBackgroundSyncCmd = 'PDBS'
|
||||
};
|
||||
|
||||
SaveLoadCloudSyncProgressDialog::SaveLoadCloudSyncProgressDialog(): Dialog(0,0,0,0), _close(false) {
|
||||
const int screenW = g_system->getOverlayWidth();
|
||||
const int screenH = g_system->getOverlayHeight();
|
||||
|
||||
int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0) * 1.4; // "Run in background" is too long
|
||||
int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
|
||||
int progressBarHeight = buttonHeight;
|
||||
|
||||
int marginAround = 8;
|
||||
int marginBottom = 8;
|
||||
int marginBetween = 10;
|
||||
|
||||
_w = screenW * 80 / 100;
|
||||
_h = 0;
|
||||
_h += buttonHeight + marginBottom; //buttons
|
||||
_h += 2 * (kLineHeight + 2 * marginAround); //top label + bottom label
|
||||
_h += progressBarHeight; //progress bar
|
||||
if (_h > screenH) _h = screenH;
|
||||
|
||||
// Center the dialog
|
||||
_x = (screenW - _w) / 2;
|
||||
_y = (screenH - _h) / 2;
|
||||
|
||||
_label = new StaticTextWidget(this, marginAround, marginAround, _w - marginAround * 2, kLineHeight, "Downloading saves...", Graphics::kTextAlignCenter);
|
||||
|
||||
SaveLoadCloudSyncProgressDialog::SaveLoadCloudSyncProgressDialog(): Dialog("SaveLoadCloudSyncProgress"), _close(false) {
|
||||
_label = new StaticTextWidget(this, "SaveLoadCloudSyncProgress.TitleText", "Downloading saves...");
|
||||
uint32 progress = (uint32)(100 * CloudMan.getSyncDownloadingProgress());
|
||||
_progressBar = new SliderWidget(this, marginAround, marginAround * 2 + kLineHeight, _w - marginAround * 2, progressBarHeight);
|
||||
_progressBar = new SliderWidget(this, "SaveLoadCloudSyncProgress.ProgressBar");
|
||||
_progressBar->setMinValue(0);
|
||||
_progressBar->setMaxValue(100);
|
||||
_progressBar->setValue(progress);
|
||||
|
||||
_percentLabel = new StaticTextWidget(this, marginAround, marginAround * 3 + kLineHeight + progressBarHeight, _w - marginAround * 2, kLineHeight, Common::String::format("%u %%", progress), Graphics::kTextAlignCenter);
|
||||
|
||||
int x1 = (_w - buttonWidth * 2 - marginBetween) / 2;
|
||||
int x2 = x1 + buttonWidth + marginBetween;
|
||||
|
||||
//if (defaultButton)
|
||||
new ButtonWidget(this, x1, _h - buttonHeight - marginBottom, buttonWidth, buttonHeight, "Cancel", 0, kCancelSyncCmd, Common::ASCII_ESCAPE); // Cancel dialog
|
||||
|
||||
//if (altButton)
|
||||
new ButtonWidget(this, x2, _h - buttonHeight - marginBottom, buttonWidth, buttonHeight, "Run in background", 0, kBackgroundSyncCmd, Common::ASCII_RETURN); // Confirm dialog
|
||||
_percentLabel = new StaticTextWidget(this, "SaveLoadCloudSyncProgress.PercentText", Common::String::format("%u %%", progress));
|
||||
new ButtonWidget(this, "SaveLoadCloudSyncProgress.Cancel", "Cancel", 0, kCancelSyncCmd, Common::ASCII_ESCAPE); // Cancel dialog
|
||||
new ButtonWidget(this, "SaveLoadCloudSyncProgress.Background", "Run in background", 0, kBackgroundSyncCmd, Common::ASCII_RETURN); // Confirm dialog
|
||||
}
|
||||
|
||||
SaveLoadCloudSyncProgressDialog::~SaveLoadCloudSyncProgressDialog() {}
|
||||
|
@ -1056,6 +1056,38 @@
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
<dialog name = 'SaveLoadCloudSyncProgress' overlays = 'screen_center' inset = '8' shading = 'dim'>
|
||||
<layout type = 'vertical' padding = '8, 8, 8, 8' center = 'true'>
|
||||
<widget name = 'TitleText'
|
||||
width = '496'
|
||||
height = 'Globals.Line.Height'
|
||||
textalign = 'center'
|
||||
/>
|
||||
<space size = '1'/>
|
||||
<widget name = 'ProgressBar'
|
||||
width = '496'
|
||||
height = 'Globals.Button.Height'
|
||||
/>
|
||||
<space size = '1'/>
|
||||
<widget name = 'PercentText'
|
||||
width = '496'
|
||||
height = 'Globals.Line.Height'
|
||||
textalign = 'center'
|
||||
/>
|
||||
<space size = '1'/>
|
||||
<layout type = 'horizontal' padding = '0, 0, 0, 0' center = 'true' spacing = '10'>
|
||||
<widget name = 'Cancel'
|
||||
width = '150'
|
||||
height = 'Globals.Button.Height'
|
||||
/>
|
||||
<widget name = 'Background'
|
||||
width = '150'
|
||||
height = 'Globals.Button.Height'
|
||||
/>
|
||||
</layout>
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
<dialog name = 'SavenameDialog' overlays = 'screen_center'>
|
||||
<layout type = 'vertical' padding = '8, 8, 8, 8'>
|
||||
<widget name = 'DescriptionText'
|
||||
|
@ -1038,6 +1038,38 @@
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
<dialog name = 'SaveLoadCloudSyncProgress' overlays = 'screen_center' inset = '8' shading = 'dim'>
|
||||
<layout type = 'vertical' padding = '8, 8, 8, 8' center = 'true'>
|
||||
<widget name = 'TitleText'
|
||||
width = '240'
|
||||
height = 'Globals.Line.Height'
|
||||
textalign = 'center'
|
||||
/>
|
||||
<space size = '1'/>
|
||||
<widget name = 'ProgressBar'
|
||||
width = '240'
|
||||
height = 'Globals.Button.Height'
|
||||
/>
|
||||
<space size = '1'/>
|
||||
<widget name = 'PercentText'
|
||||
width = '240'
|
||||
height = 'Globals.Line.Height'
|
||||
textalign = 'center'
|
||||
/>
|
||||
<space size = '1'/>
|
||||
<layout type = 'horizontal' padding = '0, 0, 0, 0' center = 'true' spacing = '10'>
|
||||
<widget name = 'Cancel'
|
||||
width = '100'
|
||||
height = 'Globals.Button.Height'
|
||||
/>
|
||||
<widget name = 'Background'
|
||||
width = '100'
|
||||
height = 'Globals.Button.Height'
|
||||
/>
|
||||
</layout>
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
<dialog name = 'SavenameDialog' overlays = 'screen_center'>
|
||||
<layout type = 'vertical' padding = '8, 8, 8, 8'>
|
||||
<widget name = 'DescriptionText'
|
||||
|
Loading…
x
Reference in New Issue
Block a user