diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/browser.cpp | 28 | ||||
-rw-r--r-- | src/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/settings.h | 2 |
3 files changed, 25 insertions, 7 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index 4697ac5..41c6355 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -125,12 +125,30 @@ DownloadDialog *Browser::downloads() void Browser::setConfigPath(const QString &path) { - if(path.isEmpty()) { - // set default config path - m_settings = new Settings(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/poi.conf"); - } else { - // set custom config path + // set custom config path if any + if(!path.isEmpty()) { m_settings = new Settings(path); + return; + } + + // check if config file exists for this user + QString cpath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/poi.conf"; + if(QFile::exists(cpath)) { + m_settings = new Settings(cpath); + } + + // check system-specific locations +#ifdef Q_OS_LINUX + else if(QFile::exists("/usr/share/smolbote/poi.conf")) { + m_settings = new Settings("/usr/share/smolbote/poi.conf"); + } + else if(QFile::exists("/usr/local/share/smolbote/poi.conf")) { + m_settings = new Settings("/usr/local/share/smolbote/poi.conf"); + } +#endif + + else { + m_settings = new Settings(); } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f455fae..087c5f8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -161,7 +161,7 @@ void MainWindow::about() "<p>This program comes with ABSOLUTELY NO WARRANTY. " "This is free software, and you are welcome to redistribute it under the conditions set by the GNU GPLv3.</p>" "<p>Configuration lives in: %2</p>") - .arg(qApp->applicationVersion()).arg(sSettings->filePath())); + .arg(DESCRIBE).arg(sSettings->filePath())); } void MainWindow::loadProfile(const QString &name) diff --git a/src/settings.h b/src/settings.h index 12c508b..54a3917 100644 --- a/src/settings.h +++ b/src/settings.h @@ -27,7 +27,7 @@ class Settings { public: - Settings(const QString &configFile); + Settings(const QString &configFile = QString()); ~Settings(); QString filePath() const; |