diff options
Diffstat (limited to 'src/browser.cpp')
-rw-r--r-- | src/browser.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index a1c097a..f709e1e 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -20,7 +20,6 @@ #include "browser.h" #include "mainwindow.h" -#include "settings.h" #include <QtWebEngine> #include <QMessageBox> @@ -47,12 +46,11 @@ Browser::~Browser() */ void Browser::firstRun() { - Settings settings; - if(settings.allKeys().isEmpty()) { + if(m_settings->isEmpty()) { // There are no keys in the settings QMessageBox::information(0, tr("Configuration is empty"), - tr("The configuration file <i>%1</i> is empty. Using default values").arg(settings.staticFilePath())); + tr("The configuration file <i>%1</i> is empty. Using default values").arg(m_settings->filePath())); } } @@ -61,10 +59,8 @@ void Browser::firstRun() */ bool Browser::preLaunch(QStringList urls) { - Settings settings; - - if(settings.value("browser/singleInstance", true).toBool()) { - QString serverName = settings.value("browser/localSocket", "smolbote-singlelock").toString(); + if(m_settings->value("browser.singleInstance", true).toBool()) { + QString serverName = m_settings->value("browser.localSocket", "smolbote-singlelock").toString(); // Check for other running instance QLocalSocket socket; @@ -105,6 +101,11 @@ Browser *Browser::instance() return static_cast<Browser *>(QCoreApplication::instance()); } +Settings *Browser::settings() +{ + return m_settings; +} + BookmarksDialog *Browser::bookmarks() { return m_bookmarksManager; @@ -119,10 +120,10 @@ void Browser::setConfigPath(const QString &path) { if(path.isEmpty()) { // set default config path - Settings::setFilePath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini"); + m_settings = new Settings(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.toml"); } else { // set custom config path - Settings::setFilePath(path); + m_settings = new Settings(path); } } |