diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-06-22 19:37:31 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-06-22 19:37:31 +0200 |
commit | 657e13760365aad3ab358b237060bf2356fc4a80 (patch) | |
tree | 339d530885a32fade0b9c4f77a9683111b00796c /src | |
parent | Plugin commands no longer require --command (diff) | |
download | smolbote-657e13760365aad3ab358b237060bf2356fc4a80.tar.xz |
clang-format pass
Diffstat (limited to 'src')
-rw-r--r-- | src/browser.cpp | 22 | ||||
-rw-r--r-- | src/browser.h | 6 | ||||
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 20 | ||||
-rw-r--r-- | src/mainwindow/mainwindow.h | 2 | ||||
-rw-r--r-- | src/mainwindow/subwindow.cpp | 2 | ||||
-rw-r--r-- | src/mainwindow/widgets/dockwidget.h | 2 | ||||
-rw-r--r-- | src/mainwindow/widgets/searchform.cpp | 2 | ||||
-rw-r--r-- | src/mainwindow/widgets/tabwidget.cpp | 2 | ||||
-rw-r--r-- | src/webengine/urlinterceptor.cpp | 14 | ||||
-rw-r--r-- | src/webengine/webpage.cpp | 2 | ||||
-rw-r--r-- | src/webengine/webview.h | 3 | ||||
-rw-r--r-- | src/webengine/widgets/pagemenu.cpp | 4 |
12 files changed, 38 insertions, 43 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index f2c7314..e26dbc8 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -11,18 +11,18 @@ #include "mainwindow/mainwindow.h" #include "mainwindow/subwindow.h" #include "webengine/urlinterceptor.h" -#include <webprofile.h> #include <QAction> -#include <bookmarks/bookmarkswidget.h> -#include <configuration/configuration.h> -#include <downloads/downloadswidget.h> -#include <version.h> #include <QDir> #include <QFileInfo> #include <QFileInfoList> -#include <QPluginLoader> #include <QJsonArray> +#include <QPluginLoader> #include <about/aboutdialog.h> +#include <bookmarks/bookmarkswidget.h> +#include <configuration/configuration.h> +#include <downloads/downloadswidget.h> +#include <version.h> +#include <webprofile.h> Browser::Browser(int &argc, char *argv[]) : SingleApplication(argc, argv) @@ -38,8 +38,7 @@ Browser::~Browser() m_bookmarks->save(); qDeleteAll(m_windows); - m_windows.clear(); - + m_windows.clear(); } void Browser::about() @@ -84,7 +83,7 @@ void Browser::setup(const QString &defaultProfile) const QDir profilesDir(m_config->value<QString>("profile.path").value()); if(profilesDir.exists()) { - const auto entries = profilesDir.entryInfoList({"*.profile"}, QDir::Files | QDir::Readable, QDir::Time); + const auto entries = profilesDir.entryInfoList({ "*.profile" }, QDir::Files | QDir::Readable, QDir::Time); for(const QFileInfo &f : entries) { auto name = f.baseName(); @@ -125,9 +124,6 @@ void Browser::setup(const QString &defaultProfile) // downloads m_downloads = std::make_shared<DownloadsWidget>(QString::fromStdString(m_config->value<std::string>("downloads.path").value())); connect(WebProfile::defaultProfile(), &WebProfile::downloadRequested, m_downloads.get(), &DownloadsWidget::addDownload); - - - } WebProfile *Browser::profile(const QString &name) const @@ -146,7 +142,7 @@ void Browser::createSession(const QString &profileName, bool newWindow, const QS auto *mainwindow = m_windows.last(); if(newWindow) { - QString firstUrl;// = WebProfile::defaultProfile()->homepage(); + QString firstUrl; // = WebProfile::defaultProfile()->homepage(); if(!urls.isEmpty()) firstUrl = urls.at(0); auto *w = mainwindow->createSubWindow(firstUrl); diff --git a/src/browser.h b/src/browser.h index 821583a..c16e495 100644 --- a/src/browser.h +++ b/src/browser.h @@ -12,9 +12,9 @@ #include "singleapplication.h" #include <QJsonObject> #include <QVector> -#include <memory> -#include <interfaces.h> #include <functional> +#include <interfaces.h> +#include <memory> QVector<Plugin> loadPlugins(const QString &location); @@ -66,7 +66,7 @@ private: std::shared_ptr<DownloadsWidget> m_downloads; std::shared_ptr<UrlRequestInterceptor> m_urlFilter; - QMap<QString, WebProfile*> m_profiles; + QMap<QString, WebProfile *> m_profiles; QVector<MainWindow *> m_windows; QVector<Plugin> m_plugins; }; diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 2b6eb07..e885513 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -8,14 +8,16 @@ #include "mainwindow.h" #include "addressbar/addressbar.h" +#include "browser.h" +#include "subwindow.h" #include "webengine/webview.h" +#include "widgets/dockwidget.h" #include "widgets/navigationbar.h" #include "widgets/searchform.h" -#include "subwindow.h" -#include "browser.h" #include <QApplication> #include <QCloseEvent> -#include "widgets/dockwidget.h" +#include <QJsonArray> +#include <QJsonObject> #include <QLineEdit> #include <QMdiArea> #include <QMdiSubWindow> @@ -26,9 +28,6 @@ #include <QToolBar> #include <QUrl> #include <configuration/configuration.h> -#include <QJsonObject> -#include <QJsonArray> -#include "browser.h" #ifdef PLASMA_BLUR #include <KWindowEffects> @@ -113,7 +112,6 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent) } }); - // search box auto *searchShortcut = new QShortcut(QKeySequence(config->value<std::string>("mainwindow.shortcuts.search").value().c_str()), this); connect(searchShortcut, &QShortcut::activated, this, [=]() { @@ -147,17 +145,19 @@ void MainWindow::createMenuBar() auto *smolboteMenu = menuBar()->addMenu(qApp->applicationDisplayName()); smolboteMenu->addAction(tr("New subwindow"), this, [this]() { createSubWindow(); - }, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.newGroup").value().c_str())); + }, + QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.newGroup").value().c_str())); smolboteMenu->addAction(tr("New window"), this, []() { auto *browser = qobject_cast<Browser *>(qApp); if(browser) browser->createWindow(); - }, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.newWindow").value().c_str())); + }, + QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.newWindow").value().c_str())); smolboteMenu->addSeparator(); - smolboteMenu->addAction(tr("About"), qobject_cast<Browser*>(qApp), &Browser::about, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.about").value().c_str())); + smolboteMenu->addAction(tr("About"), qobject_cast<Browser *>(qApp), &Browser::about, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.about").value().c_str())); smolboteMenu->addAction(tr("About Qt"), qApp, &QApplication::aboutQt); smolboteMenu->addSeparator(); diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h index 30d2178..7974806 100644 --- a/src/mainwindow/mainwindow.h +++ b/src/mainwindow/mainwindow.h @@ -10,8 +10,8 @@ #define SMOLBOTE_MAINWINDOW_H #include <QMainWindow> -#include <memory> #include <QUrl> +#include <memory> class Browser; class QMdiArea; diff --git a/src/mainwindow/subwindow.cpp b/src/mainwindow/subwindow.cpp index c282dd9..2b9cd48 100644 --- a/src/mainwindow/subwindow.cpp +++ b/src/mainwindow/subwindow.cpp @@ -8,7 +8,6 @@ #include "subwindow.h" #include "browser.h" -#include <webprofile.h> #include "webengine/webview.h" #include "widgets/tabwidget.h" #include <QAction> @@ -19,6 +18,7 @@ #include <QShortcut> #include <QStyle> #include <QToolButton> +#include <webprofile.h> SubWindow::SubWindow(const QHash<QString, QString> &config, QWidget *parent, Qt::WindowFlags flags) : QMdiSubWindow(parent, flags) diff --git a/src/mainwindow/widgets/dockwidget.h b/src/mainwindow/widgets/dockwidget.h index 35a4cc7..c570ca0 100644 --- a/src/mainwindow/widgets/dockwidget.h +++ b/src/mainwindow/widgets/dockwidget.h @@ -11,13 +11,11 @@ #include <QDockWidget> - class DockWidget : public QDockWidget { public: DockWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); ~DockWidget(); - }; #endif // SMOLBOTE_DOCKWIDGET_H diff --git a/src/mainwindow/widgets/searchform.cpp b/src/mainwindow/widgets/searchform.cpp index c6038ff..efdb4ba 100644 --- a/src/mainwindow/widgets/searchform.cpp +++ b/src/mainwindow/widgets/searchform.cpp @@ -8,8 +8,8 @@ #include "searchform.h" #include "ui_searchform.h" -#include <QShowEvent> #include <QHideEvent> +#include <QShowEvent> #include <QWebEngineView> SearchForm::SearchForm(QWidget *parent) diff --git a/src/mainwindow/widgets/tabwidget.cpp b/src/mainwindow/widgets/tabwidget.cpp index 22e3f9a..1ddfc95 100644 --- a/src/mainwindow/widgets/tabwidget.cpp +++ b/src/mainwindow/widgets/tabwidget.cpp @@ -7,12 +7,12 @@ */ #include "tabwidget.h" +#include "browser.h" #include "webengine/webview.h" #include <QAction> #include <QContextMenuEvent> #include <QMenu> #include <QTabBar> -#include "browser.h" #include <webprofile.h> TabWidget::TabWidget(QWidget *parent) diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp index 5e17e78..815018b 100644 --- a/src/webengine/urlinterceptor.cpp +++ b/src/webengine/urlinterceptor.cpp @@ -75,13 +75,13 @@ QHash<QString, UrlRequestInterceptor::HostRule> parse(const QString &filename) } } -// for(const QString &host : parts.mid(1)) { -// if(!rules.contains(host)) { -// UrlRequestInterceptor::HostRule rule{}; -// rule.isBlocking = redirect == "0.0.0.0"; -// rules.insert(host, rule); -// } -// } + // for(const QString &host : parts.mid(1)) { + // if(!rules.contains(host)) { + // UrlRequestInterceptor::HostRule rule{}; + // rule.isBlocking = redirect == "0.0.0.0"; + // rules.insert(host, rule); + // } + // } } hostfile.close(); diff --git a/src/webengine/webpage.cpp b/src/webengine/webpage.cpp index 7358223..b075fa1 100644 --- a/src/webengine/webpage.cpp +++ b/src/webengine/webpage.cpp @@ -84,7 +84,7 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool auto count = layout->count(); if(count > 1) { - for (int i = 0; i < count; ++i) { + for(int i = 0; i < count; ++i) { auto *item = layout->itemAt(i); if(item == nullptr) continue; diff --git a/src/webengine/webview.h b/src/webengine/webview.h index 4d648d7..0717e27 100644 --- a/src/webengine/webview.h +++ b/src/webengine/webview.h @@ -38,7 +38,8 @@ public: return m_toolsMenu; } - WebProfile *profile() { + WebProfile *profile() + { return m_profile; } void setProfile(WebProfile *profile); diff --git a/src/webengine/widgets/pagemenu.cpp b/src/webengine/widgets/pagemenu.cpp index 21efd3d..efd176b 100644 --- a/src/webengine/widgets/pagemenu.cpp +++ b/src/webengine/widgets/pagemenu.cpp @@ -8,7 +8,7 @@ #include "pagemenu.h" #include "../webview.h" -#include <webprofile.h> +#include "browser.h" #include <QFileDialog> #include <QLabel> #include <QPrintDialog> @@ -18,8 +18,8 @@ #include <QToolButton> #include <QVBoxLayout> #include <QWidgetAction> -#include "browser.h" #include <bookmarks/bookmarkswidget.h> +#include <webprofile.h> PageMenu::PageMenu(WebView *parent) : QMenu(tr("Page"), parent) |