a/HelperStructs/Helper.cpp b/HelperStructs/Helper.cpp
...
...
42
#include <QFile>
42
#include <QFile>
43
#include <QFontMetrics>
43
#include <QFontMetrics>
44
#include <QFileInfo>
44
#include <QFileInfo>
45
#include <QMap>
45
#include <QMap>
46
#include <QString>
46
#include <QString>
47
#include <QtGlobal>
47
48
48
#include "HelperStructs/Helper.h"
49
#include "HelperStructs/Helper.h"
49
#include "HelperStructs/MetaData.h"
50
#include "HelperStructs/MetaData.h"
50
#include "HelperStructs/globals.h"
51
#include "HelperStructs/globals.h"
51
#include "HelperStructs/CSettingsStorage.h"
52
#include "HelperStructs/CSettingsStorage.h"
...
...
155
#endif
156
#endif
156
157
157
QString Helper::getSharePath()
158
QString Helper::getSharePath()
158
{
159
{
159
    QString path;
160
    QString path;
161
160
#ifndef Q_OS_WIN
162
#if defined(Q_OS_WIN)
163
    QDir execdir(GetExecPath());
164
    QString rpath("Share");
165
    execdir.mkpath(rpath);
166
    path = execdir.absoluteFilePath(rpath);
167
#elif defined(Q_OS_MACOS)
168
    path = QCoreApplication::applicationDirPath() + QString("/..");
169
    path = QDir::cleanPath(path);
170
#else
161
    if (QFile::exists(PREFIX "/share/upplay")) {
171
    if (QFile::exists(PREFIX "/share/upplay")) {
162
        path = PREFIX "/share/upplay/";
172
        path = PREFIX "/share/upplay/";
163
    } else {
173
    } else {
164
        path = "";
174
        path = "";
165
    }
175
    }
166
#else
167
    QDir execdir(GetExecPath());
168
    QString rpath("Share");
169
    execdir.mkpath(rpath);
170
    path = execdir.absoluteFilePath(rpath);
171
#endif
176
#endif
172
    return path;
177
    return path;
173
}
178
}
174
179
175
static QString styleSubDir;
180
static QString styleSubDir;
176
void Helper::setStyleSubDir(const QString& subd)
181
void Helper::setStyleSubDir(const QString& subd)
177
{
182
{
178
    //qDebug() << "Helper::setStyleSubDir: " << subd;
179
    styleSubDir = subd;
183
    styleSubDir = subd;
180
}
184
}
181
185
182
QString Helper::getIconDir()
186
QString Helper::getIconDir()
183
{
187
{
184
    //return ":/icons/";
188
#if defined(Q_OS_MACOS)
189
    return QDir(getSharePath()).filePath("Resources");
190
#else
185
    return QDir(getSharePath()).filePath("icons");
191
    return QDir(getSharePath()).filePath("icons");
192
#endif
186
}
193
}
187
194
188
QString Helper::getIconPath(const QString& icnm)
195
QString Helper::getIconPath(const QString& icnm)
189
{
196
{
190
    if (!styleSubDir.isEmpty()) {
197
    if (!styleSubDir.isEmpty()) {
191
        QDir styledir(QDir(getIconDir()).filePath(styleSubDir));
198
        QDir styledir(QDir(getIconDir()).filePath(styleSubDir));
192
        //qDebug() << "getIconPath(): testing " << styledir.filePath(icnm);
193
        if (QFile::exists(styledir.filePath(icnm))) {
199
        if (QFile::exists(styledir.filePath(icnm))) {
194
            return styledir.filePath(icnm);
200
            return styledir.filePath(icnm);
195
        }
201
        }
196
    }
202
    }
197
    return QDir(getIconDir()).filePath(icnm);
203
    return QDir(getIconDir()).filePath(icnm);