This commit is contained in:
doitux
2007-08-28 01:10:41 +00:00
parent d1f95d539d
commit a79aa7708d
9 changed files with 55 additions and 17 deletions
+28 -1
View File
@@ -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) + "/";
}
+4 -1
View File
@@ -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