aboutsummaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-08-14 16:15:31 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-08-14 16:15:31 -0500
commit3483b8dbec4d723262861ce91ca175647494c287 (patch)
treece1e2d78aeffa643e92584bda42c88b612eb695d /components
parenteece475fb8daa572df03352fe3950a7d950fc1ce (diff)
parent034f83bfb3982bce8203fbda933248810f673868 (diff)
downloadmonzero-gui-3483b8dbec4d723262861ce91ca175647494c287.tar.gz
monzero-gui-3483b8dbec4d723262861ce91ca175647494c287.tar.xz
monzero-gui-3483b8dbec4d723262861ce91ca175647494c287.zip
Merge pull request #1511
Settings overhaul (27 commits by skftn)
Diffstat (limited to 'components')
-rw-r--r--components/HistoryTableInnerColumn.qml4
-rw-r--r--components/InputDialog.qml2
-rw-r--r--components/InputMulti.qml20
-rw-r--r--components/LineEdit.qml8
-rw-r--r--components/LineEditMulti.qml108
-rw-r--r--components/PasswordDialog.qml2
-rw-r--r--components/RemoteNodeEdit.qml15
-rw-r--r--components/StandardDropdown.qml2
-rw-r--r--components/Style.qml1
-rw-r--r--components/WarningBox.qml63
10 files changed, 166 insertions, 59 deletions
diff --git a/components/HistoryTableInnerColumn.qml b/components/HistoryTableInnerColumn.qml
index 8a8acbe7..566c2466 100644
--- a/components/HistoryTableInnerColumn.qml
+++ b/components/HistoryTableInnerColumn.qml
@@ -53,7 +53,7 @@ Rectangle{
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
text: labelHeader
- color: MoneroComponents.Style.greyFontColor
+ color: MoneroComponents.Style.dimmedFontColor
}
Text {
@@ -77,7 +77,7 @@ Rectangle{
label2.color = MoneroComponents.Style.defaultFontColor;
}
onExited: {
- label1.color = MoneroComponents.Style.greyFontColor;
+ label1.color = MoneroComponents.Style.dimmedFontColor
label2.color = MoneroComponents.Style.dimmedFontColor;
}
onClicked: {
diff --git a/components/InputDialog.qml b/components/InputDialog.qml
index e51a16db..ac56a56b 100644
--- a/components/InputDialog.qml
+++ b/components/InputDialog.qml
@@ -103,6 +103,8 @@ Item {
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
+ selectionColor: MoneroComponents.Style.dimmedFontColor
+ selectedTextColor: MoneroComponents.Style.defaultFontColor
background: Rectangle {
radius: 2
diff --git a/components/InputMulti.qml b/components/InputMulti.qml
index b8005354..f7706d75 100644
--- a/components/InputMulti.qml
+++ b/components/InputMulti.qml
@@ -32,31 +32,25 @@ import QtQuick 2.7
import "../js/TxUtils.js" as TxUtils
import "../components" as MoneroComponents
-
TextArea {
- property bool error: false
- property bool addressValidation: false
- property bool wrapAnywhere: true
property int fontSize: 18 * scaleRatio
property bool fontBold: false
+ property string fontColor: MoneroComponents.Style.defaultFontColor
+
+ property bool mouseSelection: true
+ property bool error: false
+ property bool addressValidation: false
id: textArea
font.family: MoneroComponents.Style.fontRegular.name
+ color: fontColor
font.pixelSize: fontSize
font.bold: fontBold
horizontalAlignment: TextInput.AlignLeft
- selectByMouse: true
- color: MoneroComponents.Style.defaultFontColor
+ selectByMouse: mouseSelection
selectionColor: MoneroComponents.Style.dimmedFontColor
selectedTextColor: MoneroComponents.Style.defaultFontColor
- 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/LineEdit.qml b/components/LineEdit.qml
index 8a194c12..9eb50b04 100644
--- a/components/LineEdit.qml
+++ b/components/LineEdit.qml
@@ -50,6 +50,8 @@ Item {
property alias inlineButtonText: inlineButtonId.text
property alias inlineIcon: inlineIcon.visible
property bool copyButton: false
+
+ property bool borderDisabled: false
property string borderColor: {
if(input.activeFocus){
return MoneroComponents.Style.inputBorderColorActive;
@@ -57,9 +59,8 @@ Item {
return MoneroComponents.Style.inputBorderColorInActive;
}
}
- property bool borderDisabled: false
+
property int fontSize: 18 * scaleRatio
- property bool showBorder: true
property bool fontBold: false
property alias fontColor: input.color
property bool error: false
@@ -140,6 +141,7 @@ Item {
anchors.top: showingHeader ? inputLabel.bottom : parent.top
anchors.topMargin: showingHeader ? 12 * scaleRatio : 2 * scaleRatio
width: parent.width
+ clip: true
Text {
id: placeholderLabel
@@ -200,6 +202,8 @@ Item {
onEditingFinished: item.editingFinished()
onAccepted: item.accepted();
onTextChanged: item.textUpdated()
+ topPadding: 10 * scaleRatio
+ bottomPadding: 10 * scaleRatio
}
MoneroComponents.InlineButton {
diff --git a/components/LineEditMulti.qml b/components/LineEditMulti.qml
index 8243a7ee..87cee6d4 100644
--- a/components/LineEditMulti.qml
+++ b/components/LineEditMulti.qml
@@ -32,25 +32,56 @@ import QtQuick.Layouts 1.1
import "../components" as MoneroComponents
ColumnLayout {
- id: lineditmulti
- property alias text: multiLine.text
- property alias placeholderText: placeholderLabel.text
+ id: item
+
+ Layout.fillWidth: true
+ Layout.preferredHeight: childrenRect.height
+
+ property alias text: input.text
property alias labelText: inputLabel.text
- property alias error: multiLine.error
- property alias readOnly: multiLine.readOnly
- property alias addressValidation: multiLine.addressValidation
property alias labelButtonText: labelButton.text
+ property alias placeholderText: placeholderLabel.text
+
+ property bool placeholderCenter: false
+ property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
+ property bool placeholderFontBold: false
+ property int placeholderFontSize: 18 * scaleRatio
+ property string placeholderColor: MoneroComponents.Style.defaultFontColor
+ property real placeholderOpacity: 0.35
+
+ property bool borderDisabled: false
+ property string borderColor: {
+ if(input.error && input.text !== ""){
+ return MoneroComponents.Style.inputBorderColorInvalid;
+ } else if(input.activeFocus){
+ return MoneroComponents.Style.inputBorderColorActive;
+ } else {
+ return MoneroComponents.Style.inputBorderColorInActive;
+ }
+ }
+
+ property bool error: false
+
+ property string labelFontColor: MoneroComponents.Style.defaultFontColor
property bool labelFontBold: false
+ property int labelFontSize: 16 * scaleRatio
property bool labelButtonVisible: false
- property bool copyButton: false
- property bool wrapAnywhere: true
- property bool showingHeader: true
- property bool showBorder: true
+
+ property string fontColor: "white"
property bool fontBold: false
property int fontSize: 16 * scaleRatio
+ property bool mouseSelection: true
+ property alias readOnly: input.readOnly
+ property bool copyButton: false
+ property bool showingHeader: true
+ property var wrapMode: Text.NoWrap
+ property alias addressValidation: input.addressValidation
+ property string backgroundColor: "" // mock
+
signal labelButtonClicked();
signal inputLabelLinkActivated();
+ signal editingFinished();
spacing: 0
Rectangle {
@@ -65,11 +96,17 @@ ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
font.family: MoneroComponents.Style.fontRegular.name
- font.pixelSize: 16 * scaleRatio
+ font.pixelSize: item.labelFontSize
font.bold: labelFontBold
textFormat: Text.RichText
- color: MoneroComponents.Style.defaultFontColor
+ color: item.labelFontColor
onLinkActivated: inputLabelLinkActivated()
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.NoButton
+ cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
+ }
}
MoneroComponents.LabelButton {
@@ -80,14 +117,14 @@ ColumnLayout {
MoneroComponents.LabelButton {
id: copyButtonId
- visible: copyButton && multiLine.text !== ""
+ visible: copyButton && input.text !== ""
text: qsTr("Copy")
anchors.right: labelButton.visible ? inputLabel.right : parent.right
anchors.rightMargin: labelButton.visible? 4 : 0
onClicked: {
- if (multiLine.text.length > 0) {
+ if (input.text.length > 0) {
console.log("Copied to clipboard");
- clipboard.setText(multiLine.text);
+ clipboard.setText(input.text);
appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3);
}
}
@@ -95,27 +132,32 @@ ColumnLayout {
}
MoneroComponents.InputMulti {
- id: multiLine
+ id: input
readOnly: false
- addressValidation: true
- anchors.top: parent.showingHeader ? inputLabelRect.bottom : parent.top
+ addressValidation: false
+ anchors.top: item.showingHeader ? inputLabelRect.bottom : item.top
Layout.fillWidth: true
- topPadding: parent.showingHeader ? 10 * scaleRatio : 0
+ topPadding: item.showingHeader ? 10 * scaleRatio : 0
bottomPadding: 10 * scaleRatio
- wrapAnywhere: parent.wrapAnywhere
- fontSize: parent.fontSize
- fontBold: parent.fontBold
+ wrapMode: item.wrapMode
+ fontSize: item.fontSize
+ fontBold: item.fontBold
+ fontColor: item.fontColor
+ mouseSelection: item.mouseSelection
+ onEditingFinished: item.editingFinished()
+ error: item.error
Text {
id: placeholderLabel
- visible: multiLine.text ? false : true
+ visible: input.text ? false : true
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10 * scaleRatio
- opacity: 0.35
- color: MoneroComponents.Style.defaultFontColor
- font.family: MoneroComponents.Style.fontRegular.name
- font.pixelSize: 18 * scaleRatio
+ opacity: item.placeholderOpacity
+ color: item.placeholderColor
+ font.family: item.placeholderFontFamily
+ font.bold: item.placeholderFontBold
+ font.pixelSize: item.placeholderFontSize
text: ""
z: 3
}
@@ -123,18 +165,10 @@ ColumnLayout {
Rectangle {
color: "transparent"
border.width: 1
- border.color: {
- if(multiLine.error && multiLine.text !== ""){
- return MoneroComponents.Style.inputBorderColorInvalid;
- } else if(multiLine.activeFocus){
- return MoneroComponents.Style.inputBorderColorActive;
- } else {
- return MoneroComponents.Style.inputBorderColorInActive;
- }
- }
+ border.color: item.borderColor
radius: 4
anchors.fill: parent
- visible: lineditmulti.showBorder
+ visible: !item.borderDisabled
}
}
}
diff --git a/components/PasswordDialog.qml b/components/PasswordDialog.qml
index 8e75193d..1da76a6d 100644
--- a/components/PasswordDialog.qml
+++ b/components/PasswordDialog.qml
@@ -108,6 +108,8 @@ Item {
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
+ selectionColor: MoneroComponents.Style.dimmedFontColor
+ selectedTextColor: MoneroComponents.Style.defaultFontColor
background: Rectangle {
radius: 2
diff --git a/components/RemoteNodeEdit.qml b/components/RemoteNodeEdit.qml
index ecc8b496..36d2ee94 100644
--- a/components/RemoteNodeEdit.qml
+++ b/components/RemoteNodeEdit.qml
@@ -53,6 +53,8 @@ GridLayout {
property string lineEditBorderColor: Qt.rgba(0, 0, 0, 0.15)
property string lineEditBackgroundColor: "white"
property string lineEditFontColor: "black"
+ property int lineEditFontSize: 18 * scaleRatio
+ property int labelFontSize: 16 * scaleRatio
property bool lineEditFontBold: true
signal editingFinished()
@@ -61,7 +63,7 @@ GridLayout {
return daemonAddr.text.trim() + ":" + daemonPort.text.trim()
}
- LineEdit {
+ LineEditMulti {
id: daemonAddr
Layout.fillWidth: true
placeholderText: qsTr("Remote Node Hostname / IP") + translationManager.emptyString
@@ -70,14 +72,16 @@ GridLayout {
placeholderFontSize: root.placeholderFontSize
placeholderColor: root.placeholderColor
placeholderOpacity: root.placeholderOpacity
- onEditingFinished: root.editingFinished()
+ labelFontSize: root.labelFontSize
borderColor: lineEditBorderColor
backgroundColor: lineEditBackgroundColor
fontColor: lineEditFontColor
fontBold: lineEditFontBold
+ fontSize: lineEditFontSize
+ onEditingFinished: root.editingFinished()
}
- LineEdit {
+ LineEditMulti {
id: daemonPort
Layout.fillWidth: true
placeholderText: qsTr("Port") + translationManager.emptyString
@@ -86,10 +90,13 @@ GridLayout {
placeholderFontSize: root.placeholderFontSize
placeholderColor: root.placeholderColor
placeholderOpacity: root.placeholderOpacity
- onEditingFinished: root.editingFinished()
+ labelFontSize: root.labelFontSize
borderColor: lineEditBorderColor
backgroundColor: lineEditBackgroundColor
fontColor: lineEditFontColor
fontBold: lineEditFontBold
+ fontSize: lineEditFontSize
+
+ onEditingFinished: root.editingFinished()
}
}
diff --git a/components/StandardDropdown.qml b/components/StandardDropdown.qml
index 7ff021ed..82f9406a 100644
--- a/components/StandardDropdown.qml
+++ b/components/StandardDropdown.qml
@@ -32,6 +32,7 @@ import "../components" as MoneroComponents
Item {
id: dropdown
+ property int itemTopMargin: 0
property alias dataModel: repeater.model
property string shadowPressedColor
property string shadowReleasedColor
@@ -76,6 +77,7 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
+ anchors.topMargin: parent.itemTopMargin
height: dropdown.dropdownHeight
Rectangle {
diff --git a/components/Style.qml b/components/Style.qml
index 21a27f7c..bf0a5084 100644
--- a/components/Style.qml
+++ b/components/Style.qml
@@ -11,7 +11,6 @@ QtObject {
property string grey: "#404040"
property string defaultFontColor: "white"
- property string greyFontColor: "#808080"
property string dimmedFontColor: "#BBBBBB"
property string inputBoxBackground: "black"
property string inputBoxBackgroundError: "#FFDDDD"
diff --git a/components/WarningBox.qml b/components/WarningBox.qml
new file mode 100644
index 00000000..9ea868eb
--- /dev/null
+++ b/components/WarningBox.qml
@@ -0,0 +1,63 @@
+import QtQuick 2.7
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.0
+
+import "." as MoneroComponents
+
+Rectangle {
+ id: root
+ property alias text: content.text
+ property int fontSize: 15 * scaleRatio
+
+ Layout.fillWidth: true
+ Layout.preferredHeight: warningLayout.height
+
+ color: "#09FFFFFF"
+ radius: 4
+ border.color: MoneroComponents.Style.inputBorderColorInActive
+ border.width: 1
+
+ signal linkActivated;
+
+ RowLayout {
+ id: warningLayout
+ spacing: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Image {
+ Layout.alignment: Qt.AlignVCenter
+ Layout.preferredHeight: 33
+ Layout.preferredWidth: 33
+ Layout.rightMargin: 14
+ Layout.leftMargin: 14
+ Layout.topMargin: 12
+ Layout.bottomMargin: 12
+ source: "../images/warning.png"
+ }
+
+ TextArea {
+ id: content
+ Layout.fillWidth: true
+ color: MoneroComponents.Style.defaultFontColor
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: root.fontSize
+ horizontalAlignment: TextInput.AlignLeft
+ selectByMouse: false
+ textFormat: Text.RichText
+ wrapMode: Text.WordWrap
+ textMargin: 0
+ leftPadding: 0
+ topPadding: 6
+ readOnly: true
+ onLinkActivated: root.linkActivated();
+
+ // @TODO: Legacy. Remove after Qt 5.8.
+ // https://stackoverflow.com/questions/41990013
+ MouseArea {
+ anchors.fill: parent
+ enabled: false
+ }
+ }
+ }
+}