aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------3rd-party/SingleApplication/SingleApplication.git0
-rw-r--r--3rd-party/SingleApplication/meson.build2
-rw-r--r--3rd-party/args/meson.build2
-rw-r--r--include/browserinterface.h21
-rw-r--r--include/plugininterface.h6
-rw-r--r--lib/bookmarks/model/bookmarkmodel.h2
-rw-r--r--lib/downloads/downloadswidget.cpp9
-rw-r--r--lib/downloads/widgets/downloaditemwidget.cpp23
-rw-r--r--lib/urlfilter/adblock/parser.cpp4
-rw-r--r--meson.build2
-rw-r--r--src/browser.h14
-rw-r--r--src/crashhandler.cpp2
-rw-r--r--src/crashhandler.h2
13 files changed, 30 insertions, 59 deletions
diff --git a/3rd-party/SingleApplication/SingleApplication.git b/3rd-party/SingleApplication/SingleApplication.git
-Subproject 16ea64b2548b02f59bf49b255466278c3ff0ace
+Subproject 33a2617a3f96a1aadf22c6c39640f6c3696f1a6
diff --git a/3rd-party/SingleApplication/meson.build b/3rd-party/SingleApplication/meson.build
index f08b50e..f1c13fc 100644
--- a/3rd-party/SingleApplication/meson.build
+++ b/3rd-party/SingleApplication/meson.build
@@ -16,7 +16,7 @@ SingleApplication_lib = static_library('SingleApplication',
dep_SingleApplication = declare_dependency(
include_directories: SingleApplication_inc,
link_with: SingleApplication_lib
-)
+).as_system('system')
# On windows, SingleApplication needs to be linked against advapi32. This is
# done by adding 'advapi32' to cpp_winlibs, where it should be by default.
diff --git a/3rd-party/args/meson.build b/3rd-party/args/meson.build
index c4ef5dc..8b0c441 100644
--- a/3rd-party/args/meson.build
+++ b/3rd-party/args/meson.build
@@ -1,5 +1,5 @@
# This is a header-only lib, all we need to do is include it
dep_args = declare_dependency(
include_directories: include_directories('args.git')
-)
+).as_system('system')
diff --git a/include/browserinterface.h b/include/browserinterface.h
deleted file mode 100644
index 4cdc63b..0000000
--- a/include/browserinterface.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: MIT
- */
-
-#pragma once
-
-class Profile;
-class BrowserInterface
-{
-public:
- virtual ~BrowserInterface() = default;
-
- // profile access
- virtual const QList<QPair<QString, Profile *>> profileList() const = 0;
- virtual QPair<QString, Profile *> loadProfile(const QString &id, bool isOffTheRecord = true) = 0;
- virtual void removeProfile(const QString &id) = 0;
-};
diff --git a/include/plugininterface.h b/include/plugininterface.h
index 103ee62..6da417c 100644
--- a/include/plugininterface.h
+++ b/include/plugininterface.h
@@ -12,7 +12,6 @@
#include <QHash>
#include <memory>
#include <functional>
-#include "browserinterface.h"
#include <QApplication>
typedef QHash<QString, std::function<int()>> CommandHash_t;
@@ -24,11 +23,6 @@ public:
virtual ~PluginInterface() = default;
virtual CommandHash_t commands() = 0;
virtual QDialog *createWidget(QWidget *parent = nullptr) const = 0;
-
-protected:
- BrowserInterface *browser() const {
- return dynamic_cast<BrowserInterface *>(qApp);
- }
};
#define PluginInterfaceIid "net.iserlohn-fortress.smolbote.PluginInterface"
diff --git a/lib/bookmarks/model/bookmarkmodel.h b/lib/bookmarks/model/bookmarkmodel.h
index 8efd2fb..300b724 100644
--- a/lib/bookmarks/model/bookmarkmodel.h
+++ b/lib/bookmarks/model/bookmarkmodel.h
@@ -62,7 +62,7 @@ public:
}
private:
- const QLatin1Literal mimeType = QLatin1Literal("application/xbel");
+ const QLatin1String mimeType = QLatin1String("application/xbel");
BookmarkItem *getItem(const QModelIndex &index) const;
BookmarkItem *rootItem;
diff --git a/lib/downloads/downloadswidget.cpp b/lib/downloads/downloadswidget.cpp
index 3ff7e69..02ed08a 100644
--- a/lib/downloads/downloadswidget.cpp
+++ b/lib/downloads/downloadswidget.cpp
@@ -30,7 +30,7 @@ DownloadsWidget::~DownloadsWidget()
void DownloadsWidget::addDownload(QWebEngineDownloadItem *item)
{
- const QString filepath = QFileDialog::getSaveFileName(this, tr("Save File"), m_downloadPath + "/" + QFileInfo(item->path()).fileName());
+ const QString filepath = QFileDialog::getSaveFileName(this, tr("Save File"), m_downloadPath + "/" + item->downloadFileName());
if(filepath.isEmpty()) {
// user cancelled the save dialog
@@ -38,7 +38,12 @@ void DownloadsWidget::addDownload(QWebEngineDownloadItem *item)
return;
}
- item->setPath(filepath);
+ QFileInfo info(filepath);
+
+ // you first have to set the download directory, then file name, otherwise the filename gets defaulted
+ item->setDownloadDirectory(info.absolutePath());
+ item->setDownloadFileName(info.fileName());
+
auto *listItem = new QListWidgetItem(ui->listWidget);
diff --git a/lib/downloads/widgets/downloaditemwidget.cpp b/lib/downloads/widgets/downloaditemwidget.cpp
index 4096751..241b90b 100644
--- a/lib/downloads/widgets/downloaditemwidget.cpp
+++ b/lib/downloads/widgets/downloaditemwidget.cpp
@@ -48,7 +48,7 @@ DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *pa
}
ui->url_label->setText(item->url().toString());
- ui->path_label->setText(item->path());
+ ui->path_label->setText(QString("%1<br>%2").arg(item->downloadDirectory(), item->downloadFileName()));
this->updateState(item->state());
connect(item, &QWebEngineDownloadItem::stateChanged, this, &DownloadItemWidget::updateState);
@@ -64,7 +64,7 @@ DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *pa
}
});
connect(ui->open_toolButton, &QToolButton::clicked, item, [item]() {
- QDesktopServices::openUrl(QUrl::fromLocalFile(item->path()));
+ QDesktopServices::openUrl(QUrl::fromLocalFile(item->downloadDirectory()+'/'+item->downloadFileName()));
});
}
@@ -125,28 +125,17 @@ void DownloadItemWidget::updateFinished()
ui->abort_toolButton->hide();
ui->open_toolButton->show();
- // generate a useful tooltip
- QString tooltip = "<p><b>URL</b>: %1</p>"
- "<p><b>Path</b>: %2</p>"
- "<p><b>MIME Type</b>: %3</p>"
- "<p><b>Size</b>: %4</p>";
- tooltip = tooltip.arg(item->url().toString(), item->path(), item->mimeType(), sizeString(item->totalBytes()));
-
+ // generate a preview tooltip
if(item->mimeType().startsWith("image")) {
- const QPixmap pixmap(item->path());
+ const QPixmap pixmap(item->downloadDirectory()+'/'+item->downloadFileName());
const QPixmap thumbnail = pixmap.scaledToWidth(qMax(400, pixmap.width()), Qt::SmoothTransformation);
QByteArray imageData;
QBuffer buffer(&imageData);
thumbnail.save(&buffer, "PNG");
- tooltip = QString("<table>"
- "<tr><th>Preview</th><th>Information</th></tr>"
- "<tr><td>%1</td><td>%2</td></tr>"
- "</table>").arg(QString("<img src='data:image/png;base64," + imageData.toBase64() + "' width='400' alt='preview'>"),
- tooltip);
-
+ const auto tooltip = QString("<img src='data:image/png;base64," + imageData.toBase64() + "' width='400' alt='preview'>");
+ setToolTip(tooltip);
}
- setToolTip(tooltip);
}
diff --git a/lib/urlfilter/adblock/parser.cpp b/lib/urlfilter/adblock/parser.cpp
index 1e7f0bc..d65a2e4 100644
--- a/lib/urlfilter/adblock/parser.cpp
+++ b/lib/urlfilter/adblock/parser.cpp
@@ -10,9 +10,9 @@
std::optional<std::pair<QString, QString>> parseComment(QString &line)
{
- const QLatin1Literal separator(": ");
+ const QLatin1String separator(": ");
if(line.contains(separator)) {
- const QStringList comment = line.mid(1).split(QLatin1Literal(": "));
+ const QStringList comment = line.mid(1).split(QLatin1String(": "));
return std::make_pair(comment.at(0).trimmed(), comment.at(1).trimmed());
} else
return std::nullopt;
diff --git a/meson.build b/meson.build
index 009ec91..49f3990 100644
--- a/meson.build
+++ b/meson.build
@@ -88,7 +88,7 @@ subdir('doc')
subdir('tools')
#subdir('plugins/ConfigurationEditor')
-subdir('plugins/ProfileEditor')
+#subdir('plugins/ProfileEditor')
subdir('test/conf')
diff --git a/src/browser.h b/src/browser.h
index 1faf210..fb47c46 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -12,7 +12,6 @@
#include "session/session.h"
#include <QJsonObject>
#include <QVector>
-#include <browserinterface.h>
#include <functional>
#include <memory>
#include <singleapplication.h>
@@ -24,8 +23,9 @@ class Configuration;
class BookmarksWidget;
class DownloadsWidget;
class MainWindow;
+class Profile;
class WebProfileManager;
-class Browser : public SingleApplication, public BrowserInterface
+class Browser : public SingleApplication
{
Q_OBJECT
@@ -38,10 +38,14 @@ public slots:
public:
// interface
+ [[deprecated]]
WebProfileManager *getProfileManager();
- const QList<QPair<QString, Profile *>> profileList() const override;
- QPair<QString, Profile *> loadProfile(const QString &id, bool isOffTheRecord = true) override;
- void removeProfile(const QString &id) override;
+ [[deprecated]]
+ const QList<QPair<QString, Profile *>> profileList() const;
+ [[deprecated]]
+ QPair<QString, Profile *> loadProfile(const QString &id, bool isOffTheRecord = true);
+ [[deprecated]]
+ void removeProfile(const QString &id);
QPluginLoader *addPlugin(const QString &path = QString());
diff --git a/src/crashhandler.cpp b/src/crashhandler.cpp
index 0c2fec7..ed9298f 100644
--- a/src/crashhandler.cpp
+++ b/src/crashhandler.cpp
@@ -50,7 +50,7 @@ bool CrashHandler::install_handler(CrashHandler::Context &ctx)
google_breakpad::MinidumpDescriptor descriptor(ctx.dumppath.c_str());
// minidump descriptor, filter callback, minidump callback, callback_context, install handler, server_fd
- auto *eh = new google_breakpad::ExceptionHandler(descriptor, nullptr, minidumpCb, &ctx, true, -1);
+ new google_breakpad::ExceptionHandler(descriptor, nullptr, minidumpCb, &ctx, true, -1);
return true;
}
diff --git a/src/crashhandler.h b/src/crashhandler.h
index 9b79ecc..ac1bf12 100644
--- a/src/crashhandler.h
+++ b/src/crashhandler.h
@@ -31,6 +31,6 @@ bool install_handler(Context &ctx)
}
#endif
;
-};
+}
#endif // SMOLBOTE_CRASHHANDLER_H