aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
10 files changed, 23 insertions, 18 deletions
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);