Fixes some fonts, introduces a new checkbox and fixes 0 amount history entries

This commit is contained in:
Sander Ferdinand
2018-01-28 00:14:42 +01:00
committed by moneromooo-monero
parent 53b5b7a5c7
commit 4977049425
15 changed files with 213 additions and 69 deletions

99
components/CheckBox2.qml Normal file
View File

@@ -0,0 +1,99 @@
// 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
import "." 1.0
RowLayout {
id: checkBox
property alias text: label.text
property string checkedIcon: "../images/checkedIcon-black.png"
property string uncheckedIcon
property bool checked: false
property string background: "backgroundRect.color"
property int fontSize: 14 * scaleRatio
property alias fontColor: label.color
property int textMargin: 8 * scaleRatio
signal clicked()
height: 25 * scaleRatio
function toggle(){
checkBox.checked = !checkBox.checked
checkBox.clicked()
}
RowLayout {
Layout.fillWidth: true
Rectangle{
height: label.height
width: (label.width + indicatorRect.width + checkBox.textMargin)
color: "transparent"
anchors.left: parent.left
Text {
id: label
font.family: Style.fontLight
font.pixelSize: checkBox.fontSize
color: Style.defaultFontColor
wrapMode: Text.Wrap
Layout.fillWidth: true
anchors.left: parent.left
}
Rectangle {
id: indicatorRect
width: indicatorImage.width
height: label.height
anchors.left: label.right
anchors.leftMargin: textMargin
color: "transparent"
Image {
id: indicatorImage
anchors.centerIn: parent
source: "../images/whiteDropIndicator.png"
rotation: checkBox.checked ? 180 * scaleRatio : 0
verticalAlignment: parent.verticalCenter
}
}
MouseArea{
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
toggle();
}
}
}
}
}

View File

