aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md8
-rw-r--r--docs/Design Notes.md23
-rw-r--r--smolbote.qbs7
-rw-r--r--src/blocker/blockermanager.cpp6
-rw-r--r--src/blocker/blockerrule.cpp6
-rw-r--r--src/blocker/blockersubscription.cpp4
-rw-r--r--src/blocker/blockersubscription.h4
-rw-r--r--src/browser.cpp7
-rw-r--r--src/forms/aboutdialog.cpp3
-rw-r--r--src/mainwindow.cpp5
-rw-r--r--src/webengine/urlinterceptor.cpp2
-rw-r--r--src/widgets/downloaditemwidget.cpp2
-rw-r--r--src/widgets/webviewtabbar.cpp2
13 files changed, 60 insertions, 19 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 03e0879..f9869de 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -62,3 +62,11 @@ command line arguments to _-c poi.conf_.
### firejail
Any submitted modifications should work with the provided firejail profile.
+
+### clazy
+You can use [clazy](clazy-git) to check Qt semantics. Requires clang.
+
+To easily set check levels, set the CLAZY_CHECKS environment variable to
+'level0,level1', etc.
+
+[clazy-git]: https://github.com/KDE/clazy
diff --git a/docs/Design Notes.md b/docs/Design Notes.md
new file mode 100644
index 0000000..73ee83e
--- /dev/null
+++ b/docs/Design Notes.md
@@ -0,0 +1,23 @@
+## Features
+The aim of this project is to provide a small and fast web browser.
+
+### General
+* Use generic formats
+
+### Implemented features
+* <todo>
+
+### To do
+* Proper application-level profile manager
+
+## Dependencies
+* Qt, over 5.7 (up-to-date Qt version recommended)
++ qbs, over 1.6.0 (Qt 5.7)
+
+## Notes
+An optional system proxy should be picked up automatically. However, for proxies that require a username or password, you need to connect to QWebEnginePage::proxyAuthenticationRequired.
+
+Qt WebEngine Widgets uses the Qt Quick Scene Graph to compose the page. Therefore, OpenGL support is required.
+And that's also why QML is a dependancy.
+
+To use clang with QtCreator, you need to change the compiler in Build & Run ยป Kits, not the qbs profile.
diff --git a/smolbote.qbs b/smolbote.qbs
index f3b5ee6..a538766 100644
--- a/smolbote.qbs
+++ b/smolbote.qbs
@@ -37,6 +37,11 @@ Project {
}
}
+ // enable clazy if using clang
+ Properties {
+ condition: cpp.compilerName.contains("clang")
+ cpp.cxxFlags: ["-Xclang", "-load", "-Xclang", "ClangLazy.so", "-Xclang", "-add-plugin", "-Xclang", "clang-lazy"]
+ }
// global includes
cpp.includePaths: ['src', 'src/3rd-party']
// global defines
@@ -163,7 +168,7 @@ Project {
Group {
name: "Configuration"
files: [
- "data/poi.conf"
+ "data/poi.toml"
]
qbs.install: true
qbs.installDir: "share/smolbote"
diff --git a/src/blocker/blockermanager.cpp b/src/blocker/blockermanager.cpp
index 16caa98..6e3860d 100644
--- a/src/blocker/blockermanager.cpp
+++ b/src/blocker/blockermanager.cpp
@@ -33,8 +33,10 @@ BlockerManager::BlockerManager(QWidget *parent) :
{
ui->setupUi(this);
- for(QString listUrl : sSettings->value("blocker.subscriptions").toStringList()) {
- BlockerSubscription *sub = new BlockerSubscription(QUrl(listUrl), this);
+ const QStringList subscriptions = sSettings->value("blocker.subscriptions").toStringList();
+ QStringList::const_iterator i;
+ for(i = subscriptions.constBegin(); i != subscriptions.constEnd(); ++i) {
+ BlockerSubscription *sub = new BlockerSubscription(QUrl(*i), this);
m_subscriptions.append(sub);
ui->tabWidget->addTab(sub, sub->name());
}
diff --git a/src/blocker/blockerrule.cpp b/src/blocker/blockerrule.cpp
index f0bfbd6..b9c3730 100644
--- a/src/blocker/blockerrule.cpp
+++ b/src/blocker/blockerrule.cpp
@@ -54,8 +54,10 @@ BlockerRule::BlockerRule(QString rule, QObject *parent) :
QString opts = pattern.mid(pattern.indexOf("$")+1);
pattern.remove(pattern.indexOf("$"), pattern.length());
- for(QString opt : opts.split(',')) {
- parseOption(opt);
+ const QStringList optList = opts.split(',');
+ QStringList::const_iterator i;
+ for(i = optList.constBegin(); i != optList.constEnd(); ++i) {
+ parseOption(*i);
}
}
diff --git a/src/blocker/blockersubscription.cpp b/src/blocker/blockersubscription.cpp
index f5af196..ea95d57 100644
--- a/src/blocker/blockersubscription.cpp
+++ b/src/blocker/blockersubscription.cpp
@@ -70,7 +70,7 @@ BlockerSubscription::MatchResult BlockerSubscription::match(QWebEngineUrlRequest
{
MatchResult result;
- for(BlockerRule* rule : m_urlWhitelist) {
+ for(auto rule : qAsConst(m_urlWhitelist)) {
if(rule->match(info)) {
// this request is whitelisted
result.match = true;
@@ -81,7 +81,7 @@ BlockerSubscription::MatchResult BlockerSubscription::match(QWebEngineUrlRequest
}
// request is not in the whitelist
- for(BlockerRule* rule : m_urlBlacklist) {
+ for(auto rule : qAsConst(m_urlBlacklist)) {
if(rule->match(info)) {
// this request is blacklisted
result.match = true;
diff --git a/src/blocker/blockersubscription.h b/src/blocker/blockersubscription.h
index d3d2b7e..a0e051a 100644
--- a/src/blocker/blockersubscription.h
+++ b/src/blocker/blockersubscription.h
@@ -57,8 +57,8 @@ private:
QString m_name;
QUrl m_url;
- QList<BlockerRule*> m_urlWhitelist; // exception rules
- QList<BlockerRule*> m_urlBlacklist; // block rules
+ QVector<BlockerRule*> m_urlWhitelist; // exception rules
+ QVector<BlockerRule*> m_urlBlacklist; // block rules
};
diff --git a/src/browser.cpp b/src/browser.cpp
index 942df00..75f7d50 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -223,10 +223,11 @@ void Browser::handleNewConnection()
}
socket->waitForReadyRead();
- QStringList urls = QString(socket->readAll()).split('|');
+ const QStringList urls = QString(socket->readAll()).split('|');
delete socket;
- for(QString s : urls) {
- mainWindow()->addNewTab(QUrl::fromUserInput(s));
+ QStringList::const_iterator i;
+ for(i = urls.constBegin(); i != urls.constEnd(); ++i) {
+ mainWindow()->addNewTab(QUrl::fromUserInput(*i));
}
}
diff --git a/src/forms/aboutdialog.cpp b/src/forms/aboutdialog.cpp
index e5dd854..1b8c915 100644
--- a/src/forms/aboutdialog.cpp
+++ b/src/forms/aboutdialog.cpp
@@ -53,8 +53,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
#endif
"Configuration lives in %2"
"</p>")
- .arg(qApp->applicationLongVersion())
- .arg(sSettings->filePath()));
+ .arg(qApp->applicationLongVersion(), sSettings->filePath()));
ui->toolBox->addItem(detailsLabel, tr("Details"));
QLabel *libsLabel = new QLabel(this);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 307835c..7f6cf0d 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -145,8 +145,9 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) :
MainWindow::MainWindow(const QStringList urlList, QWidget *parent) :
MainWindow(QUrl(""), parent)
{
- for(QString url : urlList) {
- addNewTab(QUrl::fromUserInput(url));
+ QStringList::const_iterator i;
+ for(i = urlList.constBegin(); i != urlList.constEnd(); ++i) {
+ addNewTab(QUrl::fromUserInput(*i));
}
}
diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp
index 2a8f816..8643f2c 100644
--- a/src/webengine/urlinterceptor.cpp
+++ b/src/webengine/urlinterceptor.cpp
@@ -32,7 +32,7 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
qDebug("%s", qUtf8Printable(info.requestUrl().toString()));
#endif
- for(BlockerSubscription *s : m_manager->subscriptions()) {
+ for(auto s : m_manager->subscriptions()) {
BlockerSubscription::MatchResult r = s->match(info);
if(r.match) {
info.block(r.block);
diff --git a/src/widgets/downloaditemwidget.cpp b/src/widgets/downloaditemwidget.cpp
index 57ece0a..02fc215 100644
--- a/src/widgets/downloaditemwidget.cpp
+++ b/src/widgets/downloaditemwidget.cpp
@@ -92,7 +92,7 @@ void DownloadItemWidget::updateProgress(qint64 value, qint64 total)
{
ui->progressBar->setMaximum(total);
ui->progressBar->setValue(value);
- ui->filesize_label->setText(QString("%1 / %2").arg(sizeString(value)).arg(sizeString(total)));
+ ui->filesize_label->setText(QString("%1 / %2").arg(sizeString(value), sizeString(total)));
}
void DownloadItemWidget::updateFinished()
diff --git a/src/widgets/webviewtabbar.cpp b/src/widgets/webviewtabbar.cpp
index 9684e11..429b103 100644
--- a/src/widgets/webviewtabbar.cpp
+++ b/src/widgets/webviewtabbar.cpp
@@ -96,7 +96,7 @@ int WebViewTabBar::addTab(QWebEngineProfile *profile, const QUrl &url)
void WebViewTabBar::setProfile(QWebEngineProfile *profile)
{
- for(QWebEngineView *view : m_views) {
+ for(auto view : qAsConst(m_views)) {
QWebEnginePage *page = new QWebEnginePage(profile);
page->load(view->url());
view->setPage(page);