From 49770494251a318da37849f1c628f25edaf94483 Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Sun, 28 Jan 2018 00:14:42 +0100 Subject: [PATCH] Fixes some fonts, introduces a new checkbox and fixes 0 amount history entries --- components/CheckBox2.qml | 99 +++++++++++++++++++++++++++++++++ components/DatePicker.qml | 4 +- components/HistoryTable.qml | 19 ++++++- components/InputMulti.qml | 11 +++- components/Label.qml | 12 ++-- components/LineEdit.qml | 11 ++-- components/LineEditMulti.qml | 6 +- components/StandardDropdown.qml | 6 +- pages/History.qml | 1 - pages/Keys.qml | 73 +++++++++++++----------- pages/Mining.qml | 10 +++- pages/Settings.qml | 3 + pages/Transfer.qml | 25 +++++---- qml.qrc | 1 + wizard/WizardDaemonSettings.qml | 1 + 15 files changed, 213 insertions(+), 69 deletions(-) create mode 100644 components/CheckBox2.qml 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" diff --git a/pages/History.qml b/pages/History.qml index 6a0206f8..3a2c79ad 100644 --- a/pages/History.qml +++ b/pages/History.qml @@ -219,7 +219,6 @@ Rectangle { Layout.minimumWidth: 120 * scaleRatio text: qsTr("Sort") + translationManager.emptyString fontSize: 14 - fontBold: true } ListModel { diff --git a/pages/Keys.qml b/pages/Keys.qml index 4bcff537..50928579 100644 --- a/pages/Keys.qml +++ b/pages/Keys.qml @@ -31,73 +31,76 @@ import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.2 -import "../version.js" as Version - - -import "../components" import moneroComponents.Clipboard 1.0 +import "../version.js" as Version +import "../components" +import "." 1.0 + Rectangle { property bool viewOnly: false id: page - color: "#F0EEEE" + color: "transparent" Clipboard { id: clipboard } ColumnLayout { id: mainLayout - anchors.margins: 17 * scaleRatio + anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right - spacing: 20 * scaleRatio + + anchors.margins: (isMobile)? 17 : 20 + anchors.topMargin: 40 * scaleRatio + + spacing: 30 * scaleRatio Layout.fillWidth: true //! Manage wallet ColumnLayout { Layout.fillWidth: true + Label { Layout.fillWidth: true + fontSize: 22 * scaleRatio + Layout.topMargin: 10 * scaleRatio text: qsTr("Mnemonic seed") + translationManager.emptyString } Rectangle { Layout.fillWidth: true - height: 1 - color: "#DEDEDE" + height: 2 + color: Style.dividerColor + opacity: Style.dividerOpacity + Layout.bottomMargin: 10 * scaleRatio } - TextEdit { + + LineEditMulti{ id: seedText - wrapMode: TextEdit.Wrap - Layout.fillWidth: true; - font.pixelSize: 14 * scaleRatio + spacing: 0 + copyButton: true + addressValidation: false readOnly: true - MouseArea { - anchors.fill: parent - onClicked: { - appWindow.showStatusMessage(qsTr("Double tap to copy"),3) - } - onDoubleClicked: { - parent.selectAll() - parent.copy() - parent.deselect() - console.log("copied to clipboard"); - appWindow.showStatusMessage(qsTr("Seed copied to clipboard"),3) - } - } + wrapAnywhere: false } } ColumnLayout { Layout.fillWidth: true + Label { Layout.fillWidth: true + fontSize: 22 * scaleRatio + Layout.topMargin: 10 * scaleRatio text: qsTr("Keys") + translationManager.emptyString } Rectangle { Layout.fillWidth: true - height: 1 - color: "#DEDEDE" + height: 2 + color: Style.dividerColor + opacity: Style.dividerOpacity + Layout.bottomMargin: 10 * scaleRatio } TextEdit { id: keysText @@ -106,6 +109,7 @@ Rectangle { font.pixelSize: 14 * scaleRatio textFormat: TextEdit.RichText readOnly: true + color: Style.defaultFontColor MouseArea { anchors.fill: parent onClicked: { @@ -124,21 +128,26 @@ Rectangle { ColumnLayout { Layout.fillWidth: true + Label { Layout.fillWidth: true + fontSize: 22 * scaleRatio + Layout.topMargin: 10 * scaleRatio text: qsTr("Export wallet") + translationManager.emptyString } Rectangle { Layout.fillWidth: true - height: 1 - color: "#DEDEDE" + height: 2 + color: Style.dividerColor + opacity: Style.dividerOpacity + Layout.bottomMargin: 10 * scaleRatio } - RowLayout { StandardButton { enabled: !fullWalletQRCode.visible id: showFullQr + small: true text: qsTr("Spendable Wallet") + translationManager.emptyString onClicked: { viewOnlyQRCode.visible = false @@ -147,6 +156,7 @@ Rectangle { StandardButton { enabled: fullWalletQRCode.visible id: showViewOnlyQr + small: true text: qsTr("View Only Wallet") + translationManager.emptyString onClicked: { viewOnlyQRCode.visible = true @@ -155,7 +165,6 @@ Rectangle { Layout.bottomMargin: 30 * scaleRatio } - Image { visible: !viewOnlyQRCode.visible id: fullWalletQRCode diff --git a/pages/Mining.qml b/pages/Mining.qml index 5726acba..11275347 100644 --- a/pages/Mining.qml +++ b/pages/Mining.qml @@ -34,7 +34,7 @@ import moneroComponents.Wallet 1.0 Rectangle { id: root - color: "#F0EEEE" + color: "transparent" property var currentHashRate: 0 /* main layout */ @@ -74,13 +74,16 @@ Rectangle { text: qsTr("Mining with your computer helps strengthen the Monero network. The more that people mine, the harder it is for the network to be attacked, and every little bit helps.

