aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/about/aboutdialog.cpp14
-rw-r--r--lib/bookmarks/bookmarksview.h1
-rw-r--r--lib/bookmarks/bookmarkswidget.cpp2
-rw-r--r--lib/bookmarks/bookmarkswidget.h4
-rw-r--r--lib/bookmarks/xbel.h2
-rw-r--r--lib/configuration/configuration.h16
-rw-r--r--lib/downloads/widgets/downloaditemwidget.cpp2
-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
17 files changed, 47 insertions, 48 deletions
diff --git a/lib/about/aboutdialog.cpp b/lib/about/aboutdialog.cpp
index ff4200f..1d60eb4 100644
--- a/lib/about/aboutdialog.cpp
+++ b/lib/about/aboutdialog.cpp
@@ -33,7 +33,8 @@ AboutDialog::AboutDialog(QWidget *parent)
auto *aboutLabel = new QLabel(this);
aboutLabel->setWordWrap(true);
aboutLabel->setText(tr("<h2>smolbote %1</h2>"
- "<p><i>yet another no-frills browser</i></p>").arg(qApp->applicationVersion()));
+ "<p><i>yet another no-frills browser</i></p>")
+ .arg(qApp->applicationVersion()));
ui->toolBox->addItem(aboutLabel, tr("About"));
auto *licenseLabel = new QLabel(this);
@@ -53,13 +54,12 @@ AboutDialog::AboutDialog(QWidget *parent)
auto *detailsLabel = new QLabel(this);
detailsLabel->setWordWrap(true);
detailsLabel->setText(tr("<p>Compiled with " compiler "</p>"
- "<p><ul>"
- "<li>Qt " QT_VERSION_STR "</li>"
- "<li>QtWebEngine " QTWEBENGINE_VERSION_STR "</li>"
- "<li>Boost " BOOST_LIB_VERSION " </li>"
- "</ul></p>"));
+ "<p><ul>"
+ "<li>Qt " QT_VERSION_STR "</li>"
+ "<li>QtWebEngine " QTWEBENGINE_VERSION_STR "</li>"
+ "<li>Boost " BOOST_LIB_VERSION " </li>"
+ "</ul></p>"));
ui->toolBox->addItem(detailsLabel, tr("Details"));
-
}
AboutDialog::~AboutDialog()
diff --git a/lib/bookmarks/bookmarksview.h b/lib/bookmarks/bookmarksview.h
index 5b408e0..47b3f9c 100644
--- a/lib/bookmarks/bookmarksview.h
+++ b/lib/bookmarks/bookmarksview.h
@@ -34,5 +34,4 @@ private:
QIcon bookmarkIcon;
};
-
#endif // SMOLBOTE_BOOKMARKSVIEW_H
diff --git a/lib/bookmarks/bookmarkswidget.cpp b/lib/bookmarks/bookmarkswidget.cpp
index 339e913..cae1eb3 100644
--- a/lib/bookmarks/bookmarkswidget.cpp
+++ b/lib/bookmarks/bookmarkswidget.cpp
@@ -129,7 +129,7 @@ void BookmarksWidget::save()
}
}
-void BookmarksWidget::search(const QString& term, std::function<void(QStringList&)> callback) const
+void BookmarksWidget::search(const QString &term, std::function<void(QStringList &)> callback) const
{
QStringList ret;
const QList<QTreeWidgetItem *> res = ui->treeWidget->findItems(term, Qt::MatchContains | Qt::MatchRecursive, 1);
diff --git a/lib/bookmarks/bookmarkswidget.h b/lib/bookmarks/bookmarkswidget.h
index 6322918..40f5c04 100644
--- a/lib/bookmarks/bookmarkswidget.h
+++ b/lib/bookmarks/bookmarkswidget.h
@@ -9,9 +9,9 @@
#ifndef BOOKMARKSDIALOG_H
#define BOOKMARKSDIALOG_H
+#include <QFile>
#include <QShortcut>
#include <QWidget>
-#include <QFile>
#include <functional>
namespace Ui
@@ -35,7 +35,7 @@ signals:
void openUrl(const QUrl &url);
public slots:
- void search(const QString &term, std::function<void(QStringList&)> callback) const;
+ void search(const QString &term, std::function<void(QStringList &)> callback) const;
private:
Ui::BookmarksDialog *ui;
diff --git a/lib/bookmarks/xbel.h b/lib/bookmarks/xbel.h
index 6981627..ecc185a 100644
--- a/lib/bookmarks/xbel.h
+++ b/lib/bookmarks/xbel.h
@@ -9,9 +9,9 @@
#ifndef XBELREADER_H
#define XBELREADER_H
+#include "bookmarksview.h"
#include <QString>
#include <QXmlStreamReader>
-#include "bookmarksview.h"
class XbelReader
{
diff --git a/lib/configuration/configuration.h b/lib/configuration/configuration.h
index 1c919b0..c5e044f 100644
--- a/lib/configuration/configuration.h
+++ b/lib/configuration/configuration.h
@@ -9,13 +9,13 @@
#ifndef SMOLBOTE_CONFIGURATION_H
#define SMOLBOTE_CONFIGURATION_H
-#include <optional>
-#include <string>
-#include <vector>
#include <QString>
-#include <boost/program_options.hpp>
#include <QStringList>
#include <QVariant>
+#include <boost/program_options.hpp>
+#include <optional>
+#include <string>
+#include <vector>
class Configuration
{
@@ -43,16 +43,15 @@ public:
std::string r;
try {
r = vm[path].as<std::string>();
- } catch (boost::bad_any_cast &) {
+ } catch(boost::bad_any_cast &) {
// try int
try {
r = std::to_string(vm[path].as<int>());
- } catch (boost::bad_any_cast &) {
+ } catch(boost::bad_any_cast &) {
// try bool, and crash if not that either
r = vm[path].as<bool>() ? "true" : "false";
}
-
}
// check if it's a path
@@ -65,7 +64,8 @@ public:
return std::optional<T>(vm[path].as<T>());
}
- const std::vector<boost::shared_ptr<boost::program_options::option_description>> & options() {
+ const std::vector<boost::shared_ptr<boost::program_options::option_description>> &options()
+ {
return desc.options();
}
diff --git a/lib/downloads/widgets/downloaditemwidget.cpp b/lib/downloads/widgets/downloaditemwidget.cpp
index 576ae0c..2790c5c 100644
--- a/lib/downloads/widgets/downloaditemwidget.cpp
+++ b/lib/downloads/widgets/downloaditemwidget.cpp
@@ -8,8 +8,8 @@
#include "downloaditemwidget.h"
#include "ui_downloaditemform.h"
-#include <QUrl>
#include <QStyle>
+#include <QUrl>
DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *parent)
: QWidget(parent)
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);