1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 04:36:34 +01:00

Preferences: Add DNS Prefetch option

Requires QtWebEngine 5.12
This commit is contained in:
David Rosca 2018-12-25 11:47:35 +01:00
parent 38ea9974b4
commit 5fcd29c507
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 18 additions and 1 deletions

View File

@ -941,6 +941,10 @@ void MainApplication::loadSettings()
webSettings->setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes);
#endif
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
webSettings->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, settings.value(QSL("DNSPrefetch"), true).toBool());
#endif
webSettings->setDefaultTextEncoding(settings.value(QSL("DefaultEncoding"), webSettings->defaultTextEncoding()).toString());
setWheelScrollLines(settings.value(QSL("wheelScrollLines"), wheelScrollLines()).toInt());

View File

@ -116,6 +116,10 @@ Preferences::Preferences(BrowserWindow* window)
ui->webRTCPublicIpOnly->setVisible(false);
#endif
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 12, 0)
ui->dnsPrefetech->setVisible(false);
#endif
auto setCategoryIcon = [this](int index, const QIcon &icon) {
ui->listWidget->item(index)->setIcon(QIcon(icon.pixmap(32)));
};
@ -288,6 +292,7 @@ Preferences::Preferences(BrowserWindow* window)
ui->useNativeScrollbars->setChecked(settings.value("UseNativeScrollbars", false).toBool());
ui->disableVideoAutoPlay->setChecked(settings.value("DisableVideoAutoPlay", false).toBool());
ui->webRTCPublicIpOnly->setChecked(settings.value("WebRTCPublicIpOnly", true).toBool());
ui->dnsPrefetch->setChecked(settings.value("DNSPrefetch", true).toBool());
foreach (int level, WebView::zoomLevels()) {
ui->defaultZoomLevel->addItem(QString("%1%").arg(level));
@ -943,6 +948,7 @@ void Preferences::saveSettings()
settings.setValue("UseNativeScrollbars", ui->useNativeScrollbars->isChecked());
settings.setValue("DisableVideoAutoPlay", ui->disableVideoAutoPlay->isChecked());
settings.setValue("WebRTCPublicIpOnly", ui->webRTCPublicIpOnly->isChecked());
settings.setValue("DNSPrefetch", ui->dnsPrefetch->isChecked());
#ifdef Q_OS_WIN
settings.setValue("CheckDefaultBrowser", ui->checkDefaultBrowser->isChecked());

View File

@ -1075,6 +1075,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="dnsPrefetch">
<property name="text">
<string>Enable DNS prefetching</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
@ -2394,7 +2401,7 @@
<x>0</x>
<y>0</y>
<width>96</width>
<height>31</height>
<height>28</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_14">