fix: code review
This commit is contained in:
parent
61ad781065
commit
97c6abbb05
|
@ -23,6 +23,9 @@ QtObject:
|
|||
|
||||
proc fleetChanged*(self: Fleets, newFleet: string) {.signal.}
|
||||
|
||||
proc triggerFleetChange*(self: Fleets) {.slot.} =
|
||||
self.fleetChanged($status_settings.getFleet())
|
||||
|
||||
proc setFleet*(self: Fleets, newFleet: string) {.slot.} =
|
||||
discard status_settings.saveSetting(Setting.Fleet, newFleet)
|
||||
let fleet = parseEnum[Fleet](newFleet)
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
import QtQuick 2.13
|
||||
import QtQuick.Controls 2.13
|
||||
import QtQuick.Layouts 1.13
|
||||
import "../../../../imports"
|
||||
import "../../../../shared"
|
||||
import "../../../../shared/status"
|
||||
|
||||
RowLayout {
|
||||
property string fleetName: ""
|
||||
property string newFleet: ""
|
||||
|
||||
ConfirmationDialog {
|
||||
id: confirmDialog
|
||||
title: qsTr("Warning!")
|
||||
confirmationText: qsTr("Change fleet to %1").arg(newFleet)
|
||||
onConfirmButtonClicked: profileModel.fleets.setFleet(newFleet)
|
||||
onClosed: profileModel.fleets.triggerFleetChange()
|
||||
}
|
||||
|
||||
|
||||
width: parent.width
|
||||
StyledText {
|
||||
text: fleetName
|
||||
font.pixelSize: 15
|
||||
}
|
||||
StatusRadioButton {
|
||||
id: radioProd
|
||||
Layout.alignment: Qt.AlignRight
|
||||
ButtonGroup.group: fleetSettings
|
||||
rightPadding: 0
|
||||
checked: profileModel.fleets.fleet === fleetName
|
||||
onClicked: {
|
||||
if (profileModel.fleets.fleet === fleetName) return;
|
||||
newFleet = fleetName;
|
||||
confirmDialog.open();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,82 +16,18 @@ ModalPopup {
|
|||
spacing: Style.current.padding
|
||||
width: parent.width
|
||||
|
||||
ConfirmationDialog {
|
||||
id: confirmDialog
|
||||
title: qsTr("Warning!")
|
||||
confirmationText: qsTr("Change fleet to %1").arg(newFleet)
|
||||
onConfirmButtonClicked: profileModel.fleets.setFleet(newFleet)
|
||||
|
||||
onClosed: {
|
||||
let currFleet = profileModel.fleets.fleet
|
||||
radioProd.checked = currFleet == Constants.eth_prod
|
||||
radioStaging.checked = currFleet == Constants.eth_staging
|
||||
radioTest.checked = currFleet == Constants.eth_test
|
||||
}
|
||||
}
|
||||
|
||||
ButtonGroup { id: fleetSettings }
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
StyledText {
|
||||
text: Constants.eth_prod
|
||||
font.pixelSize: 15
|
||||
}
|
||||
StatusRadioButton {
|
||||
id: radioProd
|
||||
Layout.alignment: Qt.AlignRight
|
||||
ButtonGroup.group: fleetSettings
|
||||
rightPadding: 0
|
||||
checked: profileModel.fleets.fleet === Constants.eth_prod
|
||||
onClicked: {
|
||||
if (profileModel.fleets.fleet === Constants.eth_prod) return;
|
||||
newFleet = Constants.eth_prod;
|
||||
confirmDialog.open();
|
||||
}
|
||||
}
|
||||
FleetRadioSelector {
|
||||
fleetName: Constants.eth_prod
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
StyledText {
|
||||
text: Constants.eth_staging
|
||||
font.pixelSize: 15
|
||||
}
|
||||
StatusRadioButton {
|
||||
id: radioStaging
|
||||
Layout.alignment: Qt.AlignRight
|
||||
ButtonGroup.group: fleetSettings
|
||||
rightPadding: 0
|
||||
checked: profileModel.fleets.fleet === Constants.eth_staging
|
||||
onClicked: {
|
||||
if (profileModel.fleets.fleet === Constants.eth_staging) return;
|
||||
newFleet = Constants.eth_staging;
|
||||
confirmDialog.open();
|
||||
}
|
||||
}
|
||||
FleetRadioSelector {
|
||||
fleetName: Constants.eth_staging
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
StyledText {
|
||||
text: Constants.eth_test
|
||||
font.pixelSize: 15
|
||||
}
|
||||
StatusRadioButton {
|
||||
id: radioTest
|
||||
Layout.alignment: Qt.AlignRight
|
||||
ButtonGroup.group: fleetSettings
|
||||
rightPadding: 0
|
||||
checked: profileModel.fleets.fleet === Constants.eth_test
|
||||
onClicked: {
|
||||
if (profileModel.fleets.fleet === Constants.eth_test) {
|
||||
return;
|
||||
}
|
||||
newFleet = Constants.eth_test;
|
||||
confirmDialog.open();
|
||||
}
|
||||
}
|
||||
FleetRadioSelector {
|
||||
fleetName: Constants.eth_test
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue