diff options
| author | Sander Ferdinand <sa.ferdinand@gmail.com> | 2018-01-28 00:14:42 +0100 |
|---|---|---|
| committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-03-29 23:04:03 +0100 |
| commit | 49770494251a318da37849f1c628f25edaf94483 (patch) | |
| tree | 59102bc024ced24aa836ae392f3a98712a09e461 /components | |
| parent | 53b5b7a5c7a7894c04bdedad345f733be1dd34b7 (diff) | |
| download | monzero-gui-49770494251a318da37849f1c628f25edaf94483.tar.gz monzero-gui-49770494251a318da37849f1c628f25edaf94483.tar.xz monzero-gui-49770494251a318da37849f1c628f25edaf94483.zip | |
Fixes some fonts, introduces a new checkbox and fixes 0 amount history entries
Diffstat (limited to 'components')
| -rw-r--r-- | components/CheckBox2.qml | 99 | ||||
| -rw-r--r-- | components/DatePicker.qml | 4 | ||||
| -rw-r--r-- | components/HistoryTable.qml | 19 | ||||
| -rw-r--r-- | components/InputMulti.qml | 11 | ||||
| -rw-r--r-- | components/Label.qml | 12 | ||||
| -rw-r--r-- | components/LineEdit.qml | 11 | ||||
| -rw-r--r-- | components/LineEditMulti.qml | 6 | ||||
| -rw-r--r-- | components/StandardDropdown.qml | 6 |
8 files changed, 147 insertions, 21 deletions
diff --git a/components/CheckBox2.qml b/components/CheckBox2.qml new file mode 100644 index 00000000..dd48624e --- /dev/null +++ b/components/CheckBox2.qml @@ -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(); + } + } + } + + + } +} diff --git a/components/DatePicker.qml b/components/DatePicker.qml index c08f97ad..ace95d2d 100644 --- a/components/DatePicker.qml +++ b/components/DatePicker.qml @@ -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 diff --git a/components/HistoryTable.qml b/components/HistoryTable.qml index 9954e4da..c083ef3c 100644 --- a/components/HistoryTable.qml +++ b/components/HistoryTable.qml @@ -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" } diff --git a/components/InputMulti.qml b/components/InputMulti.qml index 0f030f2d..2df797e2 100644 --- a/components/InputMulti.qml +++ b/components/InputMulti.qml @@ -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 }` diff --git a/components/Label.qml b/components/Label.qml index 5ad72e08..ac0ff487 100644 --- a/components/Label.qml +++ b/components/Label.qml @@ -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 diff --git a/components/LineEdit.qml b/components/LineEdit.qml index 330e3bba..f488790d 100644 --- a/components/LineEdit.qml +++ b/components/LineEdit.qml @@ -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() diff --git a/components/LineEditMulti.qml b/components/LineEditMulti.qml index 5cc76e2d..43d67602 100644 --- a/components/LineEditMulti.qml +++ b/components/LineEditMulti.qml @@ -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 diff --git a/components/StandardDropdown.qml b/components/StandardDropdown.qml index 371b426e..0d6e771d 100644 --- a/components/StandardDropdown.qml +++ b/components/StandardDropdown.qml @@ -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" |
