Move tray code to a reasonable place

- Move required properties to top
- Do not use concatenation on qsTr, use .arg()
This commit is contained in:
vslg 2020-09-08 08:35:08 -03:00
parent ae9f88cae5
commit 67012d6334
2 changed files with 7 additions and 6 deletions

View File

@ -1,13 +1,14 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick.Controls 2.12
import Qt.labs.platform 1.1
import Qt.labs.folderlistmodel 2.12
SystemTrayIcon {
property string iconPack: theme ? theme.icons.preferredPack : "thin"
property ApplicationWindow window
property alias settingsFolder: showUpWatcher.folder
property var window
property string iconPack: theme ? theme.icons.preferredPack : "thin"
property FolderListModel showUpWatcher: FolderListModel {
id: showUpWatcher
@ -28,7 +29,7 @@ SystemTrayIcon {
visible: true
tooltip: Qt.application.displayName
icon.source: `../../icons/${iconPack}/tray-icon.png`
icon.source: `../icons/${iconPack}/tray-icon.png`
onActivated: {
if (reason === SystemTrayIcon.MiddleClick)
@ -42,7 +43,7 @@ SystemTrayIcon {
text:
window.visible ?
"Minimize to tray" :
qsTr("Open ") + Qt.application.displayName
qsTr("Open %1").arg(Qt.application.displayName)
onTriggered:
window.visible ?
window.hide() :
@ -50,7 +51,7 @@ SystemTrayIcon {
}
MenuItem {
text: qsTr("Quit ") + Qt.application.displayName
text: qsTr("Quit %1").arg(Qt.application.displayName)
onTriggered: Qt.quit()
}
}

View File

@ -112,7 +112,7 @@ ApplicationWindow {
Behavior on scale { HNumberAnimation { overshoot: 3; factor: 1.2 } }
}
HTrayIcon {
TrayIcon {
window: window
settingsFolder: window.settingsFolder
}