From f262ce520978fa406e6531ffc9a8464a14a3a722 Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Sun, 10 Dec 2017 19:52:05 +0100 Subject: Finishing up on the settings page for now and modified some QML components --- components/Label.qml | 23 ++++++++++++---------- components/LabelSubheader.qml | 45 +++++++++++++++++++++++++++++++++++++++++++ components/LineEdit.qml | 9 +++++---- components/LineEditMulti.qml | 2 +- components/StandardButton.qml | 11 ++++++++--- 5 files changed, 72 insertions(+), 18 deletions(-) create mode 100644 components/LabelSubheader.qml (limited to 'components') diff --git a/components/Label.qml b/components/Label.qml index 86618c9e..b2c4e52f 100644 --- a/components/Label.qml +++ b/components/Label.qml @@ -42,8 +42,10 @@ Item { property alias wrapMode: label.wrapMode property alias horizontalAlignment: label.horizontalAlignment signal linkActivated() - width: icon.x + icon.width * scaleRatio - height: icon.height * scaleRatio +// width: icon.x + icon.width * scaleRatio +// height: icon.height * scaleRatio + height: label.height * scaleRatio + width: label.width * scaleRatio Layout.topMargin: 10 * scaleRatio Text { @@ -58,14 +60,15 @@ Item { onLinkActivated: item.linkActivated() } - Image { - id: icon - anchors.verticalCenter: parent.verticalCenter - anchors.left: label.right - anchors.leftMargin: 5 * scaleRatio - source: "../images/whatIsIcon.png" - visible: appWindow.whatIsEnable - } +// @TODO: figure out significance of whatIsIcon.png, remove for now +// Image { +// id: icon +// anchors.verticalCenter: parent.verticalCenter +// anchors.left: label.right +// anchors.leftMargin: 5 * scaleRatio +// source: "../images/whatIsIcon.png" +// visible: appWindow.whatIsEnable +// } // MouseArea { // anchors.fill: icon diff --git a/components/LabelSubheader.qml b/components/LabelSubheader.qml new file mode 100644 index 00000000..daa067e0 --- /dev/null +++ b/components/LabelSubheader.qml @@ -0,0 +1,45 @@ +// 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 "." 1.0 + +Label { + id: item + fontSize: 17 * scaleRatio + + Rectangle { + anchors.top: item.bottom + anchors.topMargin: 4 + anchors.left: parent.left + anchors.right: parent.right + height: 2 + color: Style.dividerColor + opacity: Style.dividerOpacity + } +} diff --git a/components/LineEdit.qml b/components/LineEdit.qml index d52db763..42da1e9d 100644 --- a/components/LineEdit.qml +++ b/components/LineEdit.qml @@ -53,12 +53,13 @@ Item { property bool labelFontBold: false property alias labelWrapMode: inputLabel.wrapMode property alias labelHorizontalAlignment: inputLabel.horizontalAlignment + property bool showingHeader: inputLabel.text !== "" || copyButton signal labelLinkActivated(); // input label, rich text signal signal editingFinished(); signal accepted(); signal textUpdated(); - height: (inputLabel.height + inputItem.height + 2) * scaleRatio + height: showingHeader ? (inputLabel.height + inputItem.height + 2) * scaleRatio : 42 * scaleRatio onTextUpdated: { // check to remove placeholder text when there is content @@ -109,14 +110,14 @@ Item { appWindow.showStatusMessage(qsTr("Copied to clipboard"),3) } } - visible: input.text && copyButton ? true : false + visible: copyButton && input.text !== "" } Item{ id: inputItem height: 40 * scaleRatio - anchors.top: inputLabel.bottom - anchors.topMargin: 6 * scaleRatio + anchors.top: showingHeader ? inputLabel.bottom : parent.top + anchors.topMargin: showingHeader ? 6 * scaleRatio : 2 width: parent.width Text { diff --git a/components/LineEditMulti.qml b/components/LineEditMulti.qml index 91078e24..6c9dcf7a 100644 --- a/components/LineEditMulti.qml +++ b/components/LineEditMulti.qml @@ -71,7 +71,7 @@ ColumnLayout { LabelButton { id: copyButtonId - visible: copyButton + visible: copyButton && multiLine.text !== "" text: qsTr("Copy") anchors.right: labelButton.visible ? inputLabel.right : parent.right anchors.rightMargin: labelButton.visible? 4 : 0 diff --git a/components/StandardButton.qml b/components/StandardButton.qml index f41c104a..76c8c889 100644 --- a/components/StandardButton.qml +++ b/components/StandardButton.qml @@ -32,15 +32,20 @@ import "." 1.0 Item { id: button - height: 37 * scaleRatio property string icon: "" property string textColor: button.enabled? Style.buttonTextColor: Style.buttonTextColorDisabled - property int fontSize: 16 * scaleRatio + property bool small: false property alias text: label.text + property int fontSize: { + if(small) return 14 * scaleRatio; + else return 16 * scaleRatio; + } signal clicked() - // Dynamic label width + // Dynamic height/width Layout.minimumWidth: (label.contentWidth > 50)? label.contentWidth + 22 : 60 + height: small ? 30 * scaleRatio : 36 * scaleRatio + function doClick() { // Android workaround -- cgit v1.2.3