Commit 690b21f4 authored by Stephen Anthony's avatar Stephen Anthony
Browse files

Fix compilation when using SDL < 2.0.14 (needed for SDL_OpenURL).

Abstract SDL functionality into SDL-specific class, away from Dialog class.
parent a91aea1b
......@@ -181,6 +181,15 @@ class MediaFactory
#endif
}
static bool openURL(const string& url)
{
#if defined(SDL_SUPPORT)
return SDLOpenURL(url);
#else
return false;
#endif
}
private:
// Following constructors and assignment operators not supported
MediaFactory() = delete;
......
......@@ -54,4 +54,13 @@ static inline string SDLVersion()
return buf.str();
}
static inline bool SDLOpenURL(const string& url)
{
#if SDL_VERSION_ATLEAST(2,0,14)
return SDL_OpenURL(url.c_str()) == 0;
#else
return false;
#endif
}
#endif // SDL_LIB_HXX
......@@ -36,6 +36,7 @@
#include "Vec.hxx"
#include "TIA.hxx"
#include "MediaFactory.hxx"
/*
* TODO list
......@@ -183,13 +184,8 @@ const string Dialog::getHelpURL()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::openHelp()
{
if(hasHelp())
{
if(SDL_OpenURL(getHelpURL().c_str()))
{
cerr << "error opening URL " << getHelpURL() << endl;
}
}
if(hasHelp() && !MediaFactory::openURL(getHelpURL()))
cerr << "error opening URL " << getHelpURL() << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment