InlineButton development

This commit is contained in:
Sander Ferdinand 2017-11-25 22:53:07 +01:00 committed by moneromooo-monero
parent 36ac2ee86d
commit 6d21b9919d
4 changed files with 54 additions and 72 deletions

View File

@ -47,10 +47,6 @@ Item {
anchors.rightMargin: 8
anchors.topMargin: 8
function onClicked(){
console.log("debug click");
}
function doClick() {
// Android workaround
releaseFocus();
@ -58,10 +54,11 @@ Item {
}
Rectangle{
color: "#808080"
id: rect
color: rect.enabled ? "#808080" : "#3b3b3b"
border.color: "black"
height: 32
width: inlineText.width + 20
width: inlineText.width + 22
radius: 4
anchors.top: parent.top
@ -70,14 +67,16 @@ Item {
Text {
id: inlineText
font.family: Style.fontBold.name
font.bold: true
font.pixelSize: 16 * scaleRatio
color: "#FFFFFF"
color: "black"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}
MouseArea {
id: buttonArea
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: doClick()
}

View File

@ -33,6 +33,7 @@ import "." 1.0
TextField {
font.family: Style.fontRegular.name
font.pixelSize: 22
font.bold: true
horizontalAlignment: TextInput.AlignLeft
selectByMouse: true
color: "white"

View File

@ -37,6 +37,7 @@ Item {
property alias readOnly : input.readOnly
property alias cursorPosition: input.cursorPosition
property alias echoMode: input.echoMode
property alias inlineButton: inlineButtonId
property alias inlineButtonText: inlineButtonId.text
property alias inlineIcon: inlineIcon.visible
property int fontSize: 18 * scaleRatio
@ -70,9 +71,9 @@ Item {
function getColor(error) {
// @TODO: replace/remove this (implement as ternary?)
if (error)
return Style.inputBoxBackground
return "transparent"
else
return Style.inputBoxBackground
return "transparent"
}
Text {
@ -85,7 +86,7 @@ Item {
font.pixelSize: 20 * scaleRatio
color: "#FFFFFF"
text: ""
visible: item.setPlaceholder() ? false : true
visible: input.text ? false : true
z: 3
}
@ -128,6 +129,7 @@ Item {
InlineButton {
id: inlineButtonId
onClicked: inlineButtonId.onClicked
visible: item.inlineButtonText ? true : false
}
}

View File

@ -30,8 +30,8 @@ import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import moneroComponents.PendingTransaction 1.0
import "../components"
import moneroComponents.Wallet 1.0
import "../components"
import "." 1.0
@ -41,10 +41,18 @@ Rectangle {
int priority, string description)
signal sweepUnmixableClicked()
color: "black"
color: "transparent"
property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString
property bool showAdvanced: false
Image {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: panel.height
source: "../images/leftPanelBg.jpg"
}
function scaleValueToMixinCount(scaleValue) {
var scaleToMixinCount = [6,7,8,9,10,11,12,13,14,16,18,20,22,25];
if (scaleValue < scaleToMixinCount.length) {
@ -119,6 +127,7 @@ Rectangle {
RowLayout{
Layout.fillWidth: true
Layout.bottomMargin: 20
height: 150
Text {
id: panelHeader
@ -144,22 +153,16 @@ Rectangle {
Layout.fillWidth: true
id: amountRow
Layout.minimumWidth: 200
Item {
visible: !isMobile
width: 37 * scaleRatio
height: 37 * scaleRatio
Image {
anchors.centerIn: parent
source: "../images/moneroIcon.png"
}
}
// Amount input
LineEdit {
Layout.fillWidth: true
id: amountLine
Layout.fillWidth: true
inlineIcon: true
placeholderText: qsTr("") + translationManager.emptyString
width:100
width: 100
inlineButtonText: qsTr("All") + translationManager.emptyString
inlineButton.onClicked: amountLine.text = "(all)"
validator: DoubleValidator {
bottom: 0.0
top: 18446744.073709551615
@ -168,21 +171,7 @@ Rectangle {
locale: "C"
}
}
StandardButton {
id: amountAllButton
width: 60 * scaleRatio
text: qsTr("All") + translationManager.emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
enabled : true
onClicked: amountLine.text = "(all)"
}
}
}
ColumnLayout {
@ -197,7 +186,20 @@ Rectangle {
// ListElement { column1: qsTr("LOW") + translationManager.emptyString ; column2: ""; priority: PendingTransaction.Priority_Low }
// For translations to work, the strings need to be listed in
// the file components/StandardDropdown.qml too.
<<<<<<< HEAD
=======
// Priorities before v5
ListModel {
id: priorityModel
ListElement { column1: qsTr("Low (x1 fee)") ; column2: ""; priority: PendingTransaction.Priority_Low }
ListElement { column1: qsTr("Medium (x20 fee)") ; column2: ""; priority: PendingTransaction.Priority_Medium }
ListElement { column1: qsTr("High (x166 fee)") ; column2: ""; priority: PendingTransaction.Priority_High }
}
>>>>>>> InlineButton development
// Priorites after v5
ListModel {
id: priorityModelV5
@ -215,45 +217,32 @@ Rectangle {
id: priorityDropdown
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
releasedColor: "black"
pressedColor: "#404040"
}
}
// Make sure dropdown is on top
z: parent.z + 1
}
ColumnLayout {
id: amountRowx
Label {
id: amountLabelx
text: qsTr("Amount") + translationManager.emptyString
width: mainLayout.labelWidth
}
// this LineEdit is for testing purposes
LineEdit {
id: amountLinex
fontSize: mainLayout.lineEditFontSize
placeholderText: qsTr("Amount to receive") + translationManager.emptyString
readOnly: false
width: mainLayout.editWidth
Layout.fillWidth: true
inlineButtonText: "Testy"
}
}
ColumnLayout {
Layout.fillWidth: true
Label {
id: addressLabel
textFormat: Text.RichText
<<<<<<< HEAD
text: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style>" +
qsTr("Address") +
"<font size='2'> ( " +
qsTr("Paste in or select from <a href='#'>Address book</a>") +
" )</font>" +
translationManager.emptyString
=======
text: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
Address <font size='2'> ( Paste in or select from </font> <a href='#'>Address book</a><font size='2'> )</font>")
+ translationManager.emptyString
>>>>>>> InlineButton development
onLinkActivated: appWindow.showPageRequest("AddressBook")
Layout.fillWidth: true
}
@ -282,19 +271,9 @@ Rectangle {
Layout.fillWidth: true
anchors.topMargin: 5 * scaleRatio
placeholderText: "4..."
// validator: RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }
}
StandardButton {
id: resolveButton
width: 60 * scaleRatio
text: qsTr("Resolve") + translationManager.emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
enabled : isValidOpenAliasAddress(addressLine.text)
onClicked: {
inlineButtonText: qsTr("Resolve") + translationManager.emptyString
inlineButton.enabled: isValidOpenAliasAddress(addressLine.text)
inlineButton.onClicked: {
var result = walletManager.resolveOpenAlias(addressLine.text)
if (result) {
var parts = result.split("|")
@ -325,6 +304,7 @@ Rectangle {
oa_message(qsTr("No address found"))
}
}
// validator: RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }
}
}