@@ -73,9 +73,9 @@ Item {
anchors.top: parent.top
anchors.topMargin: 2
anchors.left: parent.left
font.family: Style.fontRegular.name
font.family: Style.fontLight
font.pixelSize: 14
font.bold: true
font.bold: false
textFormat: Text.RichText
color: Style.defaultFontColor

View File

@@ -156,7 +156,7 @@ ListView {
id: txrxLabel
anchors.left: arrowImage.right
anchors.leftMargin: 18 * scaleRatio
font.family: Style.fontRegular.name
font.family: Style.fontLight.name
font.pixelSize: 14 * scaleRatio
text: isOut ? "Sent" : "Received"
color: "#808080"
@@ -195,7 +195,22 @@ ListView {
font.family: Style.fontBold.name
font.pixelSize: 18 * scaleRatio
font.bold: true
text: { return (displayAmount * 1) + " XMR" } // hack, removes trailing zeros
text: {
// hack, removes trailing zeros
var amount = (displayAmount * 1);
// sometimes, displayAmount is 0 - no idea why.
// in that case, we try to get the amount from
// the `destinations` string.
if(amount === 0){
amount = destinations.split(" ")[0].split(":")[0];
amount = (amount *1);
}
// sometimes this destinations string also shows 0,
// at which point we run out of options.
return amount + " XMR";
}
color: isOut ? "white" : "#2eb358"
}

View File

@@ -35,14 +35,21 @@ import "." 1.0
TextArea {
property bool error: false
property bool addressValidation: false
property bool wrapAnywhere: true
id: textArea
font.family: Style.fontRegular.name
font.pixelSize: 18 * scaleRatio
font.bold: true
font.bold: false
horizontalAlignment: TextInput.AlignLeft
selectByMouse: true
color: Style.defaultFontColor
wrapMode: Text.WrapAnywhere
wrapMode: {
if(wrapAnywhere){
return Text.WrapAnywhere;
} else {
return Text.WordWrap;
}
}
onTextChanged: {
if(addressValidation){
// js replacement for `RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }`

View File

@@ -40,12 +40,10 @@ Item {
property int fontSize: 16 * scaleRatio
property bool fontBold: false
property string fontColor: Style.defaultFontColor
property string fontFamily: Style.fontRegular.name
property string fontFamily: ""
property alias wrapMode: label.wrapMode
property alias horizontalAlignment: label.horizontalAlignment
signal linkActivated()
// width: icon.x + icon.width * scaleRatio
// height: icon.height * scaleRatio
height: label.height * scaleRatio
width: label.width * scaleRatio
Layout.topMargin: 10 * scaleRatio
@@ -55,7 +53,13 @@ Item {
anchors.bottom: parent.bottom
anchors.bottomMargin: 2 * scaleRatio
anchors.left: parent.left
font.family: fontFamily
font.family: {
if(fontFamily){
return fontFamily;
} else {
return Style.fontLight;
}
}
font.pixelSize: fontSize
font.bold: fontBold
color: fontColor

View File

@@ -53,17 +53,16 @@ Item {
property bool borderDisabled: false
property int fontSize: 18 * scaleRatio
property bool showBorder: true
property bool fontBold: true
property bool fontBold: false
property alias fontColor: input.color
property bool error: false
property alias labelText: inputLabel.text
property alias labelColor: inputLabel.color
property alias labelTextFormat: inputLabel.textFormat
property string labelFontFamily: Style.fontRegular.name
property string backgroundColor: "transparent"
property string tipText: ""
property int labelFontSize: 14 * scaleRatio
property bool labelFontBold: true
property bool labelFontBold: false
property alias labelWrapMode: inputLabel.wrapMode
property alias labelHorizontalAlignment: inputLabel.horizontalAlignment
property bool showingHeader: inputLabel.text !== "" || copyButton
@@ -100,7 +99,7 @@ Item {
anchors.top: parent.top
anchors.left: parent.left
anchors.topMargin: 2 * scaleRatio
font.family: labelFontFamily
font.family: Style.fontLight
font.pixelSize: labelFontSize
font.bold: labelFontBold
textFormat: Text.RichText
@@ -132,7 +131,7 @@ Item {
id: inputItem
height: inputHeight * scaleRatio
anchors.top: showingHeader ? inputLabel.bottom : parent.top
anchors.topMargin: showingHeader ? 6 * scaleRatio : 2
anchors.topMargin: showingHeader ? 12 * scaleRatio : 2
width: parent.width
Text {
@@ -189,7 +188,7 @@ Item {
anchors.fill: parent
anchors.leftMargin: inlineIcon.visible ? 38 : 0
font.pixelSize: item.fontSize
font.bold: fontBold
font.bold: item.fontBold
onEditingFinished: item.editingFinished()
onAccepted: item.accepted();
onTextChanged: item.textUpdated()

View File

@@ -39,9 +39,10 @@ ColumnLayout {
property alias readOnly: multiLine.readOnly
property alias addressValidation: multiLine.addressValidation
property alias labelButtonText: labelButton.text
property bool labelFontBold: true
property bool labelFontBold: false
property bool labelButtonVisible: false
property bool copyButton: false
property bool wrapAnywhere: true
signal labelButtonClicked();
signal inputLabelLinkActivated();
@@ -56,7 +57,7 @@ ColumnLayout {
id: inputLabel
anchors.top: parent.top
anchors.left: parent.left
font.family: Style.fontRegular.name
font.family: Style.fontLight
font.pixelSize: 14 * scaleRatio
font.bold: labelFontBold
textFormat: Text.RichText
@@ -94,6 +95,7 @@ ColumnLayout {
Layout.fillWidth: true
topPadding: 10 * scaleRatio
bottomPadding: 10 * scaleRatio
wrapAnywhere: parent.wrapAnywhere
Text {
id: placeholderLabel

View File

@@ -39,12 +39,12 @@ Item {
property string textColor: "#FFFFFF"
property alias currentIndex: column.currentIndex
property bool expanded: false
property int dropdownHeight: 40
property int dropdownHeight: 42
property int fontHeaderSize: 16 * scaleRatio
property int fontItemSize: 14 * scaleRatio
property string colorHeaderBackground: "transparent"
property bool headerBorder: true
property bool headerFontBold: true
property bool headerFontBold: false
height: dropdownHeight
@@ -90,7 +90,7 @@ Item {
anchors.left: parent.left
anchors.leftMargin: 12 * scaleRatio
elide: Text.ElideRight
font.family: Style.fontRegular.name
font.family: Style.fontRegular
font.bold: dropdown.headerFontBold
font.pixelSize: dropdown.fontHeaderSize
color: "#FFFFFF"