This commit is contained in:
@@ -28,4 +28,31 @@ std::string QtHelper::stringToUtf8(const std::string &myString) {
|
||||
return myUtf8String;
|
||||
}
|
||||
|
||||
std::string QtHelper::getDefaultLanguage() { return QLocale::system().name().toStdString(); }
|
||||
std::string QtHelper::getDefaultLanguage() { return QLocale::system().name().toStdString(); }
|
||||
|
||||
QString QtHelper::getDataPath()
|
||||
{
|
||||
QString path = QCoreApplication::instance()->applicationDirPath();
|
||||
|
||||
#ifdef _WIN32
|
||||
path += "/data/";
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
if (QRegExp("Contents/MacOS/?$").indexIn(path) != -1) {
|
||||
// pointing into an macosx application bundle
|
||||
path += "/../Resources/data/";
|
||||
} else { path += "/data/"; }
|
||||
#else //Unix
|
||||
if (QRegExp("pokerth/?$").indexIn(path) != -1) {
|
||||
// there is an own application directory
|
||||
path += "/data/";
|
||||
} else if (QRegExp("bin/?$").indexIn(path) != -1) {
|
||||
// we are in a bin directory. e.g. /usr/bin
|
||||
path += "/../share/pokerth/data/";
|
||||
} else { path += "/data/"; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
return QDir::cleanPath(path) + "/";
|
||||
}
|
||||
@@ -16,7 +16,8 @@
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
*/
|
||||
class QtHelper{
|
||||
class QtHelper : public QObject{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtHelper();
|
||||
|
||||
@@ -25,6 +26,8 @@ public:
|
||||
std::string stringToUtf8(const std::string &);
|
||||
std::string getDefaultLanguage();
|
||||
|
||||
QString getDataPath();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user