diff --git a/src/common/MediaFactory.hxx b/src/common/MediaFactory.hxx index c768f9525..7c9174cbf 100644 --- a/src/common/MediaFactory.hxx +++ b/src/common/MediaFactory.hxx @@ -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; diff --git a/src/gui/AboutDialog.cxx b/src/gui/AboutDialog.cxx index 3d810aba0..e9b852e83 100644 --- a/src/gui/AboutDialog.cxx +++ b/src/gui/AboutDialog.cxx @@ -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; } diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index c85a4ca16..a7238e703 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -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); diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index c7c7e0aef..509b4495f 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -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()); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/HelpDialog.cxx b/src/gui/HelpDialog.cxx index ab48d7283..a227090e1 100644 --- a/src/gui/HelpDialog.cxx +++ b/src/gui/HelpDialog.cxx @@ -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; diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index eddf18741..ba44f345f 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -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);