Mining also gives you a small chance to earn some Monero. Your computer will create hashes looking for block solutions. If you find a block, you will get the associated reward. Good luck!") + translationManager.emptyString wrapMode: Text.Wrap Layout.fillWidth: true + font.family: Style.fontRegular + font.pixelSize: 14 * scaleRatio + color: Style.defaultFontColor } RowLayout { id: soloMinerThreadsRow Label { id: soloMinerThreadsLabel - color: "#4A4949" + color: Style.defaultFontColor text: qsTr("CPU threads") + translationManager.emptyString fontSize: 16 Layout.preferredWidth: 120 @@ -122,7 +125,7 @@ Rectangle { RowLayout { Label { id: manageSoloMinerLabel - color: "#4A4949" + color: Style.defaultFontColor text: qsTr("Manage miner") + translationManager.emptyString fontSize: 16 } @@ -165,6 +168,7 @@ Rectangle { Text { id: statusText text: qsTr("Status: not mining") + color: Style.defaultFontColor textFormat: Text.RichText wrapMode: Text.Wrap } diff --git a/pages/Settings.qml b/pages/Settings.qml index 4fd49cb4..c0a152a8 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -239,6 +239,9 @@ Rectangle { Layout.minimumWidth: 100 * scaleRatio daemonAddrLabelText: qsTr("Address") daemonPortLabelText: qsTr("Port") + lineEditBackgroundColor: "transparent" + lineEditFontColor: "white" + lineEditBorderColor: Qt.rgba(255, 255, 255, 0.35) daemonAddrText: persistentSettings.remoteNodeAddress.split(":")[0].trim() daemonPortText: (persistentSettings.remoteNodeAddress.split(":")[1].trim() == "") ? "18081" : persistentSettings.remoteNodeAddress.split(":")[1] onEditingFinished: { diff --git a/pages/Transfer.qml b/pages/Transfer.qml index 96bd0dc1..b5fbfbea 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -120,7 +120,7 @@ Rectangle { anchors.top: parent.top anchors.right: parent.right - spacing: 26 * scaleRatio + spacing: 30 * scaleRatio GridLayout { columns: (isMobile)? 1 : 2 @@ -160,8 +160,9 @@ Rectangle { Layout.fillWidth: true Label { id: transactionPriority + Layout.topMargin: 14 text: qsTr("Transaction priority") + translationManager.emptyString - fontBold: true + fontBold: false fontSize: 14 } // Note: workaround for translations in listElements @@ -185,6 +186,7 @@ Rectangle { StandardDropdown { Layout.fillWidth: true id: priorityDropdown + Layout.topMargin: 6 shadowReleasedColor: "#FF4304" shadowPressedColor: "#B32D00" releasedColor: "#363636" @@ -278,8 +280,7 @@ Rectangle { StandardButton { id: sendButton rightIcon: "../images/rightIcon.png" - Layout.bottomMargin: 17 * scaleRatio - Layout.topMargin: 17 * scaleRatio + Layout.topMargin: 4 * scaleRatio text: qsTr("Send") + translationManager.emptyString enabled : !appWindow.viewOnly && pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet) onClicked: { @@ -317,7 +318,7 @@ Rectangle { } // pageRoot Rectangle { - id:desaturate + id: desaturate color:"black" anchors.fill: parent opacity: 0.1 @@ -329,18 +330,18 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right anchors.margins: (isMobile)? 17 : 20 - anchors.topMargin: 40 * scaleRatio + anchors.topMargin: 32 * scaleRatio spacing: 26 * scaleRatio enabled: !viewOnly || pageRoot.enabled RowLayout { - CheckBox { + CheckBox2 { id: showAdvancedCheckbox checked: persistentSettings.transferShowAdvanced onClicked: { persistentSettings.transferShowAdvanced = !persistentSettings.transferShowAdvanced } - text: qsTr("Show advanced options") + translationManager.emptyString + text: qsTr("Advanced options") + translationManager.emptyString } } @@ -401,6 +402,7 @@ Rectangle { id: sweepUnmixableButton text: qsTr("Sweep Unmixable") + translationManager.emptyString enabled : pageRoot.enabled + small: true onClicked: { console.log("Transfer: sweepUnmixableClicked") root.sweepUnmixableClicked() @@ -412,6 +414,7 @@ Rectangle { text: qsTr("Create tx file") + translationManager.emptyString visible: appWindow.viewOnly enabled: pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype) + small: true onClicked: { console.log("Transfer: saveTx Clicked") var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority @@ -428,6 +431,7 @@ Rectangle { StandardButton { id: signTxButton text: qsTr("Sign tx file") + translationManager.emptyString + small: true visible: !appWindow.viewOnly onClicked: { console.log("Transfer: sign tx clicked") @@ -438,6 +442,7 @@ Rectangle { StandardButton { id: submitTxButton text: qsTr("Submit tx file") + translationManager.emptyString + small: true visible: appWindow.viewOnly enabled: pageRoot.enabled onClicked: { @@ -446,12 +451,8 @@ Rectangle { } } } - - } - - //SignTxDialog FileDialog { id: signTxDialog diff --git a/qml.qrc b/qml.qrc index e6d5c51c..11d2d448 100644 --- a/qml.qrc +++ b/qml.qrc @@ -201,5 +201,6 @@ images/downArrow.png images/historyBorderRadius.png components/HistoryTableInnerColumn.qml + components/CheckBox2.qml diff --git a/wizard/WizardDaemonSettings.qml b/wizard/WizardDaemonSettings.qml index c94beaa8..f7142468 100644 --- a/wizard/WizardDaemonSettings.qml +++ b/wizard/WizardDaemonSettings.qml @@ -144,6 +144,7 @@ ColumnLayout { Layout.fillWidth: true Layout.topMargin: 20 * scaleRatio fontSize: 14 * scaleRatio + fontColor: "black" text: qsTr("Blockchain location") + translationManager.emptyString } LineEdit {