aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--lib/bookmarks/bookmarkswidget.cpp2
-rw-r--r--linux/makepkg/PKGBUILD.aqua6
-rw-r--r--src/browser.cpp13
-rw-r--r--src/browser.h3
-rw-r--r--src/forms/cookiesform.cpp5
6 files changed, 19 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fdc3b2e..0fd5850 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,7 @@ option(CLikeConfig "Use a C-like style for the config" ON)
# Libraries
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Concurrent REQUIRED)
find_package(Qt5WebEngineWidgets REQUIRED)
find_package(libconfig++ REQUIRED)
@@ -104,7 +105,7 @@ add_executable(poi ${SourceCode})
target_include_directories(poi PRIVATE src lib)
-target_link_libraries(poi Qt5::Core Qt5::Widgets Qt5::WebEngineWidgets)
+target_link_libraries(poi Qt5::Core Qt5::Widgets Qt5::Concurrent Qt5::WebEngineWidgets)
target_link_libraries(poi configuration)
target_link_libraries(poi bookmarks downloads navigation)
diff --git a/lib/bookmarks/bookmarkswidget.cpp b/lib/bookmarks/bookmarkswidget.cpp
index 575f52f..21bf804 100644
--- a/lib/bookmarks/bookmarkswidget.cpp
+++ b/lib/bookmarks/bookmarkswidget.cpp
@@ -67,6 +67,8 @@ void BookmarksWidget::save()
{
if(m_model->isModified())
qDebug("Writing bookmarks %s", m_model->write(xbel) ? "ok" : "failed");
+ else
+ qDebug("Writing bookmarks skipped");
}
QAbstractItemModel *BookmarksWidget::model() const
diff --git a/linux/makepkg/PKGBUILD.aqua b/linux/makepkg/PKGBUILD.aqua
index 5dfe35e..72b8536 100644
--- a/linux/makepkg/PKGBUILD.aqua
+++ b/linux/makepkg/PKGBUILD.aqua
@@ -9,8 +9,8 @@ url="https://neueland.iserlohn-fortress.net/smolbote"
arch=('x86_64')
license=('GPL3')
-depends=('qt5-base' 'qt5-webengine')
-makedepends=('git' 'cmake' 'ninja' 'libconfig' 'pkg-config')
+depends=('qt5-webengine' 'libconfig')
+makedepends=('git' 'cmake' 'pkg-config' 'ninja' 'qt5-webengine' 'libconfig')
source=("smolbote-git::git+git://neueland.iserlohn-fortress.net/smolbote.git")
sha512sums=('SKIP')
@@ -40,7 +40,7 @@ build() {
_cmake_options="$_cmake_options -DCMAKE_CXX_COMPILER=/usr/bin/clang++"
# use libc++ instead of libstdc++
- _cmake_options="$_cmake_options -DUseLibCpp=On"
+ #_cmake_options="$_cmake_options -DUseLibCpp=On"
# build system
_cmake_options="$_cmake_options -GNinja"
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()