From: Manuel Nickschas Date: Thu, 12 Feb 2015 21:24:34 +0000 (+0100) Subject: Adapt custom stylesheet path to new default install location X-Git-Tag: 0.12-beta1~15 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=99f2e2d215d9d6c3486694f7a55b54ea3bc2e62e Adapt custom stylesheet path to new default install location When switching from a KDE4 build to Qt5/KF5, the default install location for data files switches from /usr/share/apps/quassel to /usr/share/quassel, as is standard. Users who have selected one of the pre-installed stylesheets will use that setting. Thus, if a custom stylesheet is configured and points to /usr/share/apps, in case it is not found we will now try and look into /usr/share as well. If we find the stylesheet in the new location, we'll also update the stored setting. --- diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 944b6049..ea0cb19d 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -104,8 +104,22 @@ void UiStyle::loadStyleSheet() QString styleSheet; styleSheet += loadStyleSheet("file:///" + Quassel::findDataFilePath("stylesheets/default.qss")); styleSheet += loadStyleSheet("file:///" + Quassel::configDirPath() + "settings.qss"); - if (s.value("UseCustomStyleSheet", false).toBool()) - styleSheet += loadStyleSheet("file:///" + s.value("CustomStyleSheetPath").toString(), true); + if (s.value("UseCustomStyleSheet", false).toBool()) { + QString customSheetPath(s.value("CustomStyleSheetPath").toString()); + QString customSheet = loadStyleSheet("file:///" + customSheetPath, true); + if (customSheet.isEmpty()) { + // MIGRATION: changed default install path for data from /usr/share/apps to /usr/share + if (customSheetPath.startsWith("/usr/share/apps/quassel")) { + customSheetPath.replace(QRegExp("^/usr/share/apps"), "/usr/share"); + customSheet = loadStyleSheet("file:///" + customSheetPath, true); + if (!customSheet.isEmpty()) { + s.setValue("CustomStyleSheetPath", customSheetPath); + qDebug() << "Custom stylesheet path migrated to" << customSheetPath; + } + } + } + styleSheet += customSheet; + } styleSheet += loadStyleSheet("file:///" + Quassel::optionValue("qss"), true); if (!styleSheet.isEmpty()) {