mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-16 15:58:11 +00:00
transfer privacy level fix:
https://trello.com/c/Q0xqMAxd/33-medium-privacy-level-in-transfer-tab-needs-to-be-halfway-between-low-and-high
This commit is contained in:
parent
95cec0e2fd
commit
c65a878d8c
3 changed files with 78 additions and 43 deletions
|
@ -36,7 +36,7 @@ Item {
|
|||
|
||||
color: {
|
||||
if(item.fillLevel < 3) return "#FF6C3C"
|
||||
if(item.fillLevel < repeater.count - 1) return "#FFE00A"
|
||||
if(item.fillLevel < 13) return "#FFE00A"
|
||||
return "#36B25C"
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,8 @@ Item {
|
|||
function positionBar() {
|
||||
var xDiff = 999999
|
||||
var index = -1
|
||||
for(var i = 0; i < repeater.count; ++i) {
|
||||
var tmp = Math.abs(repeater.modelItems[i].x + row.x - mouseX)
|
||||
for(var i = 0; i < 14; ++i) {
|
||||
var tmp = Math.abs(row.positions[i].currentX + row.x - mouseX)
|
||||
if(tmp < xDiff) {
|
||||
xDiff = tmp
|
||||
index = i
|
||||
|
@ -68,7 +68,7 @@ Item {
|
|||
}
|
||||
|
||||
if(index !== -1) {
|
||||
fillRect.width = Qt.binding(function(){ return repeater.modelItems[index].x + row.x; })
|
||||
fillRect.width = Qt.binding(function(){ return row.positions[index].currentX + row.x })
|
||||
item.fillLevel = index
|
||||
}
|
||||
}
|
||||
|
@ -84,53 +84,44 @@ Item {
|
|||
anchors.rightMargin: 8
|
||||
anchors.top: bar.bottom
|
||||
anchors.topMargin: -1
|
||||
property var positions: new Array()
|
||||
|
||||
Row {
|
||||
id: row2
|
||||
spacing: ((bar.width - 8) / 2) / 4
|
||||
|
||||
Repeater {
|
||||
model: 4
|
||||
|
||||
delegate: TickDelegate {
|
||||
id: delegateItem2
|
||||
currentX: x + row2.x
|
||||
currentIndex: index
|
||||
mainTick: currentIndex === 0 || currentIndex === 3 || currentIndex === 13
|
||||
Component.onCompleted: {
|
||||
row.positions[currentIndex] = delegateItem2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row1
|
||||
spacing: ((bar.width - 8) / 2) / 10
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
model: 14
|
||||
property var modelItems: new Array()
|
||||
model: 10
|
||||
|
||||
delegate: Item {
|
||||
id: delegate
|
||||
width: 1
|
||||
height: 48
|
||||
property bool mainTick: index === 0 || index === 3 || index === repeater.count - 1
|
||||
Component.onCompleted: repeater.modelItems[index] = delegate
|
||||
|
||||
Image {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
visible: parent.mainTick
|
||||
source: "../images/privacyTick.png"
|
||||
|
||||
Text {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 2
|
||||
font.family: "Arial"
|
||||
font.bold: true
|
||||
font.pixelSize: 12
|
||||
color: "#4A4949"
|
||||
text: {
|
||||
if(index === 0) return qsTr("LOW")
|
||||
if(index === 3) return qsTr("MEDIUM")
|
||||
if(index === repeater.count - 1) return qsTr("HIGH")
|
||||
return ""
|
||||
delegate: TickDelegate {
|
||||
id: delegateItem1
|
||||
currentX: x + row1.x
|
||||
currentIndex: index + 4
|
||||
mainTick: currentIndex === 0 || currentIndex === 3 || currentIndex === 13
|
||||
Component.onCompleted: {
|
||||
row.positions[currentIndex] = delegateItem1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 14
|
||||
width: 1
|
||||
color: "#DBDBDB"
|
||||
height: index === 8 ? 16 : 8
|
||||
visible: !parent.mainTick
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
43
components/TickDelegate.qml
Normal file
43
components/TickDelegate.qml
Normal file
|
@ -0,0 +1,43 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: delegateItem
|
||||
width: 1
|
||||
height: 48
|
||||
property bool mainTick: false
|
||||
property int currentIndex
|
||||
property int currentX
|
||||
|
||||
Image {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
visible: parent.mainTick
|
||||
source: "../images/privacyTick.png"
|
||||
|
||||
Text {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 2
|
||||
font.family: "Arial"
|
||||
font.bold: true
|
||||
font.pixelSize: 12
|
||||
color: "#4A4949"
|
||||
text: {
|
||||
if(currentIndex === 0) return qsTr("LOW")
|
||||
if(currentIndex === 3) return qsTr("MEDIUM")
|
||||
if(currentIndex === 13) return qsTr("HIGH")
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 14
|
||||
width: 1
|
||||
color: "#DBDBDB"
|
||||
height: currentIndex === 8 ? 16 : 8
|
||||
visible: !parent.mainTick
|
||||
}
|
||||
}
|
1
qml.qrc
1
qml.qrc
|
@ -70,5 +70,6 @@
|
|||
<file>images/nextMonth.png</file>
|
||||
<file>images/prevMonth.png</file>
|
||||
<file>components/TitleBar.qml</file>
|
||||
<file>components/TickDelegate.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Reference in a new issue