mirror of https://github.com/stella-emu/stella.git
Fix compilation when using SDL < 2.0.14 (needed for SDL_OpenURL).
Abstract SDL functionality into SDL-specific class, away from Dialog class.
This commit is contained in:
parent
a91aea1b22
commit
690b21f482
|
@ -181,6 +181,15 @@ class MediaFactory
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool openURL(const string& url)
|
||||||
|
{
|
||||||
|
#if defined(SDL_SUPPORT)
|
||||||
|
return SDLOpenURL(url);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
MediaFactory() = delete;
|
MediaFactory() = delete;
|
||||||
|
|
|
@ -54,4 +54,13 @@ static inline string SDLVersion()
|
||||||
return buf.str();
|
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
|
#endif // SDL_LIB_HXX
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
#include "Vec.hxx"
|
#include "Vec.hxx"
|
||||||
#include "TIA.hxx"
|
#include "TIA.hxx"
|
||||||
|
#include "MediaFactory.hxx"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO list
|
* TODO list
|
||||||
|
@ -183,13 +184,8 @@ const string Dialog::getHelpURL()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::openHelp()
|
void Dialog::openHelp()
|
||||||
{
|
{
|
||||||
if(hasHelp())
|
if(hasHelp() && !MediaFactory::openURL(getHelpURL()))
|
||||||
{
|
cerr << "error opening URL " << getHelpURL() << endl;
|
||||||
if(SDL_OpenURL(getHelpURL().c_str()))
|
|
||||||
{
|
|
||||||
cerr << "error opening URL " << getHelpURL() << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
Loading…
Reference in New Issue