aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp13
-rw-r--r--src/browser.h3
-rw-r--r--src/forms/cookiesform.cpp5
3 files changed, 12 insertions, 9 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index bd1f841..25fcf59 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -10,14 +10,15 @@
#include "mainwindow.h"
#include "webengine/urlinterceptor.h"
#include <QDir>
+#include <QtConcurrent>
#include <bookmarks/bookmarkswidget.h>
#include <downloads/downloadswidget.h>
Browser::Browser(int &argc, char *argv[])
: SingleApplication(argc, argv)
{
- setApplicationName("smolbote");
- setWindowIcon(QIcon(":/icon.svg"));
+ QApplication::setApplicationName("smolbote");
+ QApplication::setWindowIcon(QIcon(":/icon.svg"));
connect(this, &Browser::messageAvailable, this, &Browser::createSession);
}
@@ -25,11 +26,15 @@ Browser::Browser(int &argc, char *argv[])
Browser::~Browser()
{
if(m_config) {
- m_config->writeIfNeeded();
+ QtConcurrent::run(QThreadPool::globalInstance(), m_config.get(), &Configuration::writeIfNeeded);
+ //m_config->writeIfNeeded();
}
if(m_bookmarksManager) {
- m_bookmarksManager->save();
+ QtConcurrent::run(QThreadPool::globalInstance(), m_bookmarksManager.get(), &BookmarksWidget::save);
+ //m_bookmarksManager->save();
}
+
+ qDebug("Waiting for threads to wind down: %s", QThreadPool::globalInstance()->waitForDone() ? "done" : "failed");
}
void Browser::setConfiguration(std::shared_ptr<Configuration> &config)
diff --git a/src/browser.h b/src/browser.h
index 1383c44..a78219d 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -26,6 +26,7 @@ class Browser : public SingleApplication
public:
explicit Browser(int &argc, char *argv[]);
~Browser();
+ Q_DISABLE_COPY(Browser)
void setConfiguration(std::shared_ptr<Configuration> &config);
@@ -36,8 +37,6 @@ public slots:
MainWindow *createSession(const QString &profileName, bool newWindow, const QStringList &urls);
private:
- Q_DISABLE_COPY(Browser)
-
MainWindow *createWindow();
std::shared_ptr<Configuration> m_config;
diff --git a/src/forms/cookiesform.cpp b/src/forms/cookiesform.cpp
index cf2bcb8..52fb5a2 100644
--- a/src/forms/cookiesform.cpp
+++ b/src/forms/cookiesform.cpp
@@ -8,7 +8,6 @@
#include "cookiesform.h"
#include "ui_cookiesform.h"
-
#include <QDateTime>
CookiesForm::CookiesForm(QWebEngineCookieStore *store, QWidget *parent)
@@ -19,8 +18,8 @@ CookiesForm::CookiesForm(QWebEngineCookieStore *store, QWidget *parent)
ui->setupUi(this);
ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
- connect(store, SIGNAL(cookieAdded(QNetworkCookie)), this, SLOT(addCookie(QNetworkCookie)));
- connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(showDetails(QTreeWidgetItem *, QTreeWidgetItem *)));
+ connect(store, &QWebEngineCookieStore::cookieAdded, this, &CookiesForm::addCookie);
+ connect(ui->treeWidget, &QTreeWidget::currentItemChanged, this, &CookiesForm::showDetails);
}
CookiesForm::~CookiesForm()