-
Notifications
You must be signed in to change notification settings - Fork 0
/
SysTray.qml
41 lines (37 loc) · 1.24 KB
/
SysTray.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import QtQuick 2.14
import Qt.labs.platform 1.1
import com.tekit.powerpad.controllerthread 1.0
import com.tekit.powerpad.helper 1.0
SystemTrayIcon
{
tooltip: {
if (!ControllerThread.stateIsEnabled(ControllerThread.state))
qsTr("PowerPAD (Disabled)")
else if (ControllerThread.connectedCount > 0)
qsTr("PowerPAD (Connected)")
else
qsTr("PowerPAD");
}
visible: true
icon.mask: true
icon.source: {
if (ControllerThread.stateIsEnabled(ControllerThread.state))
"images/icon.svg"
else
"images/icon_disabled.svg"
}
menu: contextMenu
onActivated: {
// prevent calling this code too fast if main window has just been hidden
if (timerReenterSysTray.running)
return
if (!applicationWindow.visible) // window is minimized to tray => show it
{
if (reason !== SystemTrayIcon.Context)
applicationWindow.showApp(geometry)
} else if (!applicationWindow.active) { // window is visible but not active
// (can happen if options dialog window is activated) => hide it
applicationWindow.hideApp()
}
}
}