From 10a7765c7b6a1d62cb9ca2406145fd3799f5197c Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 10 Sep 2017 18:21:25 +0200 Subject: Config should now automatically update when changed --- src/browser.cpp | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'src/browser.cpp') diff --git a/src/browser.cpp b/src/browser.cpp index 8db1980..60cdb03 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -39,13 +39,6 @@ Browser::Browser(int &argc, char *argv[]) : m_blocklistManager = nullptr; m_plugin = nullptr; - - setApplicationName("smolbote"); -#ifdef GIT_VERSION - setApplicationVersion(GIT_VERSION); -#else - setApplicationVersion("1.0.0"); -#endif } Browser::~Browser() @@ -160,10 +153,24 @@ BlockerManager *Browser::blocklists() return m_blocklistManager; } -void Browser::setConfigPath(const QString &path) +void Browser::loadSettings(const QString &path) { QString configLocation, defaultsLocation; + // set custom config path if any + if(!path.isEmpty()) { + configLocation = path; + + } else { + // no custom config has been set + // check if config file exists for this user + QString cpath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/poi.conf"; + if(QFile::exists(cpath)) { + configLocation = cpath; + } + // else there is no user overrides + } + // set defaults location // check system-specific locations #ifdef Q_OS_LINUX @@ -179,18 +186,6 @@ void Browser::setConfigPath(const QString &path) defaultsLocation = ":/poi.toml"; } - // set custom config path if any - if(!path.isEmpty()) { - configLocation = path; - - } else { - // check if config file exists for this user - QString cpath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/poi.conf"; - if(QFile::exists(cpath)) { - configLocation = cpath; - } - } - m_settings = new Settings(configLocation, defaultsLocation); #ifdef QT_DEBUG -- cgit v1.2.1