This commit is contained in:
rating89us 2024-11-25 23:26:18 +00:00 committed by GitHub
commit 32723e3453
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 65 additions and 72 deletions

View File

@ -27,66 +27,54 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.15
import "../components" as MoneroComponents
Item {
id: radioButton
property alias text: label.text
property bool checked: false
property int fontSize: 14
property alias fontColor: label.color
signal clicked()
height: 26
width: layout.width
// legacy properties
property var checkedColor: MoneroComponents.Style.blackTheme ? "white" : "#666666"
property var borderColor: checked ? MoneroComponents.Style.inputBorderColorActive : MoneroComponents.Style.inputBorderColorInActive
RadioButton {
id: control
checked: false
property var tooltip: ""
property bool tooltipIconVisible: true
property alias fontSize: control.font.pixelSize
function toggle(){
radioButton.checked = !radioButton.checked
radioButton.clicked()
}
font.pixelSize: 16
font.family: MoneroComponents.Style.fontRegular.name
RowLayout {
id: layout
indicator: Rectangle {
color: "transparent"
border.color: checked ? (MoneroComponents.Style.blackTheme ? "white" : "#666666") : MoneroComponents.Style.inputBorderColorInActive
height: 22
width: 22
radius: 22
Rectangle {
id: button
color: "transparent"
border.color: borderColor
height: radioButton.height
width: radioButton.height
radius: radioButton.height
Rectangle {
visible: radioButton.checked
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
color: checkedColor
width: 10
height: 10
radius: 10
opacity: 0.8
}
}
MoneroComponents.TextPlain {
id: label
Layout.leftMargin: 10
color: MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: radioButton.fontSize
wrapMode: Text.Wrap
visible: control.checked
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
color: MoneroComponents.Style.blackTheme ? "white" : "#666666"
width: 10
height: 10
radius: 10
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
toggle()
contentItem: Text {
id: textContent
text: control.text
font: control.font
opacity: enabled ? 1.0 : 0.3
color: MoneroComponents.Style.defaultFontColor
anchors.bottom: indicator.bottom
anchors.bottomMargin: 1
leftPadding: control.indicator.width + (control.spacing / 2)
MoneroComponents.Tooltip {
id: tooltip
anchors.top: parent.top
anchors.left: parent.right
tooltipIconVisible: true
text: control.tooltip
}
}
}

View File

@ -119,29 +119,34 @@ Rectangle {
z: 3
}
MoneroComponents.RadioButton {
id: newDeviceWallet
Layout.topMargin: 20
text: qsTr("Create a new wallet from device.") + translationManager.emptyString
fontSize: 16
checked: true
onClicked: {
checked = true;
restoreDeviceWallet.checked = false;
wizardController.walletOptionsDeviceIsRestore = false;
}
}
RowLayout {
Layout.topMargin: 29
spacing: 30
MoneroComponents.RadioButton {
id: restoreDeviceWallet
Layout.topMargin: 10
text: qsTr("Restore a wallet from device. Use this if you used your hardware wallet before.") + translationManager.emptyString
fontSize: 16
checked: false
onClicked: {
checked = true;
newDeviceWallet.checked = false;
wizardController.walletOptionsDeviceIsRestore = true;
MoneroComponents.RadioButton {
id: newDeviceWallet
text: qsTr("Create a new wallet") + translationManager.emptyString
fontSize: 16
checked: true
tooltip: qsTr("Use this if you have never received Monero in your hardware wallet") + translationManager.emptyString
onClicked: {
checked = true;
restoreDeviceWallet.checked = false;
wizardController.walletOptionsDeviceIsRestore = false;
}
}
MoneroComponents.RadioButton {
id: restoreDeviceWallet
text: qsTr("Restore a wallet") + translationManager.emptyString
fontSize: 16
checked: false
tooltip: qsTr("Use this if you have already received Monero in your hardware wallet") + translationManager.emptyString
onClicked: {
checked = true;
newDeviceWallet.checked = false;
wizardController.walletOptionsDeviceIsRestore = true;
}
}
}
}