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
|
#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)
|
static bool openURL(const string& url)
|
||||||
{
|
{
|
||||||
#if defined(SDL_SUPPORT)
|
#if defined(SDL_SUPPORT) && SDL_VERSION_ATLEAST(2, 0, 14)
|
||||||
return SDLOpenURL(url);
|
return SDLOpenURL(url);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -302,9 +302,9 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id
|
||||||
|
|
||||||
case StaticTextWidget::kOpenUrlCmd:
|
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);
|
MediaFactory::openURL(url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ void Dialog::initHelp()
|
||||||
_helpWidget->setToolTip("Click or press " + key + " for help.");
|
_helpWidget->setToolTip("Click or press " + key + " for help.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasHelp())
|
if(hasHelp() && MediaFactory::supportsURL())
|
||||||
_helpWidget->clearFlags(Widget::FLAG_INVISIBLE);
|
_helpWidget->clearFlags(Widget::FLAG_INVISIBLE);
|
||||||
else
|
else
|
||||||
_helpWidget->setFlags(Widget::FLAG_INVISIBLE);
|
_helpWidget->setFlags(Widget::FLAG_INVISIBLE);
|
||||||
|
|
|
@ -1373,12 +1373,12 @@ void GameInfoDialog::eraseEEPROM()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void GameInfoDialog::updateLink()
|
void GameInfoDialog::updateLink()
|
||||||
{
|
{
|
||||||
const string link = myUrl->getText();
|
const string& link = myUrl->getText();
|
||||||
const bool enable = startsWithIgnoreCase(link, "http://")
|
const bool enable = startsWithIgnoreCase(link, "http://")
|
||||||
|| startsWithIgnoreCase(link, "https://")
|
|| startsWithIgnoreCase(link, "https://")
|
||||||
|| startsWithIgnoreCase(link, "www.");
|
|| startsWithIgnoreCase(link, "www.");
|
||||||
|
|
||||||
myUrlButton->setEnabled(enable);
|
myUrlButton->setEnabled(enable && MediaFactory::supportsURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -64,6 +64,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
myUpdateButton =
|
myUpdateButton =
|
||||||
new ButtonWidget(this, font, xpos, ypos, updButtonWidth, buttonHeight,
|
new ButtonWidget(this, font, xpos, ypos, updButtonWidth, buttonHeight,
|
||||||
"Check for Update" + ELLIPSIS, kUpdateCmd);
|
"Check for Update" + ELLIPSIS, kUpdateCmd);
|
||||||
|
myUpdateButton->setEnabled(MediaFactory::supportsURL());
|
||||||
wid.push_back(myUpdateButton);
|
wid.push_back(myUpdateButton);
|
||||||
|
|
||||||
xpos = _w - closeButtonWidth - HBORDER;
|
xpos = _w - closeButtonWidth - HBORDER;
|
||||||
|
|
|
@ -279,6 +279,7 @@ void LauncherDialog::addPathWidgets(int& ypos)
|
||||||
buttonWidth, buttonHeight, helpIcon, kHelpCmd);
|
buttonWidth, buttonHeight, helpIcon, kHelpCmd);
|
||||||
const string key = instance().eventHandler().getMappingDesc(Event::UIHelp, EventMode::kMenuMode);
|
const string key = instance().eventHandler().getMappingDesc(Event::UIHelp, EventMode::kMenuMode);
|
||||||
myHelpButton->setToolTip("Click for help. (" + key + ")");
|
myHelpButton->setToolTip("Click for help. (" + key + ")");
|
||||||
|
myHelpButton->setEnabled(MediaFactory::supportsURL());
|
||||||
wid.push_back(myHelpButton);
|
wid.push_back(myHelpButton);
|
||||||
}
|
}
|
||||||
ypos += lineHeight + Dialog::vGap() * 2;
|
ypos += lineHeight + Dialog::vGap() * 2;
|
||||||
|
@ -1108,7 +1109,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
|
|
||||||
case RomInfoWidget::kClickedCmd:
|
case RomInfoWidget::kClickedCmd:
|
||||||
{
|
{
|
||||||
const string url = myRomInfoWidget->getUrl();
|
const string& url = myRomInfoWidget->getUrl();
|
||||||
|
|
||||||
if(url != EmptyString)
|
if(url != EmptyString)
|
||||||
MediaFactory::openURL(url);
|
MediaFactory::openURL(url);
|
||||||
|
|
Loading…
Reference in New Issue