From abd011f7cf8d298b8bbbe30eedb329094d43c0b9 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 23 Feb 2017 17:19:32 +0100 Subject: Download manager improvements Added shortcut for download dialog Dialog has proper title Settings replaces ~ with home location Showing download item details --- src/settings.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/settings.cpp') diff --git a/src/settings.cpp b/src/settings.cpp index 25cc6c0..f030dfd 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -19,6 +19,7 @@ ******************************************************************************/ #include "settings.h" +#include QString Settings::_path = QString(""); @@ -41,13 +42,20 @@ QString Settings::staticFilePath() QVariant Settings::value(const QString &key, const QVariant &defaultValue) const { + // get the actual value QString value = QSettings::value(key, defaultValue).toString(); + // check if there is a reference QRegularExpressionMatch referenceMatch = referencePattern.match(value); if(referenceMatch.hasMatch()) { QString pattern = referenceMatch.capturedTexts().first(); value.replace(pattern, this->value(pattern.mid(1, pattern.length()-2)).toString()); } + // check if key is a path, in which case replace '~' with the home location + if(key.endsWith(QLatin1String("path"), Qt::CaseInsensitive)) { + value.replace('~', QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); + } + return QVariant(value); } -- cgit v1.2.1