status-desktop/ui/imports/shared/MacTrafficLights.qml

111 lines
3.4 KiB
QML
Raw Normal View History

import QtQuick 2.15
import QtQuick.Window 2.15
import utils 1.0
2021-05-19 18:31:18 +00:00
MouseArea {
id: root
2021-05-19 18:31:18 +00:00
2021-06-03 08:29:14 +00:00
signal close()
signal minimised()
signal maximized()
2021-05-19 18:31:18 +00:00
hoverEnabled: true
width: layout.implicitWidth
height: layout.implicitHeight
readonly property color inactive: Style.current.name === Constants.lightThemeName ? "#10000000"
: "#10FFFFFF"
readonly property color inactiveBorder: Style.current.name === Constants.lightThemeName ? "#10000000"
: "#10FFFFFF"
QtObject {
id: d
readonly property bool windowActive: root.Window.window.active
}
2021-05-19 18:31:18 +00:00
Row {
id: layout
spacing: 8
Rectangle {
width: 12
height: 12
radius: width / 2
antialiasing: true
color: closeSensor.pressed ? "#B24F47" : (d.windowActive || root.containsMouse ? Qt.lighter("#E9685C", 1.07) : inactive)
border.color:closeSensor.pressed ? "#943229" : (d.windowActive ? "#D14C40" : inactiveBorder)
2021-05-19 18:31:18 +00:00
border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0
Image {
anchors.centerIn: parent
visible: root.containsMouse
source: Style.png("traffic_lights/" + (closeSensor.pressed ? "close_pressed" : "close"))
2021-05-19 18:31:18 +00:00
scale: 0.25
}
MouseArea {
id: closeSensor
anchors.fill: parent
onClicked: root.close()
2021-05-19 18:31:18 +00:00
}
}
Rectangle {
width: 12
height: 12
radius: width / 2
antialiasing: true
color: miniSensor.pressed ? "#878E3B" : (d.windowActive || root.containsMouse ? Qt.lighter("#EDB84C", 1.07) : inactive)
border.color:miniSensor.pressed ? "#986E29" : (d.windowActive ? "#D79F3D" : inactiveBorder)
2021-05-19 18:31:18 +00:00
border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0
Image {
anchors.centerIn: parent
anchors.verticalCenterOffset: -0.25
visible: root.containsMouse
source: Style.png("traffic_lights/" + (miniSensor.pressed ? "minimise_pressed" : "minimise"))
2021-05-19 18:31:18 +00:00
scale: 0.27
}
MouseArea {
id: miniSensor
anchors.fill: parent
onClicked: root.minimised()
2021-05-19 18:31:18 +00:00
}
}
Rectangle {
width: 12
height: 12
radius: width / 2
antialiasing: true
color: maxiSensor.pressed ? "#48943f" : (d.windowActive || root.containsMouse ? Qt.lighter("#62C454", 1.06) : inactive)
border.color: maxiSensor.pressed ? "#357225" : (d.windowActive ? "#53A73E" : inactiveBorder)
2021-05-19 18:31:18 +00:00
border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0
Image {
anchors.centerIn: parent
visible: root.containsMouse
source: Style.png("traffic_lights/" + (maxiSensor.pressed ? "maximize_pressed" : "maximize"))
2021-05-19 18:31:18 +00:00
scale: 0.25
}
MouseArea {
id: maxiSensor
anchors.fill: parent
onClicked: root.maximized()
2021-05-19 18:31:18 +00:00
}
}
}
}