aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-12-20 17:49:35 +0200
committerRiccardo Spagni <ric@spagni.net>2016-12-20 17:49:35 +0200
commit0526aff950c44de053738d4cb1b992181659941d (patch)
treef2df598b8573c80a2cbc19127f018349225b77f0
parent55f4858a40948da244b1b5c48799d35f69f7a4a3 (diff)
parent2a7f1605348cfeca6def8e0f336d174bd7c13eb1 (diff)
downloadmonzero-gui-0526aff950c44de053738d4cb1b992181659941d.tar.gz
monzero-gui-0526aff950c44de053738d4cb1b992181659941d.tar.xz
monzero-gui-0526aff950c44de053738d4cb1b992181659941d.zip
Merge pull request #260
2a7f160 Settings hide/show window after changing decorations type (moneromooo.monero) 456bf04 Settings: add user option to toggle custom decorations (moneromooo.monero) eff8bde Make the custom decorations optional (moneromooo.monero)
-rw-r--r--MiddlePanel.qml4
-rw-r--r--components/TitleBar.qml119
-rw-r--r--main.qml60
-rw-r--r--pages/Settings.qml11
4 files changed, 185 insertions, 9 deletions
diff --git a/MiddlePanel.qml b/MiddlePanel.qml
index 6f6e3043..b21da0c0 100644
--- a/MiddlePanel.qml
+++ b/MiddlePanel.qml
@@ -166,7 +166,7 @@ Rectangle {
ColumnLayout {
anchors.fill: parent
anchors.margins: 2
- anchors.topMargin: 0
+ anchors.topMargin: appWindow.persistentSettings.customDecorations ? 30 : 0
spacing: 0
@@ -185,7 +185,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -5
anchors.left: parent.left
- anchors.leftMargin: 40
+ anchors.leftMargin: appWindow.persistentSettings.customDecorations ? 20 : 40
source: "images/moneroLogo2.png"
}
diff --git a/components/TitleBar.qml b/components/TitleBar.qml
index 4279c792..aa793985 100644
--- a/components/TitleBar.qml
+++ b/components/TitleBar.qml
@@ -35,19 +35,36 @@ Rectangle {
property int mouseX: 0
property bool containsMouse: false
property alias basicButtonVisible: goToBasicVersionButton.visible
+ property bool customDecorations: true
signal goToBasicVersion(bool yes)
+ height: customDecorations ? 30 : 0
+ y: -height
+ property string title
+ property alias maximizeButtonVisible: maximizeButton.visible
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 15
+ font.letterSpacing: -1
+ color: "#FFFFFF"
+ text: titleBar.title
+ visible: customDecorations
+ }
+
+ Behavior on y {
+ NumberAnimation { duration: 100; easing.type: Easing.InQuad }
+ }
Rectangle {
id: goToBasicVersionButton
property bool containsMouse: titleBar.mouseX >= x && titleBar.mouseX <= x + width
property bool checked: false
anchors.top: parent.top
- anchors.bottom: parent.bottom
anchors.left: parent.left
- anchors.right: parent.right
color: containsMouse || checked ? "#FFE00A" : "#000000"
- width: parent.width
- height: parent.height
+ height: 30
+ width: height
Image {
anchors.centerIn: parent
@@ -64,4 +81,98 @@ Rectangle {
}
}
}
+
+ Row {
+ id: row
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ visible: parent.customDecorations
+
+ Rectangle {
+ property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ width: height
+ color: containsMouse ? "#6B0072" : "#000000"
+
+ Image {
+ anchors.centerIn: parent
+ source: "../images/helpIcon.png"
+ }
+
+ MouseArea {
+ id: whatIsArea
+ anchors.fill: parent
+ onClicked: {
+
+ }
+ }
+ }
+
+ Rectangle {
+ property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ width: height
+ color: containsMouse ? "#3665B3" : "#000000"
+
+ Image {
+ anchors.centerIn: parent
+ source: "../images/minimizeIcon.png"
+ }
+
+ MouseArea {
+ id: minimizeArea
+ anchors.fill: parent
+ onClicked: {
+ appWindow.visibility = Window.Minimized
+ }
+ }
+ }
+
+ Rectangle {
+ id: maximizeButton
+ property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ width: height
+ color: containsMouse ? "#FF6C3C" : "#000000"
+
+ Image {
+ anchors.centerIn: parent
+ source: appWindow.visibility === Window.FullScreen ? "../images/backToWindowIcon.png" :
+ "../images/maximizeIcon.png"
+
+ }
+
+ MouseArea {
+ id: maximizeArea
+ anchors.fill: parent
+ onClicked: {
+ appWindow.visibility = appWindow.visibility !== Window.FullScreen ? Window.FullScreen :
+ Window.Windowed
+ }
+ }
+ }
+
+ Rectangle {
+ property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ width: height
+ color: containsMouse ? "#E04343" : "#000000"
+
+ Image {
+ anchors.centerIn: parent
+ source: "../images/closeIcon.png"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: appWindow.close();
+ }
+ }
+ }
+
}
diff --git a/main.qml b/main.qml
index 0bbe4be3..39826ab8 100644
--- a/main.qml
+++ b/main.qml
@@ -625,9 +625,26 @@ ApplicationWindow {
width: rightPanelExpanded ? 1269 : 1269 - 300
height: maxWindowHeight;
color: "#FFFFFF"
- flags: Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowMaximizeButtonHint
+ flags: persistentSettings.customDecorations ? (Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint) : (Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowMaximizeButtonHint)
onWidthChanged: x -= 0
+ function setCustomWindowDecorations(custom) {
+ var x = appWindow.x
+ var y = appWindow.y
+ if (x < 0)
+ x = 0
+ if (y < 0)
+ y = 0
+ persistentSettings.customDecorations = custom
+ if (custom)
+ appWindow.flags = Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint
+ else
+ appWindow.flags = Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowMaximizeButtonHint
+ appWindow.hide()
+ appWindow.x = x
+ appWindow.y = y
+ appWindow.show()
+ }
Component.onCompleted: {
x = (Screen.width - width) / 2
@@ -669,6 +686,7 @@ ApplicationWindow {
property string payment_id
property int restore_height : 0
property bool is_recovering : false
+ property bool customDecorations : true
}
// Information dialog
@@ -757,8 +775,11 @@ ApplicationWindow {
PropertyChanges { target: appWindow; width: 930; }
PropertyChanges { target: appWindow; height: 595; }
PropertyChanges { target: resizeArea; visible: false }
+ PropertyChanges { target: titleBar; maximizeButtonVisible: false }
PropertyChanges { target: frameArea; blocked: true }
PropertyChanges { target: titleBar; visible: false }
+ PropertyChanges { target: titleBar; y: 0 }
+ PropertyChanges { target: titleBar; title: qsTr("Program setup wizard") + translationManager.emptyString }
}, State {
name: "normal"
PropertyChanges { target: leftPanel; visible: true }
@@ -769,8 +790,11 @@ ApplicationWindow {
PropertyChanges { target: appWindow; width: rightPanelExpanded ? 1269 : 1269 - 300; }
PropertyChanges { target: appWindow; height: maxWindowHeight; }
PropertyChanges { target: resizeArea; visible: true }
+ PropertyChanges { target: titleBar; maximizeButtonVisible: true }
PropertyChanges { target: frameArea; blocked: false }
PropertyChanges { target: titleBar; visible: true }
+ PropertyChanges { target: titleBar; y: 0 }
+ PropertyChanges { target: titleBar; title: qsTr("Monero") + translationManager.emptyString }
}
]
@@ -839,6 +863,11 @@ ApplicationWindow {
value: Window.Windowed
}
PropertyAction {
+ target: titleBar
+ properties: "maximizeButtonVisible"
+ value: false
+ }
+ PropertyAction {
target: frameArea
properties: "blocked"
value: true
@@ -926,6 +955,11 @@ ApplicationWindow {
properties: "blocked"
value: false
}
+ PropertyAction {
+ target: titleBar
+ properties: "maximizeButtonVisible"
+ value: true
+ }
}
WizardMain {
@@ -988,10 +1022,11 @@ ApplicationWindow {
TitleBar {
id: titleBar
+ anchors.left: parent.left
+ anchors.right: parent.right
x: 0
y: 0
- width: 30
- height: 30
+ customDecorations: persistentSettings.customDecorations
onGoToBasicVersion: {
if (yes) {
// basicPanel.currentView = middlePanel.currentView
@@ -1001,6 +1036,25 @@ ApplicationWindow {
goToProAnimation.start()
}
}
+
+ MouseArea {
+ enabled: persistentSettings.customDecorations
+ property var previousPosition
+ anchors.fill: parent
+ propagateComposedEvents: true
+ onPressed: previousPosition = globalCursor.getPosition()
+ onPositionChanged: {
+ if (pressedButtons == Qt.LeftButton) {
+ var pos = globalCursor.getPosition()
+ var dx = pos.x - previousPosition.x
+ var dy = pos.y - previousPosition.y
+
+ appWindow.x += dx
+ appWindow.y += dy
+ previousPosition = pos
+ }
+ }
+ }
}
// new ToolTip
diff --git a/pages/Settings.qml b/pages/Settings.qml
index 9d296d35..649242d6 100644
--- a/pages/Settings.qml
+++ b/pages/Settings.qml
@@ -334,6 +334,17 @@ Rectangle {
}
+ RowLayout {
+ CheckBox {
+ id: customDecorationsCheckBox
+ checked: persistentSettings.customDecorations
+ onClicked: appWindow.setCustomWindowDecorations(checked)
+ text: qsTr("Custom decorations") + translationManager.emptyString
+ checkedIcon: "../images/checkedVioletIcon.png"
+ uncheckedIcon: "../images/uncheckedIcon.png"
+ }
+ }
+
}
// Daemon console