aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-01-14 21:44:56 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-01-14 21:44:56 +0100
commitf45b2d05aa10410ce6c602907a58d574d7bd7e07 (patch)
tree225cf56bcc0c9564534b1d23c976d588aa613445
parentAdded Readme (diff)
downloadsmolbote-f45b2d05aa10410ce6c602907a58d574d7bd7e07.tar.xz
Configuration by default is read from default location instead of current folder
-rw-r--r--src/browser.cpp8
-rw-r--r--src/main.cpp2
-rw-r--r--src/settings.cpp1
3 files changed, 9 insertions, 2 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 2b35e21..e6be694 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -5,7 +5,13 @@
Browser::Browser(QString configPath, QObject *parent) : QObject(parent)
{
- Settings::setFilepath(configPath);
+ if(configPath.isEmpty()) {
+ // set default config path
+ Settings::setFilepath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini");
+ } else {
+ // set custom config path
+ Settings::setFilepath(configPath);
+ }
// TODO Restore previous session
diff --git a/src/main.cpp b/src/main.cpp
index 835bbbf..ef6a5e1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
parser.addPositionalArgument("URL", "URL to open");
- QCommandLineOption configOption(QStringList() << "c" << "config", "Set configuration file.", "PATH", "config.ini");
+ QCommandLineOption configOption(QStringList() << "c" << "config", "Set configuration file.", "PATH");
parser.addOption(configOption);
parser.process(app);
diff --git a/src/settings.cpp b/src/settings.cpp
index 0122f8f..4dbc7c8 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -14,5 +14,6 @@ Settings::~Settings()
void Settings::setFilepath(const QString &path)
{
+ qDebug("Setting config file location to: %s", qUtf8Printable(path));
_path = path;
}