diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-05-20 14:06:06 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-05-20 14:06:06 +0000 |
| commit | ba6d239f2bc533cbed1d1cb3ec85e0c15acd03f1 (patch) | |
| tree | 3ab9bcc8b5ac3c82421619ce4eb026eed6dd99b3 /src/plugins | |
| parent | 73e2c5045c1314e9d04cdfd2d4212e3adfffe4fd (diff) | |
| download | qmmp-ba6d239f2bc533cbed1d1cb3ec85e0c15acd03f1.tar.gz qmmp-ba6d239f2bc533cbed1d1cb3ec85e0c15acd03f1.tar.bz2 qmmp-ba6d239f2bc533cbed1d1cb3ec85e0c15acd03f1.zip | |
using relative skin path for portable configuration (#915)
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7180 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/Ui/skinned/skin.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/plugins/Ui/skinned/skin.cpp b/src/plugins/Ui/skinned/skin.cpp index ec2515405..8e7eedfb5 100644 --- a/src/plugins/Ui/skinned/skin.cpp +++ b/src/plugins/Ui/skinned/skin.cpp @@ -29,6 +29,9 @@ #include <QAction> #include <QTextStream> #include <QStringList> +#ifdef Q_OS_WIN +#include <QApplication> +#endif #include <qmmp/qmmp.h> #include "actionmanager.h" #include "skin.h" @@ -58,6 +61,10 @@ Skin::Skin (QObject *parent) : QObject (parent) m_instance = this; QSettings settings(Qmmp::configFile(), QSettings::IniFormat); QString path = settings.value("Skinned/skin_path").toString(); +#ifdef Q_OS_WIN + if(Qmmp::isPortable()) + path.prepend(QApplication::applicationDirPath() + "/"); +#endif if (path.isEmpty() || !QDir(path).exists ()) path = ":/glare"; m_double_size = settings.value("Skinned/double_size", false).toBool(); @@ -79,7 +86,18 @@ void Skin::setSkin (const QString& path) m_use_cursors = settings.value("Skinned/skin_cursors", false).toBool(); m_double_size = ACTION(ActionManager::WM_DOUBLE_SIZE)->isChecked(); m_antialiasing = ACTION(ActionManager::WM_ANTIALIASING)->isChecked(); - settings.setValue("Skinned/skin_path",path); +#ifdef Q_OS_WIN + if(Qmmp::isPortable() && path.startsWith(QApplication::applicationDirPath())) + { + QString relativePath = path; + relativePath.remove(QApplication::applicationDirPath(), Qt::CaseInsensitive); + if(relativePath.startsWith("/")) + relativePath.remove(0, 1); + settings.setValue("Skinned/skin_path", relativePath); + } + else +#endif + settings.setValue("Skinned/skin_path",path); qDebug ("Skin: using %s",qPrintable(path)); m_skin_dir = QDir (path); //clear old values |
