aboutsummaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/DaemonConsole.qml186
-rw-r--r--components/NewPasswordDialog.qml8
-rw-r--r--components/PasswordDialog.qml10
-rw-r--r--components/TitleBar.qml98
4 files changed, 201 insertions, 101 deletions
diff --git a/components/DaemonConsole.qml b/components/DaemonConsole.qml
index 2643a339..225b2dba 100644
--- a/components/DaemonConsole.qml
+++ b/components/DaemonConsole.qml
@@ -27,22 +27,23 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.0
-import QtQuick.Controls 1.4
+import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.4
-import QtQuick.Window 2.0
+import QtQuick.Window 2.2
import "../components" as MoneroComponents
+import "../js/Windows.js" as Windows
+import "../js/Utils.js" as Utils
Window {
id: root
modality: Qt.ApplicationModal
- flags: Qt.Window | Qt.FramelessWindowHint
- property alias title: dialogTitle.text
+ color: "black"
+ flags: Windows.flags
property alias text: dialogContent.text
property alias content: root.text
- property alias okVisible: okButton.visible
property alias textArea: dialogContent
property var icon
@@ -50,15 +51,25 @@ Window {
signal accepted()
signal rejected()
+ onClosing: {
+ inactiveOverlay.visible = false;
+ }
function open() {
- show()
+ inactiveOverlay.visible = true;
+ show();
}
// TODO: implement without hardcoding sizes
width: 480
height: 280
+ // background gradient
+ Image {
+ anchors.fill: parent
+ source: "../images/middlePanelBg.jpg"
+ }
+
// Make window draggable
MouseArea {
anchors.fill: parent
@@ -70,79 +81,136 @@ Window {
ColumnLayout {
id: mainLayout
- spacing: 10
- anchors { fill: parent; margins: 35 }
+
+ anchors.fill: parent
+ anchors.topMargin: 20 * scaleRatio
+ anchors.margins: 35 * scaleRatio
+ spacing: 20 * scaleRatio
RowLayout {
- id: column
- //anchors {fill: parent; margins: 16 }
- Layout.alignment: Qt.AlignHCenter
+ id: content
+ Layout.fillWidth: true
+ Layout.fillHeight: true
- Label {
- id: dialogTitle
- horizontalAlignment: Text.AlignHCenter
- font.pixelSize: 32
- font.family: "Arial"
- color: "#555555"
- }
+ Flickable {
+ id: flickable
+ anchors.fill: parent
- }
+ TextArea.flickable: TextArea {
+ id : dialogContent
+ textFormat: TextEdit.RichText
+ selectByMouse: true
+ selectByKeyboard: true
+ anchors.fill: parent
+ font.family: "Ariel"
+ font.pixelSize: 14 * scaleRatio
+ color: MoneroComponents.Style.defaultFontColor
+ selectionColor: MoneroComponents.Style.dimmedFontColor
+ wrapMode: TextEdit.Wrap
+ readOnly: true
+ background: Rectangle {
+ color: "transparent"
+ anchors.fill: parent
+ border.color: Qt.rgba(255, 255, 255, 0.25);
+ border.width: 1
+ radius: 4
+ }
+ function logCommand(msg){
+ msg = log_color(msg, "lime");
+ textArea.append(msg);
+ }
+ function logMessage(msg){
+ msg = msg.trim();
+ var color = "white";
+ if(msg.toLowerCase().indexOf('error') >= 0){
+ color = "red";
+ } else if (msg.toLowerCase().indexOf('warning') >= 0){
+ color = "yellow";
+ }
- RowLayout {
- TextArea {
- id : dialogContent
- Layout.fillWidth: true
- Layout.fillHeight: true
- font.family: "Arial"
- textFormat: TextEdit.AutoText
- readOnly: true
- font.pixelSize: 12
- }
- }
+ // format multi-lines
+ if(msg.split("\n").length >= 2){
+ msg = msg.split("\n").join('<br>');
+ }
- // Ok/Cancel buttons
- RowLayout {
- id: buttons
- spacing: 60
- Layout.alignment: Qt.AlignHCenter
+ log(msg, color);
+ }
+ function log_color(msg, color){
+ return "<span style='color: " + color + ";' >" + msg + "</span>";
+ }
+ function log(msg, color){
+ var timestamp = Utils.formatDate(new Date(), {
+ weekday: undefined,
+ month: "numeric",
+ timeZoneName: undefined
+ });
+
+ var _timestamp = log_color("[" + timestamp + "]", "#FFFFFF");
+ var _msg = log_color(msg, color);
+ textArea.append(_timestamp + " " + _msg);
- MoneroComponents.StandardButton {
- id: okButton
- width: 120
- fontSize: 14
- text: qsTr("Close") + translationManager.emptyString
- onClicked: {
- root.close()
- root.accepted()
+ // scroll to bottom
+ if(flickable.contentHeight > content.height){
+ flickable.contentY = flickable.contentHeight + 20;
+ }
+ }
+ }
+ ScrollBar.vertical: ScrollBar {
+ // TODO: scrollbar always visible is buggy.
+ // QT 5.9 introduces `policy: ScrollBar.AlwaysOn`
+ contentItem.opacity: 1
+ anchors.top: flickable.top
+ anchors.left: flickable.right
+ anchors.leftMargin: 10 * scaleRatio
+ anchors.bottom: flickable.bottom
}
}
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
MoneroComponents.LineEdit {
id: sendCommandText
- width: 300
+ Layout.fillWidth: true
placeholderText: qsTr("command + enter (e.g help)") + translationManager.emptyString
onAccepted: {
- if(text.length > 0)
- daemonManager.sendCommand(text,currentWallet.nettype);
+ if(text.length > 0) {
+ textArea.logCommand(">>> " + text)
+ daemonManager.sendCommand(text, currentWallet.nettype);
+ }
text = ""
}
}
-
- // Status button
-// MoneroComponents.StandardButton {
-// id: sendCommandButton
-// enabled: sendCommandText.text.length > 0
-// fontSize: 14
-// text: qsTr("Send command")
-// onClicked: {
-// daemonManager.sendCommand(sendCommandText.text,currentWallet.testnet);
-// }
-// }
}
}
-}
-
+ // window borders
+ Rectangle {
+ anchors.bottom: parent.bottom
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width:1
+ color: "#2F2F2F"
+ z: 2
+ }
+ Rectangle {
+ anchors.bottom: parent.bottom
+ anchors.top: parent.top
+ anchors.right: parent.right
+ width:1
+ color: "#2F2F2F"
+ z: 2
+ }
+ Rectangle {
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.left: parent.left
+ height:1
+ color: "#2F2F2F"
+ z: 2
+ }
+} \ No newline at end of file
diff --git a/components/NewPasswordDialog.qml b/components/NewPasswordDialog.qml
index d83364de..d94b5407 100644
--- a/components/NewPasswordDialog.qml
+++ b/components/NewPasswordDialog.qml
@@ -38,13 +38,7 @@ import "../components" as MoneroComponents
Item {
id: root
visible: false
- Rectangle {
- id: bg
- z: parent.z + 1
- anchors.fill: parent
- color: "black"
- opacity: 0.8
- }
+ z: parent.z + 2
property alias password: passwordInput1.text
diff --git a/components/PasswordDialog.qml b/components/PasswordDialog.qml
index 1f75f461..1534e1f3 100644
--- a/components/PasswordDialog.qml
+++ b/components/PasswordDialog.qml
@@ -38,6 +38,7 @@ import "../components" as MoneroComponents
Item {
id: root
visible: false
+ z: parent.z + 2
property alias password: passwordInput.text
property string walletName
@@ -48,6 +49,7 @@ Item {
signal closeCallback()
function open(walletName) {
+ inactiveOverlay.visible = true // draw appwindow inactive
root.walletName = walletName ? walletName : ""
leftPanel.enabled = false
middlePanel.enabled = false
@@ -59,6 +61,7 @@ Item {
}
function close() {
+ inactiveOverlay.visible = false
leftPanel.enabled = true
middlePanel.enabled = true
titleBar.enabled = true
@@ -166,11 +169,4 @@ Item {
}
}
- Rectangle {
- id: bg
-
- anchors.fill: parent
- color: "black"
- opacity: 0.8
- }
}
diff --git a/components/TitleBar.qml b/components/TitleBar.qml
index 3fd9a8a0..166e2be9 100644
--- a/components/TitleBar.qml
+++ b/components/TitleBar.qml
@@ -33,39 +33,55 @@ import QtQuick.Layouts 1.1
Rectangle {
id: titleBar
+ height: {
+ if(!customDecorations || isMobile){
+ return 0;
+ }
+
+ if(small) return 38 * scaleRatio;
+ else return 50 * scaleRatio;
+ }
+ y: -height
+ z: 1
+
+ property string title
property int mouseX: 0
property bool containsMouse: false
property alias basicButtonVisible: goToBasicVersionButton.visible
- property bool customDecorations: true
+ property bool customDecorations: persistentSettings.customDecorations
+ property bool showWhatIsButton: true
+ property bool showMinimizeButton: false
+ property bool showMaximizeButton: false
+ property bool showCloseButton: true
+ property bool showMoneroLogo: false
+ property bool small: false
+
+ signal closeClicked
+ signal maximizeClicked
+ signal minimizeClicked
signal goToBasicVersion(bool yes)
- height: customDecorations && !isMobile ? 50 : 0
- y: -height
- property string title
- property alias maximizeButtonVisible: maximizeButton.visible
- z: 1
Item {
- id: test
+ // Background gradient
width: parent.width
- height: 50
- z: 1
+ height: s
+ z: parent.z + 1
- // use jpg for gradiency
Image {
- anchors.fill: parent
- height: parent.height
- width: parent.width
+ anchors.fill: titleBar
+ height: titleBar.height
+ width: titleBar.width
source: "../images/titlebarGradient.jpg"
}
}
- Item{
+ Item {
id: titlebarlogo
width: 125
- height: 50
+ height: parent.height
anchors.centerIn: parent
- visible: customDecorations
- z: 1
+ visible: customDecorations && showMoneroLogo
+ z: parent.z + 1
Image {
anchors.left: parent.left
@@ -77,6 +93,15 @@ Rectangle {
}
}
+ Label {
+ id: titleLabel
+ visible: !showMoneroLogo && customDecorations && titleBar.title !== ''
+ anchors.centerIn: parent
+ fontSize: 18
+ text: titleBar.title
+ z: parent.z + 1
+ }
+
// collapse left panel
Rectangle {
id: goToBasicVersionButton
@@ -85,10 +110,10 @@ Rectangle {
anchors.top: parent.top
anchors.left: parent.left
color: "transparent"
- height: 50 * scaleRatio
+ height: titleBar.height
width: height
visible: isMobile
- z: 2
+ z: parent.z + 2
Image {
width: 14
@@ -118,10 +143,11 @@ Rectangle {
anchors.top: parent.top
anchors.bottom: parent.bottom
visible: parent.customDecorations
- z: 2
+ z: parent.z + 2
Rectangle {
id: minimizeButton
+ visible: showMinimizeButton
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 42
@@ -139,14 +165,13 @@ Rectangle {
cursorShape: Qt.PointingHandCursor
onEntered: minimizeButton.color = "#262626";
onExited: minimizeButton.color = "transparent";
- onClicked: {
- appWindow.visibility = Window.Minimized
- }
+ onClicked: minimizeClicked();
}
}
Rectangle {
id: maximizeButton
+ visible: showMaximizeButton
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 42
@@ -167,15 +192,13 @@ Rectangle {
cursorShape: Qt.PointingHandCursor
onEntered: maximizeButton.color = "#262626";
onExited: maximizeButton.color = "transparent";
- onClicked: {
- appWindow.visibility = appWindow.visibility !== Window.FullScreen ? Window.FullScreen :
- Window.Windowed
- }
+ onClicked: maximizeClicked();
}
}
Rectangle {
id: closeButton
+ visible: showCloseButton
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 42
@@ -190,7 +213,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
- onClicked: appWindow.close();
+ onClicked: closeClicked();
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: closeButton.color = "#262626";
@@ -199,4 +222,23 @@ Rectangle {
}
}
+ // window borders
+ Rectangle {
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.left: parent.left
+ height: 1
+ color: "#2F2F2F"
+ z: parent.z + 1
+ }
+
+ Rectangle {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.left: parent.left
+ visible: titleBar.small
+ height: 1
+ color: "#2F2F2F"
+ z: parent.z + 1
+ }
}