2023-02-14 09:58:57 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import QtQml 2.12
|
2023-04-26 17:04:22 +08:00
|
|
|
import QtQuick 2.12
|
2023-01-03 11:00:52 +08:00
|
|
|
import QtQuick.Layouts 1.12
|
2023-02-13 09:31:11 +08:00
|
|
|
import QtQuick.Controls 2.5
|
2023-02-14 09:58:57 +08:00
|
|
|
|
2023-02-13 09:31:11 +08:00
|
|
|
import org.ukui.menu.core 1.0
|
2023-02-14 09:58:57 +08:00
|
|
|
import org.ukui.menu.utils 1.0
|
2023-06-11 17:23:00 +08:00
|
|
|
import org.ukui.menu.extension 1.0
|
2024-01-04 11:13:41 +08:00
|
|
|
import org.ukui.quick.platform 1.0 as Platform
|
2023-11-28 16:58:37 +08:00
|
|
|
import org.ukui.quick.items 1.0 as UkuiItems
|
2022-12-23 11:32:21 +08:00
|
|
|
|
|
|
|
Item {
|
2023-01-03 11:00:52 +08:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
2023-02-09 16:07:51 +08:00
|
|
|
anchors.topMargin: 12
|
2023-11-28 16:58:37 +08:00
|
|
|
anchors.bottomMargin: 12
|
2023-11-30 14:01:43 +08:00
|
|
|
spacing: 4
|
2023-02-09 16:07:51 +08:00
|
|
|
|
2023-11-29 15:50:17 +08:00
|
|
|
UkuiItems.Button {
|
2023-11-30 14:01:43 +08:00
|
|
|
id: fullScreenButton
|
2023-11-29 15:50:17 +08:00
|
|
|
visible: !isLiteMode
|
2023-06-11 17:23:00 +08:00
|
|
|
|
2023-11-28 16:58:37 +08:00
|
|
|
Layout.preferredWidth: 36
|
|
|
|
Layout.preferredHeight: 36
|
2023-11-30 14:01:43 +08:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2023-06-11 17:23:00 +08:00
|
|
|
|
2024-04-22 15:13:49 +08:00
|
|
|
UkuiItems.Tooltip {
|
|
|
|
anchors.fill: parent
|
|
|
|
mainText: mainWindow.isFullScreen ? qsTr("Contract") : qsTr("Expand")
|
|
|
|
posFollowCursor: true
|
|
|
|
margin: 6
|
2024-03-04 17:42:57 +08:00
|
|
|
}
|
2023-06-29 10:48:27 +08:00
|
|
|
|
2024-01-09 07:31:27 +08:00
|
|
|
onClicked: {
|
|
|
|
if (mainWindow.isFullScreen) {
|
|
|
|
mainWindow.exitFullScreen();
|
|
|
|
} else {
|
|
|
|
mainWindow.isFullScreen = true;
|
|
|
|
}
|
|
|
|
}
|
2023-11-28 16:58:37 +08:00
|
|
|
Keys.onPressed: {
|
|
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
2024-01-09 07:31:27 +08:00
|
|
|
if (mainWindow.isFullScreen) {
|
|
|
|
mainWindow.exitFullScreen();
|
|
|
|
} else {
|
|
|
|
mainWindow.isFullScreen = true;
|
|
|
|
}
|
2023-06-29 10:48:27 +08:00
|
|
|
}
|
2023-01-03 11:00:52 +08:00
|
|
|
}
|
2023-02-09 16:07:51 +08:00
|
|
|
|
2024-01-04 11:13:41 +08:00
|
|
|
background.radius: Platform.Theme.minRadius
|
2024-02-02 15:42:23 +08:00
|
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
2024-01-09 07:31:27 +08:00
|
|
|
icon.source: mainWindow.isFullScreen ? "view-restore-symbolic" : "view-fullscreen-symbolic"
|
2023-02-09 16:07:51 +08:00
|
|
|
}
|
|
|
|
|
2023-11-30 14:01:43 +08:00
|
|
|
Item {
|
|
|
|
id: blankSpace
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
SidebarButtonUtils {
|
|
|
|
id: totalUtils
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UkuiItems.Button {
|
|
|
|
id: userInfoButton
|
|
|
|
|
|
|
|
Layout.preferredWidth: 36
|
|
|
|
Layout.preferredHeight: 36
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
icon.width: 24
|
|
|
|
icon.height: 24
|
|
|
|
|
2024-04-22 15:13:49 +08:00
|
|
|
UkuiItems.Tooltip {
|
|
|
|
anchors.fill: parent
|
|
|
|
mainText: totalUtils.realName
|
|
|
|
posFollowCursor: true
|
|
|
|
margin: 6
|
2024-03-04 17:42:57 +08:00
|
|
|
}
|
2023-11-30 14:01:43 +08:00
|
|
|
|
|
|
|
onClicked: totalUtils.openUserCenter()
|
|
|
|
Keys.onPressed: {
|
|
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
|
|
|
totalUtils.openUserCenter();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-04 11:13:41 +08:00
|
|
|
background.radius: Platform.Theme.minRadius
|
2023-11-30 14:01:43 +08:00
|
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
|
|
icon.source: totalUtils.iconFile
|
|
|
|
}
|
|
|
|
|
|
|
|
UkuiItems.Button {
|
|
|
|
id: computerButton
|
|
|
|
|
|
|
|
Layout.preferredWidth: 36
|
|
|
|
Layout.preferredHeight: 36
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
2024-04-22 15:13:49 +08:00
|
|
|
UkuiItems.Tooltip {
|
|
|
|
anchors.fill: parent
|
|
|
|
mainText: qsTr("Computer")
|
|
|
|
posFollowCursor: true
|
|
|
|
margin: 6
|
2024-03-04 17:42:57 +08:00
|
|
|
}
|
2023-11-30 14:01:43 +08:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
totalUtils.openPeonyComputer();
|
|
|
|
}
|
|
|
|
Keys.onPressed: {
|
|
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
|
|
|
totalUtils.openPeonyComputer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-04 11:13:41 +08:00
|
|
|
background.radius: Platform.Theme.minRadius
|
2023-11-30 14:01:43 +08:00
|
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
|
|
icon.source: "computer-symbolic"
|
|
|
|
}
|
|
|
|
|
|
|
|
UkuiItems.Button {
|
|
|
|
id: setButton
|
|
|
|
|
|
|
|
Layout.preferredWidth: 36
|
|
|
|
Layout.preferredHeight: 36
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
2024-04-22 15:13:49 +08:00
|
|
|
UkuiItems.Tooltip {
|
|
|
|
anchors.fill: parent
|
|
|
|
mainText: qsTr("Control center")
|
|
|
|
posFollowCursor: true
|
|
|
|
margin: 6
|
2024-03-04 17:42:57 +08:00
|
|
|
}
|
2023-11-30 14:01:43 +08:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
totalUtils.openControlCenter();
|
|
|
|
}
|
|
|
|
Keys.onPressed: {
|
|
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
|
|
|
totalUtils.openControlCenter();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-04 11:13:41 +08:00
|
|
|
background.radius: Platform.Theme.minRadius
|
2023-11-30 14:01:43 +08:00
|
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
|
|
icon.source: "applications-system-symbolic"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-11-29 15:50:17 +08:00
|
|
|
UkuiItems.Button {
|
2023-11-28 16:58:37 +08:00
|
|
|
id: powerButton
|
|
|
|
Layout.preferredWidth: 36
|
|
|
|
Layout.preferredHeight: 36
|
2023-11-30 14:01:43 +08:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2023-04-26 17:04:22 +08:00
|
|
|
|
2024-04-22 15:13:49 +08:00
|
|
|
UkuiItems.Tooltip {
|
|
|
|
anchors.fill: parent
|
|
|
|
mainText: powerButtonBase.toolTip
|
|
|
|
posFollowCursor: true
|
|
|
|
margin: 6
|
|
|
|
}
|
2023-01-03 11:00:52 +08:00
|
|
|
|
2023-11-29 15:50:17 +08:00
|
|
|
PowerButton {
|
|
|
|
id: powerButtonBase
|
|
|
|
}
|
|
|
|
|
2023-11-28 16:58:37 +08:00
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
property int spacingFromMenu: 16
|
|
|
|
|
2023-04-26 17:04:22 +08:00
|
|
|
Keys.onPressed: {
|
|
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
2023-11-28 16:58:37 +08:00
|
|
|
powerButtonBase.clicked(true, 0, 0, mainWindow.isFullScreen);
|
2023-04-26 17:04:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-28 16:58:37 +08:00
|
|
|
onClicked: {
|
|
|
|
var buttonPosition = mapToGlobal(width, height);
|
|
|
|
powerButtonBase.clicked(mouse.button === Qt.LeftButton, buttonPosition.x + spacingFromMenu, buttonPosition.y + spacingFromMenu, mainWindow.isFullScreen);
|
2023-01-03 11:00:52 +08:00
|
|
|
}
|
|
|
|
|
2024-01-04 11:13:41 +08:00
|
|
|
background.radius: Platform.Theme.minRadius
|
2023-11-29 15:50:17 +08:00
|
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
|
|
icon.source: powerButtonBase.icon
|
2023-01-03 11:00:52 +08:00
|
|
|
}
|
|
|
|
}
|
2022-12-23 11:32:21 +08:00
|
|
|
}
|