mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-07 04:06:02 +00:00
feat: show browser settings in the profile section
This commit is contained in:
parent
af2af0700c
commit
c04f89d8fa
@ -9,7 +9,6 @@ import "../../../shared/status"
|
||||
import "../../../imports"
|
||||
|
||||
Rectangle {
|
||||
property alias browserSettings: browserSettings
|
||||
property alias addressBar: addressBar
|
||||
readonly property int innerMargin: 12
|
||||
property var addNewTab: function () {}
|
||||
@ -20,19 +19,6 @@ Rectangle {
|
||||
color: Style.current.background
|
||||
border.width: 0
|
||||
|
||||
Settings {
|
||||
id : browserSettings
|
||||
property alias autoLoadImages: loadImages.checked
|
||||
property alias javaScriptEnabled: javaScriptEnabled.checked
|
||||
property alias errorPageEnabled: errorPageEnabled.checked
|
||||
property alias pluginsEnabled: pluginsEnabled.checked
|
||||
property alias autoLoadIconsForPage: autoLoadIconsForPage.checked
|
||||
property alias touchIconsEnabled: touchIconsEnabled.checked
|
||||
property alias webRTCPublicInterfacesOnly : webRTCPublicInterfacesOnly.checked
|
||||
property alias devToolsEnabled: devToolsEnabled.checked
|
||||
property alias pdfViewerEnabled: pdfViewerEnabled.checked
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: root.innerMargin
|
||||
@ -177,79 +163,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO move these to profile settings
|
||||
Menu {
|
||||
id: settingsMenuOld
|
||||
y: settingsMenuButton.height
|
||||
x: settingsMenuButton.x
|
||||
MenuItem {
|
||||
id: loadImages
|
||||
text: "Autoload images"
|
||||
checkable: true
|
||||
checked: WebEngine.settings.autoLoadImages
|
||||
}
|
||||
MenuItem {
|
||||
id: javaScriptEnabled
|
||||
text: "JavaScript On"
|
||||
checkable: true
|
||||
checked: WebEngine.settings.javascriptEnabled
|
||||
}
|
||||
MenuItem {
|
||||
id: errorPageEnabled
|
||||
text: "ErrorPage On"
|
||||
checkable: true
|
||||
checked: WebEngine.settings.errorPageEnabled
|
||||
}
|
||||
MenuItem {
|
||||
id: pluginsEnabled
|
||||
text: "Plugins On"
|
||||
checkable: true
|
||||
checked: true
|
||||
}
|
||||
MenuItem {
|
||||
id: httpDiskCacheEnabled
|
||||
text: "HTTP Disk Cache"
|
||||
checkable: currentWebView && !currentWebView.profile.offTheRecord
|
||||
checked: currentWebView && (currentWebView.profile.httpCacheType === WebEngineProfile.DiskHttpCache)
|
||||
onToggled: function(checked) {
|
||||
if (currentWebView) {
|
||||
currentWebView.profile.httpCacheType = checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache;
|
||||
}
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
id: autoLoadIconsForPage
|
||||
text: "Icons On"
|
||||
checkable: true
|
||||
checked: WebEngine.settings.autoLoadIconsForPage
|
||||
}
|
||||
MenuItem {
|
||||
id: touchIconsEnabled
|
||||
text: "Touch Icons On"
|
||||
checkable: true
|
||||
checked: WebEngine.settings.touchIconsEnabled
|
||||
enabled: autoLoadIconsForPage.checked
|
||||
}
|
||||
MenuItem {
|
||||
id: webRTCPublicInterfacesOnly
|
||||
text: "WebRTC Public Interfaces Only"
|
||||
checkable: true
|
||||
checked: WebEngine.settings.webRTCPublicInterfacesOnly
|
||||
}
|
||||
MenuItem {
|
||||
id: devToolsEnabled
|
||||
text: "Open DevTools"
|
||||
checkable: true
|
||||
checked: false
|
||||
}
|
||||
MenuItem {
|
||||
id: pdfViewerEnabled
|
||||
text: "PDF viewer enabled"
|
||||
checkable: true
|
||||
checked: WebEngine.settings.pdfViewerEnabled
|
||||
}
|
||||
}
|
||||
|
||||
BrowserSettingsMenu {
|
||||
id: settingsMenu
|
||||
addNewTab: root.addNewTab
|
||||
|
@ -506,14 +506,14 @@ Rectangle {
|
||||
zoomFactor = newFactor
|
||||
}
|
||||
|
||||
settings.autoLoadImages: browserHeader.browserSettings.autoLoadImages
|
||||
settings.javascriptEnabled: browserHeader.browserSettings.javaScriptEnabled
|
||||
settings.errorPageEnabled: browserHeader.browserSettings.errorPageEnabled
|
||||
settings.pluginsEnabled: browserHeader.browserSettings.pluginsEnabled
|
||||
settings.autoLoadIconsForPage: browserHeader.browserSettings.autoLoadIconsForPage
|
||||
settings.touchIconsEnabled: browserHeader.browserSettings.touchIconsEnabled
|
||||
settings.webRTCPublicInterfacesOnly: browserHeader.browserSettings.webRTCPublicInterfacesOnly
|
||||
settings.pdfViewerEnabled: browserHeader.browserSettings.pdfViewerEnabled
|
||||
settings.autoLoadImages: appSettings.autoLoadImages
|
||||
settings.javascriptEnabled: appSettings.javaScriptEnabled
|
||||
settings.errorPageEnabled: appSettings.errorPageEnabled
|
||||
settings.pluginsEnabled: appSettings.pluginsEnabled
|
||||
settings.autoLoadIconsForPage: appSettings.autoLoadIconsForPage
|
||||
settings.touchIconsEnabled: appSettings.touchIconsEnabled
|
||||
settings.webRTCPublicInterfacesOnly: appSettings.webRTCPublicInterfacesOnly
|
||||
settings.pdfViewerEnabled: appSettings.pdfViewerEnabled
|
||||
|
||||
onCertificateError: function(error) {
|
||||
error.defer();
|
||||
@ -685,7 +685,7 @@ Rectangle {
|
||||
|
||||
WebEngineView {
|
||||
id: devToolsView
|
||||
visible: browserHeader.browserSettings.devToolsEnabled
|
||||
visible: appSettings.devToolsEnabled
|
||||
height: visible ? 400 : 0
|
||||
inspectedView: visible && tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item : null
|
||||
anchors.left: parent.left
|
||||
|
@ -74,7 +74,7 @@ PopupMenu {
|
||||
text: qsTr("Developper Tools")
|
||||
shortcut: "F12"
|
||||
onTriggered: {
|
||||
browserHeader.browserSettings.devToolsEnabled = !browserHeader.browserSettings.devToolsEnabled
|
||||
appSettings.devToolsEnabled = !appSettings.devToolsEnabled
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
|
||||
StyledText {
|
||||
id: titl
|
||||
id: title
|
||||
text: qsTr("Browser Settings")
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 24
|
||||
@ -21,7 +21,122 @@ Item {
|
||||
font.pixelSize: 20
|
||||
}
|
||||
|
||||
// TODO add browser settings here
|
||||
Column {
|
||||
spacing: Style.current.padding
|
||||
anchors.top: title.bottom
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 24
|
||||
|
||||
RowLayout {
|
||||
StyledText {
|
||||
text: qsTr("Autoload images")
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: appSettings.autoLoadImages
|
||||
onCheckedChanged: function() {
|
||||
appSettings.autoLoadImages = this.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
StyledText {
|
||||
text: qsTr("JavaScript On")
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: appSettings.javaScriptEnabled
|
||||
onCheckedChanged: function() {
|
||||
appSettings.javaScriptEnabled = this.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
StyledText {
|
||||
text: qsTr("Error Page On")
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: appSettings.errorPageEnabled
|
||||
onCheckedChanged: function() {
|
||||
appSettings.errorPageEnabled = this.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
StyledText {
|
||||
text: qsTr("Plugins On")
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: appSettings.pluginsEnabled
|
||||
onCheckedChanged: function() {
|
||||
appSettings.pluginsEnabled = this.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
StyledText {
|
||||
text: qsTr("Icons On")
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: appSettings.autoLoadIconsForPage
|
||||
onCheckedChanged: function() {
|
||||
appSettings.autoLoadIconsForPage = this.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
StyledText {
|
||||
text: qsTr("Touch Icons On")
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: appSettings.touchIconsEnabled
|
||||
onCheckedChanged: function() {
|
||||
appSettings.touchIconsEnabled = this.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
StyledText {
|
||||
text: qsTr("WebRTC Public Interfaces Only")
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: appSettings.webRTCPublicInterfacesOnly
|
||||
onCheckedChanged: function() {
|
||||
appSettings.webRTCPublicInterfacesOnly = this.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
StyledText {
|
||||
text: qsTr("PDF viewer enabled")
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: appSettings.pdfViewerEnabled
|
||||
onCheckedChanged: function() {
|
||||
appSettings.pdfViewerEnabled = this.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO find what to do with this one
|
||||
// MenuItem {
|
||||
// id: httpDiskCacheEnabled
|
||||
// text: "HTTP Disk Cache"
|
||||
// checkable: currentWebView && !currentWebView.profile.offTheRecord
|
||||
// checked: currentWebView && (currentWebView.profile.httpCacheType === WebEngineProfile.DiskHttpCache)
|
||||
// onToggled: function(checked) {
|
||||
// if (currentWebView) {
|
||||
// currentWebView.profile.httpCacheType = checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/*##^##
|
||||
|
12
ui/main.qml
12
ui/main.qml
@ -81,7 +81,19 @@ ApplicationWindow {
|
||||
property real volume: 0.2
|
||||
property int notificationSetting: 0
|
||||
property bool notificationSoundsEnabled: true
|
||||
|
||||
// Browser settings
|
||||
property bool autoLoadImages: true
|
||||
property bool javaScriptEnabled: true
|
||||
property bool errorPageEnabled: true
|
||||
property bool pluginsEnabled: true
|
||||
property bool autoLoadIconsForPage: true
|
||||
property bool touchIconsEnabled: true
|
||||
property bool webRTCPublicInterfacesOnly: false
|
||||
property bool devToolsEnabled: false
|
||||
property bool pdfViewerEnabled: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: profileModel
|
||||
onProfileSettingsFileChanged: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user