aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-04-17 17:43:38 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-04-17 17:43:38 +0200
commite4ffd8374040d36c22125eeb534d884f56978592 (patch)
tree1917ed64bf8e6e391ebf46de79a6fea41e0dcf68 /src
parentHovering over links shows them in the status bar again (diff)
downloadsmolbote-e4ffd8374040d36c22125eeb534d884f56978592.tar.xz
Style pass
Diffstat (limited to 'src')
-rw-r--r--src/addressbar/addressbar.cpp9
-rw-r--r--src/addressbar/addressbar.h2
-rw-r--r--src/addressbar/urllineedit.h1
-rw-r--r--src/browser.cpp6
-rw-r--r--src/browser.h1
-rw-r--r--src/main.cpp2
-rw-r--r--src/mainwindow/mainwindow.cpp6
-rw-r--r--src/mainwindow/widgets/searchform.cpp20
-rw-r--r--src/webengine/webprofile.h3
-rw-r--r--src/webengine/webview.cpp4
10 files changed, 27 insertions, 27 deletions
diff --git a/src/addressbar/addressbar.cpp b/src/addressbar/addressbar.cpp
index 1c10d69..b86230c 100644
--- a/src/addressbar/addressbar.cpp
+++ b/src/addressbar/addressbar.cpp
@@ -10,8 +10,8 @@
#include "urllineedit.h"
#include "webengine/webview.h"
#include <QProgressBar>
-#include <QVBoxLayout>
#include <QShortcut>
+#include <QVBoxLayout>
AddressBar::AddressBar(const QHash<QString, QString> &config, QWidget *parent)
: QWidget(parent)
@@ -36,7 +36,7 @@ AddressBar::AddressBar(const QHash<QString, QString> &config, QWidget *parent)
urlBar->toolsMenu_action->setToolTip(tr("Tools (%1)").arg(urlBar->toolsMenu_action->shortcut().toString()));
connect(urlBar, &UrlLineEdit::textEdited, [=](const QString &text) {
- std::function<void(QStringList&)> callback = std::bind(&UrlLineEdit::updateCompleter, urlBar, std::placeholders::_1);
+ std::function<void(QStringList &)> callback = std::bind(&UrlLineEdit::updateCompleter, urlBar, std::placeholders::_1);
emit complete(text, callback);
});
@@ -53,7 +53,7 @@ AddressBar::~AddressBar()
disconnect(progressBarConnection);
}
-void AddressBar::connectWebView(WebView* view)
+void AddressBar::connectWebView(WebView *view)
{
disconnect(urlChangedConnection);
disconnect(loadUrlConnection);
@@ -73,7 +73,8 @@ void AddressBar::connectWebView(WebView* view)
urlBar->toolsMenu_action->setMenu(view->toolsMenu());
urlChangedConnection = connect(view, &WebView::urlChanged, urlBar, &UrlLineEdit::setUrl);
loadUrlConnection = connect(urlBar, &UrlLineEdit::returnPressed, [=]() {
- if(urlBar->text().startsWith('#')) {;
+ if(urlBar->text().startsWith('#')) {
+ ;
view->search(urlBar->text().mid(1));
} else {
view->load(QUrl::fromUserInput(urlBar->text()));
diff --git a/src/addressbar/addressbar.h b/src/addressbar/addressbar.h
index 224fb9b..9b8b360 100644
--- a/src/addressbar/addressbar.h
+++ b/src/addressbar/addressbar.h
@@ -24,7 +24,7 @@ public:
~AddressBar() override;
signals:
- void complete(const QString &term, std::function<void(QStringList&)> callback);
+ void complete(const QString &term, std::function<void(QStringList &)> callback);
public slots:
void connectWebView(WebView *view);
diff --git a/src/addressbar/urllineedit.h b/src/addressbar/urllineedit.h
index bc23f58..f27addc 100644
--- a/src/addressbar/urllineedit.h
+++ b/src/addressbar/urllineedit.h
@@ -33,7 +33,6 @@ public:
// devMenu action: scripts, etc
QAction *toolsMenu_action = nullptr;
-
protected:
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
diff --git a/src/browser.cpp b/src/browser.cpp
index e5e83e8..0caae05 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -7,16 +7,16 @@
*/
#include "browser.h"
+#include "addressbar/addressbar.h"
#include "mainwindow/mainwindow.h"
#include "mainwindow/window.h"
+#include "webengine/urlinterceptor.h"
#include "webengine/webprofile.h"
#include <QAction>
-#include <configuration/configuration.h>
#include <bookmarks/bookmarkswidget.h>
+#include <configuration/configuration.h>
#include <downloads/downloadswidget.h>
#include <version.h>
-#include "webengine/urlinterceptor.h"
-#include "addressbar/addressbar.h"
Browser::Browser(int &argc, char *argv[])
: SingleApplication(argc, argv)
diff --git a/src/browser.h b/src/browser.h
index b43d45a..c8e906d 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -42,7 +42,6 @@ private:
std::shared_ptr<UrlRequestInterceptor> m_urlFilter;
QVector<MainWindow *> m_windows;
-
};
#endif // SMOLBOTE_BROWSER_H
diff --git a/src/main.cpp b/src/main.cpp
index 9fd009b..1b4d26f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,11 +6,11 @@
* SPDX-License-Identifier: GPL-3.0
*/
+#include "browser.h"
#include "commandline.h"
#include "mainwindow/mainwindow.h"
#include "version.h"
#include "webengine/webprofile.h"
-#include "browser.h"
#include <configuration/configuration.h>
#include <memory>
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index 18e1b63..c43e001 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -7,8 +7,10 @@
*/
#include "mainwindow.h"
+#include "addressbar/addressbar.h"
#include "webengine/webview.h"
#include "widgets/navigationbar.h"
+#include "widgets/searchform.h"
#include "window.h"
#include <QApplication>
#include <QCloseEvent>
@@ -19,13 +21,11 @@
#include <QMenuBar>
#include <QMessageBox>
#include <QShortcut>
+#include <QStatusBar>
#include <QToolBar>
#include <QUrl>
#include <about/aboutdialog.h>
#include <configuration/configuration.h>
-#include "addressbar/addressbar.h"
-#include <QStatusBar>
-#include "widgets/searchform.h"
MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
: QMainWindow(parent)
diff --git a/src/mainwindow/widgets/searchform.cpp b/src/mainwindow/widgets/searchform.cpp
index 79cc0cf..b400079 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 <QWebEngineView>
#include <QFocusEvent>
+#include <QWebEngineView>
SearchForm::SearchForm(QWidget *parent)
: QWidget(parent)
@@ -22,12 +22,12 @@ SearchForm::SearchForm(QWidget *parent)
connect(ui->lineEdit, &QLineEdit::returnPressed, this, [this]() {
if(view) {
- QWebEnginePage::FindFlags searchFlags;
- searchFlags.setFlag(QWebEnginePage::FindCaseSensitively, ui->caseSensitivity_checkBox->isChecked());
- searchFlags.setFlag(QWebEnginePage::FindBackward, ui->reverseSearch_checkBox->isChecked());
- view->findText(ui->lineEdit->text(), searchFlags, [this](bool found) {
- ui->result_label->setVisible(!found);
- });
+ QWebEnginePage::FindFlags searchFlags;
+ searchFlags.setFlag(QWebEnginePage::FindCaseSensitively, ui->caseSensitivity_checkBox->isChecked());
+ searchFlags.setFlag(QWebEnginePage::FindBackward, ui->reverseSearch_checkBox->isChecked());
+ view->findText(ui->lineEdit->text(), searchFlags, [this](bool found) {
+ ui->result_label->setVisible(!found);
+ });
}
});
}
@@ -37,19 +37,19 @@ SearchForm::~SearchForm()
delete ui;
}
-void SearchForm::setView(QWebEngineView* view)
+void SearchForm::setView(QWebEngineView *view)
{
this->view = view;
}
-void SearchForm::showEvent(QShowEvent* e)
+void SearchForm::showEvent(QShowEvent *e)
{
e->accept();
ui->lineEdit->setFocus();
ui->lineEdit->selectAll();
}
-void SearchForm::hideEvent(QHideEvent* e)
+void SearchForm::hideEvent(QHideEvent *e)
{
e->accept();
// clear highlighted text when hiding
diff --git a/src/webengine/webprofile.h b/src/webengine/webprofile.h
index 1668067..0b3ce7f 100644
--- a/src/webengine/webprofile.h
+++ b/src/webengine/webprofile.h
@@ -34,7 +34,8 @@ public:
}
QString name() const;
- QString search() const {
+ QString search() const
+ {
return m_search;
}
QUrl homepage() const;
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp
index dadac1e..3c4e19e 100644
--- a/src/webengine/webview.cpp
+++ b/src/webengine/webview.cpp
@@ -7,6 +7,7 @@
*/
#include "webview.h"
+#include "mainwindow/window.h"
#include "webpage.h"
#include "webprofile.h"
#include "widgets/pagemenu.h"
@@ -14,7 +15,6 @@
#include <QDialog>
#include <QStatusBar>
#include <QVBoxLayout>
-#include "mainwindow/window.h"
WebView::WebView(WebProfile *profile, QWidget *parent)
: QWebEngineView(parent)
@@ -73,7 +73,7 @@ int WebView::loadProgress() const
return m_loadProgress;
}
-void WebView::search(const QString& term)
+void WebView::search(const QString &term)
{
const QString searchUrl = m_profile->search().arg(QString(QUrl::toPercentEncoding(term)));
load(searchUrl);