2022-05-10 20:10:34 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
|
|
|
import Qt.labs.platform
|
|
|
|
|
|
|
|
import Status.Assets
|
|
|
|
|
|
|
|
SystemTrayIcon {
|
|
|
|
id: root
|
2023-11-01 15:07:00 +00:00
|
|
|
|
|
|
|
objectName: "systemTrayIcon"
|
2022-05-10 20:10:34 +00:00
|
|
|
|
|
|
|
property bool production: true
|
|
|
|
|
|
|
|
signal showApplication()
|
|
|
|
|
|
|
|
visible: true
|
|
|
|
icon.source: {
|
|
|
|
if (production)
|
2024-05-07 21:11:20 +00:00
|
|
|
return Qt.platform.os === "osx" ? Resources.png("status-logo-icon") : Resources.png("status-logo")
|
2022-05-10 20:10:34 +00:00
|
|
|
else
|
|
|
|
return Resources.svg("status-logo-dark")
|
|
|
|
}
|
|
|
|
icon.mask: false
|
|
|
|
|
|
|
|
menu: Menu {
|
|
|
|
MenuItem {
|
2023-11-01 15:07:00 +00:00
|
|
|
objectName: "openTrayMenuItem"
|
|
|
|
|
2022-05-10 20:10:34 +00:00
|
|
|
text: qsTr("Open Status")
|
|
|
|
onTriggered: root.showApplication()
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuSeparator {
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
2023-11-01 15:07:00 +00:00
|
|
|
objectName: "quitTrayMenuItem"
|
|
|
|
|
2022-05-10 20:10:34 +00:00
|
|
|
text: qsTr("Quit")
|
|
|
|
onTriggered: Qt.quit()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onActivated: function (reason) {
|
|
|
|
if (reason !== SystemTrayIcon.Context && Qt.platform.os !== "osx")
|
|
|
|
root.showApplication()
|
|
|
|
}
|
|
|
|
}
|