feat: add ethereum explorer setting in the profile

This commit is contained in:
Jonathan Rainville 2021-01-04 16:23:20 -05:00 committed by Iuri Matias
parent ac4404c565
commit 6ed0d30fc5
5 changed files with 87 additions and 3 deletions

View File

@ -16,6 +16,7 @@ Item {
} }
property Component homePagePopup: HomepageModal {} property Component homePagePopup: HomepageModal {}
property Component searchEngineModal: SearchEngineModal {} property Component searchEngineModal: SearchEngineModal {}
property Component ethereumExplorerModal: EthereumExplorerModal {}
Column { Column {
id: generalColumn id: generalColumn
@ -67,11 +68,17 @@ Item {
StatusSettingsLineButton { StatusSettingsLineButton {
id: ethereumExplorerBtn id: ethereumExplorerBtn
text: qsTr("Ethereum explorer used in the address bar") text: qsTr("Ethereum explorer used in the address bar")
currentValue: qsTr("None") currentValue: {
onClicked: function () { switch (appSettings.browserEthereumExplorer) {
console.log('Change ethereum explorer') case Constants.browserEthereumExplorerEtherscan: return "etherscan.io"
case Constants.browserEthereumExplorerEthplorer: return "ethplorer.io"
case Constants.browserEthereumExplorerBlockchair: return "blockchair.com"
case Constants.browserSearchEngineNone:
default: return qsTr("None")
} }
} }
onClicked: ethereumExplorerModal.createObject(root).open()
}
StyledText { StyledText {
text: qsTr("Open an ethereum explorer after a transaction hash or an address is entered") text: qsTr("Open an ethereum explorer after a transaction hash or an address is entered")
font.pixelSize: 15 font.pixelSize: 15

View File

@ -0,0 +1,69 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../../imports"
import "../../../../../shared"
import "../../../../../shared/status"
ModalPopup {
id: popup
title: qsTr("Ethereum explorer")
onClosed: {
destroy()
}
Column {
spacing: Style.current.bigPadding
width: parent.width
ButtonGroup {
id: searchEnginGroup
}
StatusRadioButton {
text: qsTr("None")
ButtonGroup.group: searchEnginGroup
checked: appSettings.browserEthereumExplorer === Constants.browserEthereumExplorerNone
onCheckedChanged: {
if (checked) {
appSettings.browserEthereumExplorer = Constants.browserEthereumExplorerNone
}
}
}
StatusRadioButton {
text: "etherscan.io"
ButtonGroup.group: searchEnginGroup
checked: appSettings.browserEthereumExplorer === Constants.browserEthereumExplorerEtherscan
onCheckedChanged: {
if (checked) {
appSettings.browserEthereumExplorer = Constants.browserEthereumExplorerEtherscan
}
}
}
StatusRadioButton {
text: "ethplorer.io"
ButtonGroup.group: searchEnginGroup
checked: appSettings.browserEthereumExplorer === Constants.browserEthereumExplorerEthplorer
onCheckedChanged: {
if (checked) {
appSettings.browserEthereumExplorer = Constants.browserEthereumExplorerEthplorer
}
}
}
StatusRadioButton {
text: "blockchair.com"
ButtonGroup.group: searchEnginGroup
checked: appSettings.browserEthereumExplorer === Constants.browserEthereumExplorerBlockchair
onCheckedChanged: {
if (checked) {
appSettings.browserEthereumExplorer = Constants.browserEthereumExplorerBlockchair
}
}
}
}
}

View File

@ -105,4 +105,9 @@ QtObject {
readonly property int browserSearchEngineGoogle: 1 readonly property int browserSearchEngineGoogle: 1
readonly property int browserSearchEngineYahoo: 2 readonly property int browserSearchEngineYahoo: 2
readonly property int browserSearchEngineDuckDuckGo: 3 readonly property int browserSearchEngineDuckDuckGo: 3
readonly property int browserEthereumExplorerNone: 0
readonly property int browserEthereumExplorerEtherscan: 1
readonly property int browserEthereumExplorerEthplorer: 2
readonly property int browserEthereumExplorerBlockchair: 3
} }

View File

@ -119,6 +119,7 @@ ApplicationWindow {
property bool showFavoritesBar: false property bool showFavoritesBar: false
property string browserHomepage: "" property string browserHomepage: ""
property int browserSearchEngine: Constants.browserSearchEngineNone property int browserSearchEngine: Constants.browserSearchEngineNone
property int browserEthereumExplorer: Constants.browserEthereumExplorerNone
property bool autoLoadImages: true property bool autoLoadImages: true
property bool javaScriptEnabled: true property bool javaScriptEnabled: true
property bool errorPageEnabled: true property bool errorPageEnabled: true
@ -162,6 +163,7 @@ ApplicationWindow {
property bool showFavoritesBar: defaultAppSettings.showFavoritesBar property bool showFavoritesBar: defaultAppSettings.showFavoritesBar
property string browserHomepage: defaultAppSettings.browserHomepage property string browserHomepage: defaultAppSettings.browserHomepage
property int browserSearchEngine: defaultAppSettings.browserSearchEngine property int browserSearchEngine: defaultAppSettings.browserSearchEngine
property int browserEthereumExplorer: defaultAppSettings.browserEthereumExplorer
property bool autoLoadImages: defaultAppSettings.autoLoadImages property bool autoLoadImages: defaultAppSettings.autoLoadImages
property bool javaScriptEnabled: defaultAppSettings.javaScriptEnabled property bool javaScriptEnabled: defaultAppSettings.javaScriptEnabled
property bool errorPageEnabled: defaultAppSettings.errorPageEnabled property bool errorPageEnabled: defaultAppSettings.errorPageEnabled

View File

@ -185,6 +185,7 @@ DISTFILES += \
app/AppLayouts/Profile/Sections/AppearanceContainer.qml \ app/AppLayouts/Profile/Sections/AppearanceContainer.qml \
app/AppLayouts/Profile/Sections/BackupSeedModal.qml \ app/AppLayouts/Profile/Sections/BackupSeedModal.qml \
app/AppLayouts/Profile/Sections/BrowserContainer.qml \ app/AppLayouts/Profile/Sections/BrowserContainer.qml \
app/AppLayouts/Profile/Sections/BrowserModals/EthereumExplorerModal.qml \
app/AppLayouts/Profile/Sections/BrowserModals/HomepageModal.qml \ app/AppLayouts/Profile/Sections/BrowserModals/HomepageModal.qml \
app/AppLayouts/Profile/Sections/BrowserModals/SearchEngineModal.qml \ app/AppLayouts/Profile/Sections/BrowserModals/SearchEngineModal.qml \
app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml \ app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml \