Some more changes concerning avatars. Directory changes. App data now QApplication independent.
This commit is contained in:
@@ -32,7 +32,7 @@ std::string QtHelper::getDefaultLanguage() { return QLocale::system().name().toS
|
||||
|
||||
QString QtHelper::getDataPath()
|
||||
{
|
||||
QString path = QCoreApplication::instance()->applicationDirPath();
|
||||
QString path = QCoreApplication::instance()->applicationDirPath();
|
||||
|
||||
#ifdef _WIN32
|
||||
path += "/data/";
|
||||
@@ -54,10 +54,32 @@ QString QtHelper::getDataPath()
|
||||
#endif
|
||||
|
||||
|
||||
return QDir::cleanPath(path) + "/";
|
||||
return QDir::cleanPath(path) + "/";
|
||||
}
|
||||
|
||||
std::string QtHelper::getDataPathStdString()
|
||||
std::string QtHelper::getDataPathStdString(const std::string &appPath)
|
||||
{
|
||||
return getDataPath().toUtf8().constData();
|
||||
QString path(appPath.c_str());
|
||||
|
||||
#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) + "/").toUtf8().constData();
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
std::string getDefaultLanguage();
|
||||
|
||||
QString getDataPath();
|
||||
std::string getDataPathStdString();
|
||||
std::string getDataPathStdString(const std::string &appPath);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qttoolswrapper.h"
|
||||
#include <qthelper.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -38,5 +39,5 @@ QtToolsWrapper::~QtToolsWrapper()
|
||||
|
||||
std::string QtToolsWrapper::stringToUtf8(const std::string &myString) { return myQtHelper->stringToUtf8(myString); }
|
||||
std::string QtToolsWrapper::getDefaultLanguage() { return myQtHelper->getDefaultLanguage(); }
|
||||
std::string QtToolsWrapper::getDataPathStdString() { return myQtHelper->getDataPathStdString(); }
|
||||
std::string QtToolsWrapper::getDataPathStdString(const std::string &appPath) { return myQtHelper->getDataPathStdString(appPath); }
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define QTTOOLSWRAPPER_H
|
||||
|
||||
#include <qttoolsinterface.h>
|
||||
#include <qthelper.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -36,7 +35,7 @@ public:
|
||||
|
||||
std::string stringToUtf8(const std::string &myString);
|
||||
std::string getDefaultLanguage();
|
||||
std::string getDataPathStdString();
|
||||
std::string getDataPathStdString(const std::string &appPath);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user