aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-01-17 20:25:44 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-01-17 21:27:00 +0200
commitcb30cee7a065a074394347f112451decc4847674 (patch)
tree25f0ef36bb776a5e1938232e132b0a464fd5a9bc /src
parentMerge branch 'firefox-bookmarks-json-importer' (diff)
downloadsmolbote-cb30cee7a065a074394347f112451decc4847674.tar.xz
Fix various gcc and clazy compile warnings
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp10
-rw-r--r--src/browser.h2
-rw-r--r--src/crashhandler.h8
-rw-r--r--src/crashhandler_dummy.cpp16
-rw-r--r--src/mainwindow/menubar.cpp2
-rw-r--r--src/meson.build7
-rw-r--r--src/util.cpp2
-rw-r--r--src/webengine/urlinterceptor.cpp4
-rw-r--r--src/webengine/webprofilemanager.cpp4
9 files changed, 34 insertions, 21 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 488131e..61cd2c6 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -76,7 +76,7 @@ Browser::~Browser()
if(m_bookmarks)
m_bookmarks->save();
- for(auto *info : m_plugins)
+ for(auto *info : qAsConst(m_plugins))
delete info;
qDeleteAll(m_windows);
@@ -109,13 +109,13 @@ void Browser::loadProfiles(const QStringList &profilePaths)
connect(profile, &WebProfile::downloadRequested, m_downloads.get(), &DownloadsWidget::addDownload);
auto *interceptor = new UrlRequestInterceptor(profile, profile);
- for(UrlFilter *filter : m_filters) {
+ for(UrlFilter *filter : qAsConst(m_filters)) {
interceptor->addFilter(filter);
}
const auto headers = conf.value<QStringList>("filter.header").value_or(QStringList());
for(const QString &header : headers) {
- const auto h = header.split(QLatin1Literal(":"));
+ const auto h = header.split(QLatin1String(":"));
if(h.length() == 2)
interceptor->addHttpHeader(h.at(0).toLatin1(), h.at(1).toLatin1());
}
@@ -142,7 +142,7 @@ QPluginLoader *Browser::addPlugin(const QString &path)
auto *info = new PluginInfo(loader);
m_plugins.append(info);
- for(MainWindow *window : m_windows) {
+ for(MainWindow *window : qAsConst(m_windows)) {
addPluginTo(info, window);
}
@@ -259,7 +259,7 @@ MainWindow *Browser::createWindow()
auto *window = new MainWindow();
connect(window->addressBar, &AddressBar::complete, m_bookmarks.get(), &BookmarksWidget::search);
- for(auto *info : m_plugins) {
+ for(auto *info : qAsConst(m_plugins)) {
addPluginTo(info, window);
}
diff --git a/src/browser.h b/src/browser.h
index a16bd6d..d4117ba 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -72,7 +72,7 @@ private:
~PluginInfo()
{
loader->unload();
- for(auto *m : menus)
+ for(auto *m : qAsConst(menus))
m->deleteLater();
};
diff --git a/src/crashhandler.h b/src/crashhandler.h
index ac1bf12..73b1768 100644
--- a/src/crashhandler.h
+++ b/src/crashhandler.h
@@ -24,13 +24,7 @@ struct Context {
}
};
-bool install_handler(Context &ctx)
-#ifndef HAVE_BREAKPAD
-{
- return false;
-}
-#endif
-;
+bool install_handler(Context &ctx);
}
#endif // SMOLBOTE_CRASHHANDLER_H
diff --git a/src/crashhandler_dummy.cpp b/src/crashhandler_dummy.cpp
new file mode 100644
index 0000000..e230c82
--- /dev/null
+++ b/src/crashhandler_dummy.cpp
@@ -0,0 +1,16 @@
+/*
+ * 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: GPL-3.0
+ */
+
+#include "crashhandler.h"
+
+
+bool CrashHandler::install_handler(CrashHandler::Context &)
+{
+ return false;
+}
+
diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp
index a8d0590..eecb61a 100644
--- a/src/mainwindow/menubar.cpp
+++ b/src/mainwindow/menubar.cpp
@@ -100,7 +100,7 @@ MenuBar::MenuBar(MainWindow *parent)
return;
// findChildren
- for(QAction *a : this->findChildren<QAction *>()) {
+ for(QAction *a : findChildren<QAction *>()) {
if(a->text().contains(text))
findMenu->addAction(a);
}
diff --git a/src/meson.build b/src/meson.build
index 1783455..4d6c411 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -9,7 +9,7 @@ poi_settings_h = custom_target('default_config_value',
poi_sourceset.add(mod_qt5.preprocess(
moc_headers: ['browser.h',
- 'mainwindow/mainwindow.h', 'mainwindow/addressbar.h', 'mainwindow/menubar.h', 'mainwindow/widgets/completer.h', 'mainwindow/widgets/urllineedit.h', 'mainwindow/widgets/dockwidget.h', 'mainwindow/widgets/menusearch.h', 'mainwindow/widgets/navigationbar.h', 'mainwindow/widgets/searchform.h',
+ 'mainwindow/mainwindow.h', 'mainwindow/addressbar.h', 'mainwindow/menubar.h', 'mainwindow/widgets/completer.h', 'mainwindow/widgets/urllineedit.h', 'mainwindow/widgets/dockwidget.h', 'mainwindow/widgets/navigationbar.h', 'mainwindow/widgets/searchform.h',
'bookmarks/bookmarkswidget.h', 'bookmarks/editbookmarkdialog.h',
'session/savesessiondialog.h', 'session/sessiondialog.h', 'session/sessionform.h',
'subwindow/subwindow.h', 'subwindow/tabwidget.h',
@@ -60,5 +60,8 @@ poi_sourceset.add(files(
interfaces_moc, version_h, poi_settings_h
)
-poi_sourceset.add(when: [dep_breakpad, dep_threads], if_true: files('crashhandler.cpp'))
+poi_sourceset.add(when: [dep_breakpad, dep_threads],
+ if_true: files('crashhandler.cpp'),
+ if_false: files('crashhandler_dummy.cpp')
+)
diff --git a/src/util.cpp b/src/util.cpp
index cd73d94..fe74175 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -12,7 +12,7 @@
#include <QApplication>
#include <spdlog/spdlog.h>
-#define ListSeparator QLatin1Literal(";")
+#define ListSeparator QLatin1String(";")
const QStringList Util::files(const QString &location, const QStringList &nameFilters)
{
diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp
index 490dea6..29cd869 100644
--- a/src/webengine/urlinterceptor.cpp
+++ b/src/webengine/urlinterceptor.cpp
@@ -37,7 +37,7 @@ void UrlRequestInterceptor::removeFilter(UrlFilter *filter)
void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
- for(const auto *filter : filters) {
+ for(const auto *filter : qAsConst(filters)) {
const auto match = filter->match(info.firstPartyUrl(), info.requestUrl(), info.resourceType());
// skip if no match
@@ -57,7 +57,7 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
}
// set headers
- for(const auto &header : headers) {
+ for(const auto &header : qAsConst(headers)) {
info.setHttpHeader(header.first, header.second);
}
for(auto i = m_profile->headers().constBegin(); i != m_profile->headers().constEnd(); ++i) {
diff --git a/src/webengine/webprofilemanager.cpp b/src/webengine/webprofilemanager.cpp
index 80762f7..bdd10f0 100644
--- a/src/webengine/webprofilemanager.cpp
+++ b/src/webengine/webprofilemanager.cpp
@@ -30,7 +30,7 @@ WebProfileManager::WebProfileManager(QObject *parent)
WebProfileManager::~WebProfileManager()
{
- for(Profile p : profiles) {
+ for(Profile p : qAsConst(profiles)) {
if(p.selfDestruct && p.settings != nullptr) {
if(!p.ptr->isOffTheRecord()) {
if(!p.ptr->persistentStoragePath().isEmpty())
@@ -160,7 +160,7 @@ void profileMenu(QMenu *menu, const std::function<void(WebProfile *)> &callback,
auto *group = new QActionGroup(menu);
QObject::connect(menu, &QMenu::aboutToHide, group, &QActionGroup::deleteLater);
- for(const auto &profile : s_instance->profiles) {
+ for(const auto &profile : qAsConst(s_instance->profiles)) {
auto *action = menu->addAction(profile.ptr->name(), profile.ptr, [profile, callback]() {
callback(profile.ptr);
});