aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-03-19 14:33:07 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-03-19 14:33:07 +0100
commit5b72a6b5787a360e36d137fe2d52f47be926a588 (patch)
tree935a36f13e6287ca5492a1e172e1cf287eccb501 /src
parentBlocker rewrites (diff)
downloadsmolbote-5b72a6b5787a360e36d137fe2d52f47be926a588.tar.xz
Added build script
Additional locations are searched for configuration
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp28
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/settings.h2
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;