mirror of https://github.com/stella-emu/stella.git
Disable various URL buttons if using a version of SDL that doesn't support it.
This commit is contained in:
parent
ac51eb10ad
commit
9ad90d9f47
|
@ -181,9 +181,18 @@ class MediaFactory
|
|||
#endif
|
||||
}
|
||||
|
||||
static bool supportsURL()
|
||||
{
|
||||
#if defined(SDL_SUPPORT) && SDL_VERSION_ATLEAST(2, 0, 14)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool openURL(const string& url)
|
||||
{
|
||||
#if defined(SDL_SUPPORT)
|
||||
#if defined(SDL_SUPPORT) && SDL_VERSION_ATLEAST(2, 0, 14)
|
||||
return SDLOpenURL(url);
|
||||
#else
|
||||
return false;
|
||||
|
|
|
@ -302,9 +302,9 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id
|
|||
|
||||
case StaticTextWidget::kOpenUrlCmd:
|
||||
{
|
||||
const string url = myDesc[id]->getUrl();
|
||||
const string& url = myDesc[id]->getUrl();
|
||||
|
||||
if(url != EmptyString)
|
||||
if(url != EmptyString && MediaFactory::supportsURL())
|
||||
MediaFactory::openURL(url);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ void Dialog::initHelp()
|
|||
_helpWidget->setToolTip("Click or press " + key + " for help.");
|
||||
}
|
||||
|
||||
if(hasHelp())
|
||||
if(hasHelp() && MediaFactory::supportsURL())
|
||||
_helpWidget->clearFlags(Widget::FLAG_INVISIBLE);
|
||||
else
|
||||
_helpWidget->setFlags(Widget::FLAG_INVISIBLE);
|
||||
|
|
|
@ -1373,12 +1373,12 @@ void GameInfoDialog::eraseEEPROM()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameInfoDialog::updateLink()
|
||||
{
|
||||
const string link = myUrl->getText();
|
||||
const string& link = myUrl->getText();
|
||||
const bool enable = startsWithIgnoreCase(link, "http://")
|
||||
|| startsWithIgnoreCase(link, "https://")
|
||||
|| startsWithIgnoreCase(link, "www.");
|
||||
|
||||
myUrlButton->setEnabled(enable);
|
||||
myUrlButton->setEnabled(enable && MediaFactory::supportsURL());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -64,6 +64,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
|
|||
myUpdateButton =
|
||||
new ButtonWidget(this, font, xpos, ypos, updButtonWidth, buttonHeight,
|
||||
"Check for Update" + ELLIPSIS, kUpdateCmd);
|
||||
myUpdateButton->setEnabled(MediaFactory::supportsURL());
|
||||
wid.push_back(myUpdateButton);
|
||||
|
||||
xpos = _w - closeButtonWidth - HBORDER;
|
||||
|
|
|
@ -279,6 +279,7 @@ void LauncherDialog::addPathWidgets(int& ypos)
|
|||
buttonWidth, buttonHeight, helpIcon, kHelpCmd);
|
||||
const string key = instance().eventHandler().getMappingDesc(Event::UIHelp, EventMode::kMenuMode);
|
||||
myHelpButton->setToolTip("Click for help. (" + key + ")");
|
||||
myHelpButton->setEnabled(MediaFactory::supportsURL());
|
||||
wid.push_back(myHelpButton);
|
||||
}
|
||||
ypos += lineHeight + Dialog::vGap() * 2;
|
||||
|
@ -1108,7 +1109,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
|
||||
case RomInfoWidget::kClickedCmd:
|
||||
{
|
||||
const string url = myRomInfoWidget->getUrl();
|
||||
const string& url = myRomInfoWidget->getUrl();
|
||||
|
||||
if(url != EmptyString)
|
||||
MediaFactory::openURL(url);
|
||||
|
|
Loading…
Reference in New Issue