added 'What's New' button to 'About' dialog

This commit is contained in:
thrust26 2020-07-29 15:52:50 +02:00
parent fae33a71b5
commit b3cd562046
3 changed files with 24 additions and 2 deletions

View File

@ -20,6 +20,8 @@
#include "Version.hxx"
#include "Widget.hxx"
#include "Font.hxx"
#include "WhatsNewDialog.hxx"
#include "AboutDialog.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -64,11 +66,17 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
wid.push_back(b);
addCancelWidget(b);
xpos = HBORDER; ypos = _th + VBORDER;
xpos = HBORDER; ypos = _th + VBORDER + (buttonHeight - fontHeight) / 2;
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - xpos * 2, fontHeight,
"", TextAlign::Center);
myTitle->setTextColor(kTextColorEm);
int bwidth = font.getStringWidth("What's New" + ELLIPSIS) + fontWidth * 2.5;
myWhatsNewButton =
new ButtonWidget(this, font, _w - HBORDER - bwidth, ypos - (buttonHeight - fontHeight) / 2,
bwidth, buttonHeight, "What's New" + ELLIPSIS, kWhatsNew);
wid.push_back(myWhatsNewButton);
xpos = HBORDER * 2; ypos += lineHeight + VGAP * 2;
for(int i = 0; i < myLinesPerPage; i++)
{
@ -258,6 +266,13 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id
displayInfo();
break;
case kWhatsNew:
if(myWhatsNewDialog == nullptr)
myWhatsNewDialog = make_unique<WhatsNewDialog>(instance(), parent(), _font,
640 * 0.95, 480 * 0.95);
myWhatsNewDialog->open();
break;
default:
Dialog::handleCommand(sender, cmd, data, 0);
}

View File

@ -23,6 +23,7 @@ class DialogContainer;
class CommandSender;
class ButtonWidget;
class StaticTextWidget;
class WhatsNewDialog;
#include "Dialog.hxx"
@ -41,6 +42,7 @@ class AboutDialog : public Dialog
void loadConfig() override { displayInfo(); }
private:
ButtonWidget* myWhatsNewButton{nullptr};
ButtonWidget* myNextButton{nullptr};
ButtonWidget* myPrevButton{nullptr};
@ -52,6 +54,12 @@ class AboutDialog : public Dialog
int myNumPages{4};
int myLinesPerPage{13};
unique_ptr<WhatsNewDialog> myWhatsNewDialog;
enum {
kWhatsNew = 'ADWN'
};
private:
// Following constructors and assignment operators not supported
AboutDialog() = delete;

View File

@ -132,7 +132,6 @@ class LauncherDialog : public Dialog
unique_ptr<GlobalPropsDialog> myGlobalProps;
unique_ptr<BrowserDialog> myRomDir;
unique_ptr<WhatsNewDialog> myWhatsNewDialog;
unique_ptr<GUI::MessageBox> myWhatsNewMsg;
// automatically sized font for ROM info viewer
unique_ptr<GUI::Font> myROMInfoFont;