diff --git a/ui/app/AppLayouts/Profile/controls/FleetRadioSelector.qml b/ui/app/AppLayouts/Profile/controls/FleetRadioSelector.qml index 867d3aab23..d4d05b8b85 100644 --- a/ui/app/AppLayouts/Profile/controls/FleetRadioSelector.qml +++ b/ui/app/AppLayouts/Profile/controls/FleetRadioSelector.qml @@ -3,21 +3,23 @@ import QtQuick.Controls 2.13 import QtQuick.Layouts 1.13 import utils 1.0 -import "../../../../shared" -import "../../../../shared/popups" -import "../../../../shared/status" -// TODO: replace with StatusQ component -StatusRadioButtonRow { +import "../../../../shared/controls" +import "../../../../shared/popups" + +RadioButtonSelector { + id: root + property string fleetName: "" property string newFleet: "" - text: fleetName - buttonGroup: fleetSettings - checked: profileModel.fleets.fleet === text - onRadioCheckedChanged: { + + title: fleetName + checked: profileModel.fleets.fleet === root.fleetName + + onCheckedChanged: { if (checked) { - if (profileModel.fleets.fleet === fleetName) return; - newFleet = fleetName; + if (profileModel.fleets.fleet === root.fleetName) return; + root.newFleet = root.fleetName; openPopup(confirmDialogComponent) } } @@ -28,8 +30,8 @@ StatusRadioButtonRow { //% "Warning!" header.title: qsTrId("close-app-title") //% "Change fleet to %1" - confirmationText: qsTrId("change-fleet-to--1").arg(newFleet) - onConfirmButtonClicked: profileModel.fleets.setFleet(newFleet) + confirmationText: qsTrId("change-fleet-to--1").arg(root.newFleet) + onConfirmButtonClicked: profileModel.fleets.setFleet(root.newFleet) onClosed: { profileModel.fleets.triggerFleetChange() destroy(); @@ -37,4 +39,3 @@ StatusRadioButtonRow { } } } - diff --git a/ui/app/AppLayouts/Profile/controls/NetworkRadioSelector.qml b/ui/app/AppLayouts/Profile/controls/NetworkRadioSelector.qml index 0e5caf1725..d8dee45c72 100644 --- a/ui/app/AppLayouts/Profile/controls/NetworkRadioSelector.qml +++ b/ui/app/AppLayouts/Profile/controls/NetworkRadioSelector.qml @@ -3,23 +3,23 @@ import QtQuick.Controls 2.13 import QtQuick.Layouts 1.13 import utils 1.0 -import "../../../../shared" -import "../../../../shared/popups" -import "../../../../shared/status" -// TODO: replace with StatusQ component -StatusRadioButtonRow { +import "../../../../shared/controls" +import "../../../../shared/popups" + +RadioButtonSelector { + id: root + property string network: "" property string networkName: "" property string newNetwork: "" - id: radioProd - text: networkName == "" ? Utils.getNetworkName(network) : networkName - buttonGroup: networkSettings - checked: profileModel.network.current === network - onRadioCheckedChanged: { + + title: networkName == "" ? Utils.getNetworkName(network) : networkName + + onCheckedChanged: { if (checked) { - if (profileModel.network.current === network) return; - newNetwork = network; + if (profileModel.network.current === root.network) return; + root.newNetwork = root.network; openPopup(confirmDialogComponent) } } @@ -33,7 +33,7 @@ StatusRadioButtonRow { //% "The account will be logged out. When you unlock it again, the selected network will be used" confirmationText: qsTrId("logout-app-content") onConfirmButtonClicked: { - profileModel.network.current = newNetwork; + profileModel.network.current = root.newNetwork; } onClosed: { profileModel.network.triggerNetworkChange() diff --git a/ui/app/AppLayouts/Profile/popups/EthereumExplorerModal.qml b/ui/app/AppLayouts/Profile/popups/EthereumExplorerModal.qml index 90d0639112..02f7a44fda 100644 --- a/ui/app/AppLayouts/Profile/popups/EthereumExplorerModal.qml +++ b/ui/app/AppLayouts/Profile/popups/EthereumExplorerModal.qml @@ -2,9 +2,9 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import utils 1.0 -import "../../../../shared" + +import "../../../../shared/controls" import "../../../../shared/popups" -import "../../../../shared/status" // TODO: replace with StatusModal ModalPopup { @@ -29,45 +29,45 @@ ModalPopup { id: searchEnginGroup } - StatusRadioButtonRow { + RadioButtonSelector { //% "None" - text: qsTrId("none") + title: qsTrId("none") buttonGroup: searchEnginGroup checked: appSettings.useBrowserEthereumExplorer === Constants.browserEthereumExplorerNone - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.useBrowserEthereumExplorer = Constants.browserEthereumExplorerNone } } } - StatusRadioButtonRow { - text: "etherscan.io" + RadioButtonSelector { + title: "etherscan.io" buttonGroup: searchEnginGroup checked: appSettings.useBrowserEthereumExplorer === Constants.browserEthereumExplorerEtherscan - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.useBrowserEthereumExplorer = Constants.browserEthereumExplorerEtherscan } } } - StatusRadioButtonRow { - text: "ethplorer.io" + RadioButtonSelector { + title: "ethplorer.io" buttonGroup: searchEnginGroup checked: appSettings.useBrowserEthereumExplorer === Constants.browserEthereumExplorerEthplorer - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.useBrowserEthereumExplorer = Constants.browserEthereumExplorerEthplorer } } } - StatusRadioButtonRow { - text: "blockchair.com" + RadioButtonSelector { + title: "blockchair.com" buttonGroup: searchEnginGroup checked: appSettings.useBrowserEthereumExplorer === Constants.browserEthereumExplorerBlockchair - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.useBrowserEthereumExplorer = Constants.browserEthereumExplorerBlockchair } diff --git a/ui/app/AppLayouts/Profile/popups/FleetsModal.qml b/ui/app/AppLayouts/Profile/popups/FleetsModal.qml index 6c4e8f6f3a..778f0c742a 100644 --- a/ui/app/AppLayouts/Profile/popups/FleetsModal.qml +++ b/ui/app/AppLayouts/Profile/popups/FleetsModal.qml @@ -32,22 +32,27 @@ ModalPopup { FleetRadioSelector { fleetName: Constants.eth_prod + buttonGroup: fleetSettings } FleetRadioSelector { fleetName: Constants.eth_staging + buttonGroup: fleetSettings } FleetRadioSelector { fleetName: Constants.eth_test + buttonGroup: fleetSettings } FleetRadioSelector { fleetName: Constants.waku_prod + buttonGroup: fleetSettings } FleetRadioSelector { fleetName: Constants.waku_test + buttonGroup: fleetSettings } } } diff --git a/ui/app/AppLayouts/Profile/popups/HomepageModal.qml b/ui/app/AppLayouts/Profile/popups/HomepageModal.qml index d799fc03ec..2a4dae4ce6 100644 --- a/ui/app/AppLayouts/Profile/popups/HomepageModal.qml +++ b/ui/app/AppLayouts/Profile/popups/HomepageModal.qml @@ -2,10 +2,9 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import utils 1.0 -import "../../../../shared" + import "../../../../shared/controls" import "../../../../shared/popups" -import "../../../../shared/status" // TODO: replace with StatusModal ModalPopup { @@ -32,12 +31,12 @@ ModalPopup { id: homepageGroup } - StatusRadioButtonRow { + RadioButtonSelector { //% "Default" - text: qsTrId("default") + title: qsTrId("default") buttonGroup: homepageGroup checked: appSettings.browserHomepage === "" - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.browserHomepage = "" customUrl.visible = false @@ -45,12 +44,12 @@ ModalPopup { } } - StatusRadioButtonRow { + RadioButtonSelector { //% "Custom..." - text: qsTrId("custom---") + title: qsTrId("custom---") buttonGroup: homepageGroup checked: appSettings.browserHomepage !== "" || customUrl.visible - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { customUrl.visible = true } diff --git a/ui/app/AppLayouts/Profile/popups/LanguageModal.qml b/ui/app/AppLayouts/Profile/popups/LanguageModal.qml index 8d68e060ee..28858e3baa 100644 --- a/ui/app/AppLayouts/Profile/popups/LanguageModal.qml +++ b/ui/app/AppLayouts/Profile/popups/LanguageModal.qml @@ -2,9 +2,8 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import utils 1.0 -import "../../../../shared" +import "../../../../shared/controls" import "../../../../shared/popups" -import "../../../../shared/status" import "../locales.js" as Locales_JSON // TODO: replace with StatusQ StatusModal @@ -69,13 +68,14 @@ ModalPopup { spacing: 0 delegate: Component { - StatusRadioButtonRow { + RadioButtonSelector { height: 64 anchors.rightMargin: 0 - text: modelData.name + anchors.leftMargin: 0 + title: modelData.name buttonGroup: languageGroup checked: globalSettings.locale === modelData.locale - onRadioCheckedChanged: { + onCheckedChanged: { if (checked && globalSettings.locale !== modelData.locale) { globalSettings.locale = modelData.locale if (Qt.platform.os === Constants.linux) { diff --git a/ui/app/AppLayouts/Profile/popups/NetworksModal.qml b/ui/app/AppLayouts/Profile/popups/NetworksModal.qml index 5426f4a1fd..fca46d8682 100644 --- a/ui/app/AppLayouts/Profile/popups/NetworksModal.qml +++ b/ui/app/AppLayouts/Profile/popups/NetworksModal.qml @@ -88,6 +88,10 @@ ModalPopup { anchors.leftMargin: Style.current.padding anchors.rightMargin: Style.current.padding + ButtonGroup { + id: radioGroup + } + StatusSectionHeadline { //% "Main networks" @@ -97,14 +101,17 @@ ModalPopup { NetworkRadioSelector { network: Constants.networkMainnet + buttonGroup: radioGroup } NetworkRadioSelector { network: Constants.networkPOA + buttonGroup: radioGroup } NetworkRadioSelector { network: Constants.networkXDai + buttonGroup: radioGroup } StatusSectionHeadline { @@ -116,14 +123,17 @@ ModalPopup { NetworkRadioSelector { network: Constants.networkGoerli + buttonGroup: radioGroup } NetworkRadioSelector { network: Constants.networkRinkeby + buttonGroup: radioGroup } NetworkRadioSelector { network: Constants.networkRopsten + buttonGroup: radioGroup } StatusSectionHeadline { @@ -138,6 +148,7 @@ ModalPopup { delegate: NetworkRadioSelector { networkName: name network: customNetworkId + buttonGroup: radioGroup } } } diff --git a/ui/app/AppLayouts/Profile/popups/NewCustomNetworkModal.qml b/ui/app/AppLayouts/Profile/popups/NewCustomNetworkModal.qml index fa3c8a6665..7ff744ca70 100644 --- a/ui/app/AppLayouts/Profile/popups/NewCustomNetworkModal.qml +++ b/ui/app/AppLayouts/Profile/popups/NewCustomNetworkModal.qml @@ -1,9 +1,7 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 - import utils 1.0 -import "../../../../shared" import "../../../../shared/controls" import "../../../../shared/status" @@ -138,14 +136,14 @@ StatusModal { id: networkChainGroup } - StatusRadioButtonRow { + RadioButtonSelector { id: mainnetRadioBtn //% "Main network" objectName: "main" - text: qsTrId("mainnet-network") + title: qsTrId("mainnet-network") buttonGroup: networkChainGroup checked: true - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { addNetworkPopup.networkId = 1; addNetworkPopup.networkType = Constants.networkMainnet; @@ -153,11 +151,11 @@ StatusModal { } } - StatusRadioButtonRow { + RadioButtonSelector { //% "Ropsten test network" - text: qsTrId("ropsten-network") + title: qsTrId("ropsten-network") buttonGroup: networkChainGroup - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { addNetworkPopup.networkId = 3; addNetworkPopup.networkType = Constants.networkRopsten; @@ -165,11 +163,11 @@ StatusModal { } } - StatusRadioButtonRow { + RadioButtonSelector { //% "Rinkeby test network" - text: qsTrId("rinkeby-network") + title: qsTrId("rinkeby-network") buttonGroup: networkChainGroup - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { addNetworkPopup.networkId = 4; addNetworkPopup.networkType = Constants.networkRinkeby; @@ -177,13 +175,13 @@ StatusModal { } } - StatusRadioButtonRow { + RadioButtonSelector { id: customRadioBtn //% "Custom" objectName: "custom" - text: qsTrId("custom") + title: qsTrId("custom") buttonGroup: networkChainGroup - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { addNetworkPopup.networkType = ""; } diff --git a/ui/app/AppLayouts/Profile/popups/OpenLinksWithModal.qml b/ui/app/AppLayouts/Profile/popups/OpenLinksWithModal.qml index b6ada322c2..cecf3157dd 100644 --- a/ui/app/AppLayouts/Profile/popups/OpenLinksWithModal.qml +++ b/ui/app/AppLayouts/Profile/popups/OpenLinksWithModal.qml @@ -2,9 +2,9 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import utils 1.0 -import "../../../../shared" + +import "../../../../shared/controls" import "../../../../shared/popups" -import "../../../../shared/status" // TODO: replace with StatusModal ModalPopup { @@ -31,22 +31,22 @@ ModalPopup { id: openLinksWithGroup } - StatusRadioButtonRow { - text: "Status" + RadioButtonSelector { + title: "Status" buttonGroup: openLinksWithGroup checked: appSettings.openLinksInStatus - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.openLinksInStatus = true } } } - StatusRadioButtonRow { + RadioButtonSelector { //% "My default browser" - text: qsTrId("my-default-browser") + title: qsTrId("my-default-browser") buttonGroup: openLinksWithGroup checked: !appSettings.openLinksInStatus - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.openLinksInStatus = false } diff --git a/ui/app/AppLayouts/Profile/popups/SearchEngineModal.qml b/ui/app/AppLayouts/Profile/popups/SearchEngineModal.qml index 948b2bb006..bb0b0ba64b 100644 --- a/ui/app/AppLayouts/Profile/popups/SearchEngineModal.qml +++ b/ui/app/AppLayouts/Profile/popups/SearchEngineModal.qml @@ -2,9 +2,8 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import utils 1.0 -import "../../../../shared" +import "../../../../shared/controls" import "../../../../shared/popups" -import "../../../../shared/status" // TODO: replace with StatusModal ModalPopup { @@ -29,45 +28,45 @@ ModalPopup { id: searchEnginGroup } - StatusRadioButtonRow { + RadioButtonSelector { //% "None" - text: qsTrId("none") + title: qsTrId("none") buttonGroup: searchEnginGroup checked: appSettings.shouldShowBrowserSearchEngine === Constants.browserSearchEngineNone - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.shouldShowBrowserSearchEngine = Constants.browserSearchEngineNone } } } - StatusRadioButtonRow { - text: "Google" + RadioButtonSelector { + title: "Google" buttonGroup: searchEnginGroup checked: appSettings.shouldShowBrowserSearchEngine === Constants.browserSearchEngineGoogle - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.shouldShowBrowserSearchEngine = Constants.browserSearchEngineGoogle } } } - StatusRadioButtonRow { - text: "Yahoo!" + RadioButtonSelector { + title: "Yahoo!" buttonGroup: searchEnginGroup checked: appSettings.shouldShowBrowserSearchEngine === Constants.browserSearchEngineYahoo - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.shouldShowBrowserSearchEngine = Constants.browserSearchEngineYahoo } } } - StatusRadioButtonRow { - text: "DuckDuckGo" + RadioButtonSelector { + title: "DuckDuckGo" buttonGroup: searchEnginGroup checked: appSettings.shouldShowBrowserSearchEngine === Constants.browserSearchEngineDuckDuckGo - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.shouldShowBrowserSearchEngine = Constants.browserSearchEngineDuckDuckGo } diff --git a/ui/app/AppLayouts/Profile/popups/StoreToKeychainSelectionModal.qml b/ui/app/AppLayouts/Profile/popups/StoreToKeychainSelectionModal.qml index 87f9b0fcce..e36aaed823 100644 --- a/ui/app/AppLayouts/Profile/popups/StoreToKeychainSelectionModal.qml +++ b/ui/app/AppLayouts/Profile/popups/StoreToKeychainSelectionModal.qml @@ -2,9 +2,9 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import utils 1.0 -import "../../../../shared" + +import "../../../../shared/controls" import "../../../../shared/popups" -import "../../../../shared/status" // TODO: replace with StatusModal ModalPopup { @@ -30,11 +30,11 @@ ModalPopup { id: openLinksWithGroup } - StatusRadioButtonRow { - text: qsTr("Store") + RadioButtonSelector { + title: qsTr("Store") buttonGroup: openLinksWithGroup checked: accountSettings.storeToKeychain === Constants.storeToKeychainValueStore - onRadioCheckedChanged: { + onCheckedChanged: { if (checked && accountSettings.storeToKeychain !== Constants.storeToKeychainValueStore) { var storePassPopup = openPopup(storePasswordModal) if(storePassPopup) @@ -52,25 +52,25 @@ ModalPopup { } } - StatusRadioButtonRow { + RadioButtonSelector { id: notNowBtn - text: qsTr("Not now") + title: qsTr("Not now") buttonGroup: openLinksWithGroup checked: accountSettings.storeToKeychain === Constants.storeToKeychainValueNotNow || accountSettings.storeToKeychain === "" - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { accountSettings.storeToKeychain = Constants.storeToKeychainValueNotNow } } } - StatusRadioButtonRow { + RadioButtonSelector { id: neverBtn - text: qsTr("Never") + title: qsTr("Never") buttonGroup: openLinksWithGroup checked: accountSettings.storeToKeychain === Constants.storeToKeychainValueNever - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { accountSettings.storeToKeychain = Constants.storeToKeychainValueNever } diff --git a/ui/app/AppLayouts/Profile/views/NotificationsView.qml b/ui/app/AppLayouts/Profile/views/NotificationsView.qml index 279cf871d7..c5133dead3 100644 --- a/ui/app/AppLayouts/Profile/views/NotificationsView.qml +++ b/ui/app/AppLayouts/Profile/views/NotificationsView.qml @@ -2,18 +2,19 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import QtGraphicalEffects 1.13 import QtQuick.Layouts 1.13 -import "./" - -import utils 1.0 -import "../../../../shared" -import "../../../../shared/panels" -import "../../../../shared/status" import StatusQ.Core 0.1 import StatusQ.Core.Theme 0.1 +import utils 1.0 + +import "../../../../shared/controls" +import "../../../../shared/panels" +import "../../../../shared/status" + import "../popups" import "../panels" +import "./" ScrollView { id: root @@ -61,39 +62,36 @@ ScrollView { anchors.left: parent.left anchors.right: parent.right - // TODO: replace with StatusListItem - StatusRadioButtonRow { + RadioButtonSelector { //% "All messages" - text: qsTrId("all-messages") + title: qsTrId("all-messages") buttonGroup: notificationSetting checked: appSettings.notificationSetting === Constants.notifyAllMessages - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.notificationSetting = Constants.notifyAllMessages } } } - // TODO: replace with StatusListItem - StatusRadioButtonRow { + RadioButtonSelector { //% "Just @mentions" - text: qsTrId("just--mentions") + title: qsTrId("just--mentions") buttonGroup: notificationSetting checked: appSettings.notificationSetting === Constants.notifyJustMentions - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.notificationSetting = Constants.notifyJustMentions } } } - // TODO: replace with StatusListItem - StatusRadioButtonRow { + RadioButtonSelector { //% "Nothing" - text: qsTrId("nothing") + title: qsTrId("nothing") buttonGroup: notificationSetting checked: appSettings.notificationSetting === Constants.notifyNone - onRadioCheckedChanged: { + onCheckedChanged: { if (checked) { appSettings.notificationSetting = Constants.notifyNone } diff --git a/ui/shared/controls/RadioButtonSelector.qml b/ui/shared/controls/RadioButtonSelector.qml new file mode 100644 index 0000000000..22f33b587b --- /dev/null +++ b/ui/shared/controls/RadioButtonSelector.qml @@ -0,0 +1,35 @@ +import QtQuick 2.13 +import QtQuick.Controls 2.13 +import QtQuick.Layouts 1.13 + +import StatusQ.Components 0.1 +import StatusQ.Controls 0.1 + +import utils 1.0 + +import "../popups" + +StatusListItem { + id: root + + property var buttonGroup + property alias checked: radioButton.checked + + implicitHeight: 52 + anchors.left: parent.left + anchors.leftMargin: -Style.current.padding + anchors.right: parent.right + anchors.rightMargin: -Style.current.padding + + sensor.onClicked: { + radioButton.checked = !radioButton.checked + } + + components: [ + StatusRadioButton { + id: radioButton + ButtonGroup.group: root.buttonGroup + } + ] +} + diff --git a/ui/shared/status/StatusRadioButtonRow.qml b/ui/shared/status/StatusRadioButtonRow.qml deleted file mode 100644 index eff74d0046..0000000000 --- a/ui/shared/status/StatusRadioButtonRow.qml +++ /dev/null @@ -1,67 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Controls 2.13 - -import utils 1.0 -import ".." -import "../panels" -import "." - -import StatusQ.Controls 0.1 - -Rectangle { - property alias text: textElement.text - property var buttonGroup - property alias checked: radioButton.checked - property bool isHovered: false - signal radioCheckedChanged(checked: bool) - - id: root - height: 52 - color: isHovered ? Style.current.backgroundHover : Style.current.transparent - radius: Style.current.radius - border.width: 0 - anchors.left: parent.left - anchors.leftMargin: -Style.current.padding - anchors.right: parent.right - anchors.rightMargin: -Style.current.padding - - - StyledText { - id: textElement - text: "" - font.pixelSize: 15 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: Style.current.padding - } - - MouseArea { - cursorShape: Qt.PointingHandCursor - anchors.fill: parent - hoverEnabled: true - onEntered: root.isHovered = true - onExited: root.isHovered = false - onClicked: { - radioButton.checked = true - } - } - - StatusRadioButton { - id: radioButton - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Style.current.padding - ButtonGroup.group: root.buttonGroup - rightPadding: 0 - checked: root.checked - onCheckedChanged: root.radioCheckedChanged(checked) - MouseArea { - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - anchors.fill: parent - onPressed: mouse.accepted = false - onEntered: root.isHovered = true - } - } - -}