Added inlineButton for lineEdit and worked on network status progress bar + text

This commit is contained in:
Sander Ferdinand 2017-11-21 22:11:41 +01:00 committed by moneromooo-monero
parent f9e264ca0a
commit e62fab767a
8 changed files with 170 additions and 70 deletions

View file

@ -127,9 +127,11 @@ Rectangle {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 8 anchors.topMargin: 8
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 184 anchors.leftMargin: 192
font.bold: true font.bold: true
font.pixelSize: 12
color: "white" color: "white"
opacity: 0.6
} }
// @TODO: implement // @TODO: implement
@ -245,7 +247,7 @@ Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.top: (isMobile)? parent.top : column1.bottom anchors.top: (isMobile)? parent.top : column1.bottom
anchors.topMargin: (isMobile)? 0 : 32 anchors.topMargin: (isMobile)? 0 : 32
color: "#1C1C1C" color: "black"
Flickable { Flickable {
@ -572,7 +574,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: (progressBar.visible)? progressBar.top : parent.bottom; anchors.bottom: (progressBar.visible)? progressBar.top : parent.bottom;
connected: Wallet.ConnectionStatus_Disconnected connected: Wallet.ConnectionStatus_Disconnected
height: 58 * scaleRatio height: 40 * scaleRatio
} }
ProgressBar { ProgressBar {
@ -590,9 +592,9 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
height: 35 * scaleRatio
syncType: qsTr("Daemon") syncType: qsTr("Daemon")
visible: networkStatus.connected visible: networkStatus.connected
height: 62 * scaleRatio
} }
} // menuRect } // menuRect

View file

@ -0,0 +1,86 @@
// Copyright (c) 2014-2015, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.0
import QtQuick.Layouts 1.1
Item {
id: inlineButton
height: 32 * scaleRatio
property string shadowPressedColor: "#B32D00"
property string shadowReleasedColor: "#FF4304"
property string pressedColor: "#FF4304"
property string releasedColor: "#FF6C3C"
property string icon: ""
property string textColor: "#FFFFFF"
property int fontSize: 12 * scaleRatio
property alias text: inlineText.text
signal clicked()
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: 8
anchors.topMargin: 8
function onClicked(){}
function doClick() {
// Android workaround
releaseFocus();
clicked();
}
Rectangle{
color: "#808080"
border.color: "black"
height: 32
width: inlineText.width + 20
radius: 4
anchors.top: parent.top
anchors.right: parent.right
Text {
id: inlineText
font.family: Style.fontBold.name
font.pixelSize: 16 * scaleRatio
color: "#FFFFFF"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}
MouseArea {
id: buttonArea
anchors.fill: parent
onClicked: doClick()
}
}
Keys.onSpacePressed: doClick()
Keys.onReturnPressed: doClick()
}

View file

@ -37,6 +37,7 @@ Item {
property alias readOnly : input.readOnly property alias readOnly : input.readOnly
property alias cursorPosition: input.cursorPosition property alias cursorPosition: input.cursorPosition
property alias echoMode: input.echoMode property alias echoMode: input.echoMode
property alias inlineButtonText: inlineButtonId.text
property int fontSize: 18 * scaleRatio property int fontSize: 18 * scaleRatio
property bool showBorder: true property bool showBorder: true
property bool error: false property bool error: false
@ -102,4 +103,9 @@ Item {
onAccepted: item.accepted(); onAccepted: item.accepted();
onTextChanged: item.textUpdated() onTextChanged: item.textUpdated()
} }
InlineButton {
id: inlineButtonId
visible: item.inlineButtonText ? true : false
}
} }

View file

