mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 16:28:14 +00:00
Merge pull request #3574
eacc57f
StandardDropdown: use ColumnLayout; use same height of LineEdit; include dropdownLabel (rating89us)
This commit is contained in:
commit
2afb346563
4 changed files with 88 additions and 96 deletions
|
@ -30,12 +30,15 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import FontAwesome 1.0
|
import FontAwesome 1.0
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
import "../components" as MoneroComponents
|
import "../components" as MoneroComponents
|
||||||
import "../components/effects/" as MoneroEffects
|
import "../components/effects/" as MoneroEffects
|
||||||
|
|
||||||
Item {
|
ColumnLayout {
|
||||||
id: dropdown
|
id: dropdown
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
property int itemTopMargin: 0
|
property int itemTopMargin: 0
|
||||||
property alias dataModel: repeater.model
|
property alias dataModel: repeater.model
|
||||||
property string shadowPressedColor
|
property string shadowPressedColor
|
||||||
|
@ -45,46 +48,66 @@ Item {
|
||||||
property string textColor: MoneroComponents.Style.defaultFontColor
|
property string textColor: MoneroComponents.Style.defaultFontColor
|
||||||
property alias currentIndex: columnid.currentIndex
|
property alias currentIndex: columnid.currentIndex
|
||||||
readonly property alias expanded: popup.visible
|
readonly property alias expanded: popup.visible
|
||||||
property int dropdownHeight: 42
|
property alias labelText: dropdownLabel.text
|
||||||
property int fontHeaderSize: 16
|
property alias labelColor: dropdownLabel.color
|
||||||
|
property alias labelTextFormat: dropdownLabel.textFormat
|
||||||
|
property alias labelWrapMode: dropdownLabel.wrapMode
|
||||||
|
property alias labelHorizontalAlignment: dropdownLabel.horizontalAlignment
|
||||||
|
property bool showingHeader: dropdownLabel.text !== ""
|
||||||
|
property int labelFontSize: 16
|
||||||
|
property bool labelFontBold: false
|
||||||
|
property int dropdownHeight: 39
|
||||||
|
property int fontSize: 16
|
||||||
property int fontItemSize: 14
|
property int fontItemSize: 14
|
||||||
property string colorBorder: MoneroComponents.Style.inputBorderColorInActive
|
property string colorBorder: MoneroComponents.Style.inputBorderColorInActive
|
||||||
property string colorHeaderBackground: "transparent"
|
property string colorHeaderBackground: "transparent"
|
||||||
property bool headerBorder: true
|
property bool headerBorder: true
|
||||||
property bool headerFontBold: false
|
property bool headerFontBold: false
|
||||||
|
|
||||||
height: dropdownHeight
|
|
||||||
|
|
||||||
signal changed();
|
signal changed();
|
||||||
|
|
||||||
onExpandedChanged: if(expanded) appWindow.currentItem = dropdown
|
onExpandedChanged: if(expanded) appWindow.currentItem = dropdown
|
||||||
|
|
||||||
Item {
|
spacing: 0
|
||||||
id: head
|
Rectangle {
|
||||||
anchors.left: parent.left
|
id: dropdownLabelRect
|
||||||
anchors.right: parent.right
|
color: "transparent"
|
||||||
anchors.top: parent.top
|
Layout.fillWidth: true
|
||||||
anchors.topMargin: parent.itemTopMargin
|
height: (dropdownLabel.height + 10)
|
||||||
height: dropdown.dropdownHeight
|
visible: showingHeader ? true : false
|
||||||
|
|
||||||
Rectangle {
|
MoneroComponents.TextPlain {
|
||||||
color: "transparent"
|
id: dropdownLabel
|
||||||
border.width: dropdown.headerBorder ? 1 : 0
|
anchors.top: parent.top
|
||||||
border.color: dropdown.colorBorder
|
anchors.left: parent.left
|
||||||
radius: 4
|
font.family: MoneroComponents.Style.fontRegular.name
|
||||||
anchors.fill: parent
|
font.pixelSize: labelFontSize
|
||||||
|
font.bold: labelFontBold
|
||||||
|
textFormat: Text.RichText
|
||||||
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: head
|
||||||
|
color: "transparent"
|
||||||
|
border.width: dropdown.headerBorder ? 1 : 0
|
||||||
|
border.color: dropdown.colorBorder
|
||||||
|
radius: 4
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: dropdownHeight
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
MoneroComponents.TextPlain {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 12
|
anchors.leftMargin: 10
|
||||||
anchors.right: dropIndicator.left
|
anchors.right: dropIndicator.left
|
||||||
anchors.rightMargin: 12
|
anchors.rightMargin: 12
|
||||||
|
width: droplist.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
font.family: MoneroComponents.Style.fontRegular.name
|
||||||
font.bold: dropdown.headerFontBold
|
font.bold: dropdown.headerFontBold
|
||||||
font.pixelSize: dropdown.fontHeaderSize
|
font.pixelSize: dropdown.fontSize
|
||||||
color: dropdown.textColor
|
color: dropdown.textColor
|
||||||
text: columnid.currentIndex < repeater.model.count ? qsTr(repeater.model.get(columnid.currentIndex).column1) + translationManager.emptyString : ""
|
text: columnid.currentIndex < repeater.model.count ? qsTr(repeater.model.get(columnid.currentIndex).column1) + translationManager.emptyString : ""
|
||||||
}
|
}
|
||||||
|
@ -126,7 +149,7 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: droplist
|
id: droplist
|
||||||
x: dropdown.x
|
anchors.left: parent.left
|
||||||
width: dropdown.width
|
width: dropdown.width
|
||||||
y: head.y + head.height
|
y: head.y + head.height
|
||||||
clip: true
|
clip: true
|
||||||
|
|
|
@ -669,13 +669,6 @@ Rectangle {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
visible: appWindow.walletMode >= 2
|
visible: appWindow.walletMode >= 2
|
||||||
|
|
||||||
Label {
|
|
||||||
id: transactionPriority
|
|
||||||
Layout.topMargin: 0
|
|
||||||
text: qsTr("Transaction priority") + translationManager.emptyString
|
|
||||||
fontBold: false
|
|
||||||
fontSize: 16
|
|
||||||
}
|
|
||||||
// Note: workaround for translations in listElements
|
// Note: workaround for translations in listElements
|
||||||
// ListElement: cannot use script for property value, so
|
// ListElement: cannot use script for property value, so
|
||||||
// code like this wont work:
|
// code like this wont work:
|
||||||
|
@ -699,10 +692,11 @@ Rectangle {
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
StandardDropdown {
|
StandardDropdown {
|
||||||
Layout.preferredWidth: 200
|
Layout.maximumWidth: 200
|
||||||
id: priorityDropdown
|
id: priorityDropdown
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
dataModel: priorityModelV5
|
dataModel: priorityModelV5
|
||||||
|
labelText: qsTr("Transaction priority") + translationManager.emptyString
|
||||||
}
|
}
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
MoneroComponents.TextPlain {
|
||||||
|
|
|
@ -178,52 +178,34 @@ Rectangle {
|
||||||
Layout.leftMargin: 36
|
Layout.leftMargin: 36
|
||||||
columnSpacing: 32
|
columnSpacing: 32
|
||||||
|
|
||||||
ColumnLayout {
|
MoneroComponents.StandardDropdown {
|
||||||
spacing: 10
|
id: fiatPriceProviderDropDown
|
||||||
Layout.fillWidth: true
|
Layout.maximumWidth: 200
|
||||||
|
labelText: qsTr("Price source") + translationManager.emptyString
|
||||||
|
labelFontSize: 14
|
||||||
|
dataModel: fiatPriceProvidersModel
|
||||||
|
onChanged: {
|
||||||
|
var obj = dataModel.get(currentIndex);
|
||||||
|
persistentSettings.fiatPriceProvider = obj.data;
|
||||||
|
|
||||||
MoneroComponents.Label {
|
if(persistentSettings.fiatPriceEnabled)
|
||||||
Layout.fillWidth: true
|
appWindow.fiatApiRefresh();
|
||||||
fontSize: 14
|
|
||||||
text: qsTr("Price source") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.StandardDropdown {
|
|
||||||
id: fiatPriceProviderDropDown
|
|
||||||
Layout.fillWidth: true
|
|
||||||
dataModel: fiatPriceProvidersModel
|
|
||||||
onChanged: {
|
|
||||||
var obj = dataModel.get(currentIndex);
|
|
||||||
persistentSettings.fiatPriceProvider = obj.data;
|
|
||||||
|
|
||||||
if(persistentSettings.fiatPriceEnabled)
|
|
||||||
appWindow.fiatApiRefresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
MoneroComponents.StandardDropdown {
|
||||||
spacing: 10
|
id: fiatPriceCurrencyDropdown
|
||||||
Layout.fillWidth: true
|
Layout.maximumWidth: 100
|
||||||
|
labelText: qsTr("Currency") + translationManager.emptyString
|
||||||
|
labelFontSize: 14
|
||||||
|
currentIndex: persistentSettings.fiatPriceCurrency === "xmrusd" ? 0 : 1
|
||||||
|
dataModel: fiatPriceCurrencyModel
|
||||||
|
onChanged: {
|
||||||
|
var obj = dataModel.get(currentIndex);
|
||||||
|
persistentSettings.fiatPriceCurrency = obj.data;
|
||||||
|
|
||||||
MoneroComponents.Label {
|
if(persistentSettings.fiatPriceEnabled)
|
||||||
Layout.fillWidth: true
|
appWindow.fiatApiRefresh();
|
||||||
fontSize: 14
|
|
||||||
text: qsTr("Currency") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.StandardDropdown {
|
|
||||||
id: fiatPriceCurrencyDropdown
|
|
||||||
Layout.fillWidth: true
|
|
||||||
currentIndex: persistentSettings.fiatPriceCurrency === "xmrusd" ? 0 : 1
|
|
||||||
dataModel: fiatPriceCurrencyModel
|
|
||||||
onChanged: {
|
|
||||||
var obj = dataModel.get(currentIndex);
|
|
||||||
persistentSettings.fiatPriceCurrency = obj.data;
|
|
||||||
|
|
||||||
if(persistentSettings.fiatPriceEnabled)
|
|
||||||
appWindow.fiatApiRefresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,43 +181,36 @@ Rectangle {
|
||||||
columns: 4
|
columns: 4
|
||||||
columnSpacing: 20
|
columnSpacing: 20
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 10
|
||||||
|
|
||||||
ColumnLayout {
|
MoneroComponents.StandardDropdown {
|
||||||
Layout.topMargin: 4
|
id: networkTypeDropdown
|
||||||
|
currentIndex: persistentSettings.nettype
|
||||||
|
dataModel: networkTypeModel
|
||||||
|
Layout.maximumWidth: 180
|
||||||
|
labelText: qsTr("Network") + ":" + translationManager.emptyString
|
||||||
|
labelFontSize: 14
|
||||||
|
|
||||||
MoneroComponents.Label {
|
onChanged: {
|
||||||
text: qsTr("Change Network:") + translationManager.emptyString
|
var item = dataModel.get(currentIndex).nettype.toLowerCase();
|
||||||
fontSize: 14
|
if(item === "mainnet") {
|
||||||
}
|
persistentSettings.nettype = NetworkType.MAINNET
|
||||||
|
} else if(item === "stagenet"){
|
||||||
MoneroComponents.StandardDropdown {
|
persistentSettings.nettype = NetworkType.STAGENET
|
||||||
id: networkTypeDropdown
|
} else if(item === "testnet"){
|
||||||
currentIndex: persistentSettings.nettype
|
persistentSettings.nettype = NetworkType.TESTNET
|
||||||
dataModel: networkTypeModel
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.maximumWidth: 180
|
|
||||||
Layout.topMargin: 5
|
|
||||||
|
|
||||||
onChanged: {
|
|
||||||
var item = dataModel.get(currentIndex).nettype.toLowerCase();
|
|
||||||
if(item === "mainnet") {
|
|
||||||
persistentSettings.nettype = NetworkType.MAINNET
|
|
||||||
} else if(item === "stagenet"){
|
|
||||||
persistentSettings.nettype = NetworkType.STAGENET
|
|
||||||
} else if(item === "testnet"){
|
|
||||||
persistentSettings.nettype = NetworkType.TESTNET
|
|
||||||
}
|
|
||||||
appWindow.disconnectRemoteNode()
|
|
||||||
}
|
}
|
||||||
|
appWindow.disconnectRemoteNode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MoneroComponents.LineEdit {
|
MoneroComponents.LineEdit {
|
||||||
id: kdfRoundsText
|
id: kdfRoundsText
|
||||||
Layout.fillWidth: true
|
Layout.maximumWidth: 180
|
||||||
|
|
||||||
labelText: qsTr("Number of KDF rounds:") + translationManager.emptyString
|
labelText: qsTr("Number of KDF rounds:") + translationManager.emptyString
|
||||||
labelFontSize: 14
|
labelFontSize: 14
|
||||||
|
fontSize: 16
|
||||||
placeholderFontSize: 16
|
placeholderFontSize: 16
|
||||||
placeholderText: "0"
|
placeholderText: "0"
|
||||||
validator: IntValidator { bottom: 1 }
|
validator: IntValidator { bottom: 1 }
|
||||||
|
|
Loading…
Reference in a new issue