221 lines
6.6 KiB
QML
221 lines
6.6 KiB
QML
/*
|
|
* 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
|
|
import QtQuick 2.12
|
|
import QtQuick.Layouts 1.12
|
|
import QtQuick.Controls 2.5
|
|
|
|
import org.ukui.menu.core 1.0
|
|
import org.ukui.menu.utils 1.0
|
|
import org.ukui.menu.extension 1.0
|
|
import org.ukui.quick.platform 1.0 as Platform
|
|
import org.ukui.quick.items 1.0 as UkuiItems
|
|
|
|
Item {
|
|
ColumnLayout {
|
|
anchors.fill: parent
|
|
anchors.topMargin: 12
|
|
anchors.bottomMargin: 12
|
|
spacing: 4
|
|
|
|
UkuiItems.Button {
|
|
id: fullScreenButton
|
|
visible: !isLiteMode
|
|
|
|
Layout.preferredWidth: 36
|
|
Layout.preferredHeight: 36
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
UkuiItems.ToolTip.text: mainWindow.isFullScreen ? qsTr("Contract") : qsTr("Expand")
|
|
|
|
onEntered: {
|
|
UkuiItems.ToolTip.show(fullScreenButton.mapToGlobal(0, fullScreenButton.height));
|
|
}
|
|
|
|
onExited: {
|
|
UkuiItems.ToolTip.hide();
|
|
}
|
|
|
|
onClicked: {
|
|
UkuiItems.ToolTip.hide();
|
|
if (mainWindow.isFullScreen) {
|
|
mainWindow.exitFullScreen();
|
|
} else {
|
|
mainWindow.isFullScreen = true;
|
|
}
|
|
}
|
|
Keys.onPressed: {
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
|
if (mainWindow.isFullScreen) {
|
|
mainWindow.exitFullScreen();
|
|
} else {
|
|
mainWindow.isFullScreen = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
background.radius: Platform.Theme.minRadius
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
icon.source: mainWindow.isFullScreen ? "view-restore-symbolic" : "view-fullscreen-symbolic"
|
|
}
|
|
|
|
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
|
|
|
|
UkuiItems.ToolTip.text: totalUtils.realName
|
|
|
|
onEntered: {
|
|
UkuiItems.ToolTip.show(userInfoButton.mapToGlobal(0, userInfoButton.height));
|
|
}
|
|
|
|
onExited: {
|
|
UkuiItems.ToolTip.hide();
|
|
}
|
|
|
|
onClicked: totalUtils.openUserCenter()
|
|
Keys.onPressed: {
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
|
totalUtils.openUserCenter();
|
|
}
|
|
}
|
|
|
|
background.radius: Platform.Theme.minRadius
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
icon.source: totalUtils.iconFile
|
|
}
|
|
|
|
UkuiItems.Button {
|
|
id: computerButton
|
|
|
|
Layout.preferredWidth: 36
|
|
Layout.preferredHeight: 36
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
UkuiItems.ToolTip.text: qsTr("Computer")
|
|
|
|
onEntered: {
|
|
UkuiItems.ToolTip.show(computerButton.mapToGlobal(0, computerButton.height));
|
|
}
|
|
|
|
onExited: {
|
|
UkuiItems.ToolTip.hide();
|
|
}
|
|
|
|
onClicked: {
|
|
totalUtils.openPeonyComputer();
|
|
}
|
|
Keys.onPressed: {
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
|
totalUtils.openPeonyComputer();
|
|
}
|
|
}
|
|
|
|
background.radius: Platform.Theme.minRadius
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
icon.source: "computer-symbolic"
|
|
}
|
|
|
|
UkuiItems.Button {
|
|
id: setButton
|
|
|
|
Layout.preferredWidth: 36
|
|
Layout.preferredHeight: 36
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
UkuiItems.ToolTip.text: qsTr("Control center")
|
|
|
|
onEntered: {
|
|
UkuiItems.ToolTip.show(setButton.mapToGlobal(0, setButton.height));
|
|
}
|
|
|
|
onExited: {
|
|
UkuiItems.ToolTip.hide();
|
|
}
|
|
|
|
onClicked: {
|
|
totalUtils.openControlCenter();
|
|
}
|
|
Keys.onPressed: {
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
|
totalUtils.openControlCenter();
|
|
}
|
|
}
|
|
|
|
background.radius: Platform.Theme.minRadius
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
icon.source: "applications-system-symbolic"
|
|
}
|
|
|
|
|
|
UkuiItems.Button {
|
|
id: powerButton
|
|
Layout.preferredWidth: 36
|
|
Layout.preferredHeight: 36
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
UkuiItems.ToolTip.text: powerButtonBase.toolTip
|
|
|
|
PowerButton {
|
|
id: powerButtonBase
|
|
}
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
property int spacingFromMenu: 16
|
|
|
|
Keys.onPressed: {
|
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
|
powerButtonBase.clicked(true, 0, 0, mainWindow.isFullScreen);
|
|
}
|
|
}
|
|
|
|
onEntered: {
|
|
UkuiItems.ToolTip.show(powerButton.mapToGlobal(0, powerButton.height));
|
|
}
|
|
|
|
onExited: {
|
|
UkuiItems.ToolTip.hide();
|
|
}
|
|
|
|
onClicked: {
|
|
var buttonPosition = mapToGlobal(width, height);
|
|
powerButtonBase.clicked(mouse.button === Qt.LeftButton, buttonPosition.x + spacingFromMenu, buttonPosition.y + spacingFromMenu, mainWindow.isFullScreen);
|
|
}
|
|
|
|
background.radius: Platform.Theme.minRadius
|
|
icon.mode: UkuiItems.Icon.AutoHighlight
|
|
icon.source: powerButtonBase.icon
|
|
}
|
|
}
|
|
}
|