@ -28,21 +28,23 @@
import QtQuick 2.0 import QtQuick 2.0
import moneroComponents.Wallet 1.0 import moneroComponents.Wallet 1.0
import "." 1.0
Rectangle { Rectangle {
id: item id: item
color: "transparent"
property var connected: Wallet.ConnectionStatus_Disconnected property var connected: Wallet.ConnectionStatus_Disconnected
function getConnectionStatusImage(status) { function getConnectionStatusImage(status) {
if (status == Wallet.ConnectionStatus_Connected) if (status == Wallet.ConnectionStatus_Connected)
return "../images/statusConnected.png" return "../images/lightning.png"
else else
return "../images/statusDisconnected.png" return "../images/statusDisconnected.png"
} }
function getConnectionStatusColor(status) { function getConnectionStatusColor(status) {
if (status == Wallet.ConnectionStatus_Connected) if (status == Wallet.ConnectionStatus_Connected)
return "#FF6C3B" return "white"
else else
return "#AAAAAA" return "#AAAAAA"
} }
@ -62,39 +64,50 @@ Rectangle {
return qsTr("Invalid connection status") return qsTr("Invalid connection status")
} }
color: "#1C1C1C"
Row { Row {
height: 60 * scaleRatio height: 40 * scaleRatio
Item { Item {
id: iconItem id: iconItem
anchors.bottom: parent.bottom anchors.top: parent.top
width: 50 * scaleRatio width: 40 * scaleRatio
height: 50 * scaleRatio height: 40 * scaleRatio
Image { Image {
anchors.centerIn: parent anchors.top: parent.top
anchors.topMargin: 6
anchors.right: parent.right
anchors.rightMargin: 11
source: getConnectionStatusImage(item.connected) source: getConnectionStatusImage(item.connected)
} }
} }
Column { Item {
anchors.bottom: parent.bottom anchors.top: parent.top
height: 53 * scaleRatio anchors.left: iconItem.right
spacing: 3 * scaleRatio height: 40 * scaleRatio
width: 260 * scaleRatio
Text { Text {
id: statusText
anchors.left: parent.left anchors.left: parent.left
font.family: "Arial" anchors.top: parent.top
font.pixelSize: 12 * scaleRatio anchors.topMargin: 0
color: "#545454" font.family: Style.fontMedium.name
font.bold: true
font.pixelSize: 13 * scaleRatio
color: "white"
opacity: 0.5
text: qsTr("Network status") + translationManager.emptyString text: qsTr("Network status") + translationManager.emptyString
} }
Text { Text {
id: statusTextVal
anchors.left: parent.left anchors.left: parent.left
font.family: "Arial" anchors.top: parent.top
font.pixelSize: 18 * scaleRatio anchors.topMargin: 14
font.family: Style.fontMedium.name
font.pixelSize: 20 * scaleRatio
color: getConnectionStatusColor(item.connected) color: getConnectionStatusColor(item.connected)
text: getConnectionStatusString(item.connected) + translationManager.emptyString text: getConnectionStatusString(item.connected) + translationManager.emptyString
} }

View file

@ -28,13 +28,15 @@
import QtQuick 2.0 import QtQuick 2.0
import moneroComponents.Wallet 1.0 import moneroComponents.Wallet 1.0
import "." 1.0
Rectangle { Rectangle {
id: item id: item
property int fillLevel: 0 property int fillLevel: 0
property string syncType // Wallet or Daemon property string syncType // Wallet or Daemon
property string syncText: qsTr("%1 blocks remaining: ").arg(syncType) property string syncText: qsTr("%1 blocks remaining: ").arg(syncType)
color: "#1C1C1C" visible: false
color: "transparent"
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){ function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
if(targetBlock > 0) { if(targetBlock > 0) {
@ -50,29 +52,57 @@ Rectangle {
} }
Item { Item {
anchors.topMargin: 10 * scaleRatio
anchors.leftMargin: 15 * scaleRatio anchors.leftMargin: 15 * scaleRatio
anchors.rightMargin: 15 * scaleRatio anchors.rightMargin: 15 * scaleRatio
anchors.fill: parent anchors.fill: parent
Text {
id: progressText
anchors.top: item.top
anchors.topMargin: 6
font.family: Style.fontMedium.name
font.pixelSize: 13 * scaleRatio
font.bold: true
color: "white"
text: qsTr("Synchronizing blocks")
height:18 * scaleRatio
}
Text {
id: progressTextValue
anchors.top: item.top
anchors.topMargin: 6
anchors.right: parent.right
font.family: Style.fontMedium.name
font.pixelSize: 13 * scaleRatio
font.bold: true
color: "white"
height:18 * scaleRatio
}
Rectangle { Rectangle {
id: bar id: bar
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: progressText.bottom
height: 22 * scaleRatio anchors.topMargin: 4
radius: 2 * scaleRatio height: 8 * scaleRatio
color: "#FFFFFF" radius: 8 * scaleRatio
color: "#333333" // progressbar bg
Rectangle { Rectangle {
id: fillRect id: fillRect
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.margins: 2 * scaleRatio
height: bar.height height: bar.height
property int maxWidth: parent.width - 4 * scaleRatio property int maxWidth: parent.width - 4 * scaleRatio
width: (maxWidth * fillLevel) / 100 width: (maxWidth * fillLevel) / 100
radius: 8
color: { color: {
if(item.fillLevel < 99 ) return "#FF6C3C" if(item.fillLevel < 99 ) return "#FA6800"
//if(item.fillLevel < 99) return "#FFE00A" //if(item.fillLevel < 99) return "#FFE00A"
return "#36B25C" return "#36B25C"
} }

BIN
images/lightning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

View file

@ -231,7 +231,7 @@ Rectangle {
width: mainLayout.labelWidth width: mainLayout.labelWidth
} }
// this LineEdit is for testing purposes // this LineEdit is for testing purposes
LineEdit { LineEdit {
id: amountLinex id: amountLinex
fontSize: mainLayout.lineEditFontSize fontSize: mainLayout.lineEditFontSize
@ -239,46 +239,7 @@ Rectangle {
readOnly: false readOnly: false
width: mainLayout.editWidth width: mainLayout.editWidth
Layout.fillWidth: true Layout.fillWidth: true
// validator: DoubleValidator { inlineButtonText: "Testy"
// bottom: 0.0
// top: 18446744.073709551615
// decimals: 12
// notation: DoubleValidator.StandardNotation
// locale: "C"
// }
Rectangle{
color: "#808080"
border.color: "black"
height: 20
width: 40
radius: 3
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: 8
anchors.topMargin: 8
Text {
id: xee
font.family: Style.fontBold.name
font.pixelSize: 16 * scaleRatio
color: "#FFFFFF"
text: "Send"
anchors.top: parent.top + 2
anchors.left: parent.left + 6
}
}
// IconButton {
// imageSource: "../images/copyToClipboard.png"
// onClicked: {
// if (integratedAddressLine.text.length > 0) {
// clipboard.setText(integratedAddressLine.text)
// appWindow.showStatusMessage(qsTr("Integrated address copied to clipboard"),3)
// }
// }
// }
} }
} }

View file

@ -185,5 +185,7 @@
<file>fonts/SFUIDisplay-Bold.otf</file> <file>fonts/SFUIDisplay-Bold.otf</file>
<file>components/Style.qml</file> <file>components/Style.qml</file>
<file>components/qmldir</file> <file>components/qmldir</file>
<file>components/InlineButton.qml</file>
<file>images/lightning.png</file>
</qresource> </qresource>
</RCC> </RCC>