2023-03-17 17:25:50 +08:00
|
|
|
|
/*
|
2023-02-08 10:58:51 +08:00
|
|
|
|
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
2023-01-03 11:00:52 +08:00
|
|
|
|
*
|
|
|
|
|
* 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/>.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2022-12-02 15:58:09 +08:00
|
|
|
|
import QtQuick 2.12
|
2022-12-23 11:32:21 +08:00
|
|
|
|
import AppUI 1.0 as AppUI
|
2023-03-17 17:25:50 +08:00
|
|
|
|
import AppControls2 1.0 as AppControls2
|
|
|
|
|
import org.ukui.menu.core 1.0
|
2024-01-18 03:24:01 +08:00
|
|
|
|
import org.ukui.quick.items 1.0 as UkuiItems
|
2024-02-02 15:42:23 +08:00
|
|
|
|
import org.ukui.quick.platform 1.0 as Platform
|
2022-12-23 11:08:16 +08:00
|
|
|
|
|
2023-02-08 10:58:51 +08:00
|
|
|
|
Item {
|
2023-03-17 17:25:50 +08:00
|
|
|
|
id: root
|
|
|
|
|
clip: true
|
2023-03-20 15:33:32 +08:00
|
|
|
|
property int animationDuration: menuSetting.get("animationDuration")
|
2024-03-04 17:42:57 +08:00
|
|
|
|
property var normalGeometry: mainWindow.normalRect
|
2023-03-17 17:25:50 +08:00
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2023-03-20 15:33:32 +08:00
|
|
|
|
mainWindow.fullScreenChanged.connect(enterFullScreen);
|
|
|
|
|
mainWindow.beforeFullScreenExited.connect(exitFullScreen);
|
|
|
|
|
menuSetting.changed.connect(updateAnimationDuration);
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-20 15:33:32 +08:00
|
|
|
|
function enterFullScreen() {
|
|
|
|
|
if (mainWindow.isFullScreen) {
|
|
|
|
|
normalHide.start();
|
|
|
|
|
fullShow.start();
|
2023-04-03 17:15:32 +08:00
|
|
|
|
enterFullScreenAnimation.start();
|
2023-03-20 15:33:32 +08:00
|
|
|
|
}
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-20 15:33:32 +08:00
|
|
|
|
function exitFullScreen() {
|
|
|
|
|
normalShow.start();
|
|
|
|
|
fullHide.start();
|
2023-04-03 17:15:32 +08:00
|
|
|
|
exitFullScreenAnimation.start();
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-20 15:33:32 +08:00
|
|
|
|
function updateAnimationDuration(key) {
|
|
|
|
|
if (key === "animationDuration") {
|
|
|
|
|
root.animationDuration = menuSetting.get("animationDuration");
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-17 17:25:50 +08:00
|
|
|
|
|
2024-01-18 03:24:01 +08:00
|
|
|
|
UkuiItems.StyleBackground {
|
2023-03-17 17:25:50 +08:00
|
|
|
|
id: backgroundMask
|
2023-04-03 17:15:32 +08:00
|
|
|
|
// 初始状态默认为normalScreen
|
2024-03-07 15:04:03 +08:00
|
|
|
|
x: mainWindow.isFullScreen ? 0 : normalGeometry.x
|
|
|
|
|
y: mainWindow.isFullScreen ? 0 : normalGeometry.y
|
|
|
|
|
height: mainWindow.isFullScreen ? root.height : normalGeometry.height
|
|
|
|
|
width: mainWindow.isFullScreen ? root.width : normalGeometry.width
|
2024-03-04 17:42:57 +08:00
|
|
|
|
radius: mainWindow.isFullScreen ? 0 : Platform.Theme.windowRadius
|
2023-03-17 17:25:50 +08:00
|
|
|
|
|
2024-03-07 20:29:07 +08:00
|
|
|
|
border.width: mainWindow.isFullScreen ? 0 : 1
|
2024-03-04 17:42:57 +08:00
|
|
|
|
borderColor: Platform.Theme.Text
|
|
|
|
|
borderAlpha: 0.15
|
2023-03-20 15:33:32 +08:00
|
|
|
|
|
2024-03-04 17:42:57 +08:00
|
|
|
|
Component.onCompleted: mainWindow.changeWindowBlurRegion(x, y, width, height, radius)
|
|
|
|
|
onRadiusChanged: mainWindow.changeWindowBlurRegion(x, y, width, height, radius)
|
|
|
|
|
onWidthChanged: mainWindow.changeWindowBlurRegion(x, y, width, height, radius)
|
2024-04-07 09:38:21 +08:00
|
|
|
|
onHeightChanged: mainWindow.changeWindowBlurRegion(x, y, width, height, radius)
|
2023-03-17 17:25:50 +08:00
|
|
|
|
|
2023-04-03 17:15:32 +08:00
|
|
|
|
ParallelAnimation {
|
|
|
|
|
id: enterFullScreenAnimation
|
|
|
|
|
PropertyAnimation {
|
|
|
|
|
target: backgroundMask; property: "x"
|
2024-03-04 17:42:57 +08:00
|
|
|
|
from: normalGeometry.x; to: 0
|
2023-04-03 17:15:32 +08:00
|
|
|
|
duration: root.animationDuration; easing.type: Easing.InOutQuad
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
2023-04-03 17:15:32 +08:00
|
|
|
|
PropertyAnimation {
|
|
|
|
|
target: backgroundMask; property: "y"
|
2024-03-04 17:42:57 +08:00
|
|
|
|
from: normalGeometry.y; to: 0
|
2023-04-03 17:15:32 +08:00
|
|
|
|
duration: root.animationDuration; easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
PropertyAnimation {
|
|
|
|
|
target: backgroundMask; property: "height"
|
2024-03-04 17:42:57 +08:00
|
|
|
|
from: normalGeometry.height; to: root.height
|
2023-04-03 17:15:32 +08:00
|
|
|
|
duration: root.animationDuration; easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
PropertyAnimation {
|
|
|
|
|
target: backgroundMask; property: "width"
|
2024-03-04 17:42:57 +08:00
|
|
|
|
from: normalGeometry.width; to: root.width
|
2023-04-03 17:15:32 +08:00
|
|
|
|
duration: root.animationDuration; easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onStarted: {
|
|
|
|
|
fullScreenLoader.active = true;
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
2023-04-03 17:15:32 +08:00
|
|
|
|
onFinished: {
|
|
|
|
|
normalScreenLoader.active = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ParallelAnimation {
|
|
|
|
|
id: exitFullScreenAnimation
|
|
|
|
|
PropertyAnimation {
|
|
|
|
|
target: backgroundMask; property: "x"
|
2024-03-04 17:42:57 +08:00
|
|
|
|
from: 0; to: normalGeometry.x
|
2023-04-03 17:15:32 +08:00
|
|
|
|
duration: root.animationDuration; easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
PropertyAnimation {
|
|
|
|
|
target: backgroundMask; property: "y"
|
2024-03-04 17:42:57 +08:00
|
|
|
|
from: 0; to: normalGeometry.y
|
2023-04-03 17:15:32 +08:00
|
|
|
|
duration: root.animationDuration; easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
PropertyAnimation {
|
|
|
|
|
target: backgroundMask; property: "height"
|
2024-03-04 17:42:57 +08:00
|
|
|
|
from: root.height; to: normalGeometry.height
|
2023-04-03 17:15:32 +08:00
|
|
|
|
duration: root.animationDuration; easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
PropertyAnimation {
|
|
|
|
|
target: backgroundMask; property: "width"
|
2024-03-04 17:42:57 +08:00
|
|
|
|
from: root.width; to: normalGeometry.width
|
2023-04-03 17:15:32 +08:00
|
|
|
|
duration: root.animationDuration; easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onStarted: {
|
|
|
|
|
normalScreenLoader.active = true;
|
|
|
|
|
}
|
|
|
|
|
onFinished: {
|
|
|
|
|
fullScreenLoader.active = false;
|
|
|
|
|
mainWindow.isFullScreen = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-20 15:33:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: normalScreenLoader
|
2023-04-26 17:04:22 +08:00
|
|
|
|
focus: !mainWindow.isFullScreen
|
2024-02-23 18:19:22 +08:00
|
|
|
|
active: false
|
2024-03-04 17:42:57 +08:00
|
|
|
|
x: normalGeometry.x
|
|
|
|
|
y: normalGeometry.y
|
|
|
|
|
height: normalGeometry.height
|
|
|
|
|
width: normalGeometry.width
|
2023-03-20 15:33:32 +08:00
|
|
|
|
sourceComponent: normalComponent
|
|
|
|
|
NumberAnimation { id: normalShow; target: normalScreenLoader; properties: "opacity"; from: 0; to: 1; duration: root.animationDuration; easing.type: Easing.InQuint }
|
|
|
|
|
NumberAnimation { id: normalHide; target: normalScreenLoader; properties: "opacity"; from: 1; to: 0; duration: root.animationDuration; easing.type: Easing.OutQuint }
|
2023-03-24 17:47:17 +08:00
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
active = mainWindow.isFullScreen ? false : true;
|
|
|
|
|
opacity = mainWindow.isFullScreen ? 0 : 1;
|
|
|
|
|
}
|
2023-04-26 17:04:22 +08:00
|
|
|
|
Keys.onPressed: {
|
|
|
|
|
item.keyPressed(event);
|
|
|
|
|
}
|
2023-03-20 15:33:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: fullScreenLoader
|
2024-03-04 17:42:57 +08:00
|
|
|
|
x: 0; y: 0
|
|
|
|
|
width: parent.width; height: parent.height
|
2024-02-23 18:19:22 +08:00
|
|
|
|
focus: mainWindow.isFullScreen
|
2023-03-20 15:33:32 +08:00
|
|
|
|
sourceComponent: fullSceenComponent
|
2024-03-04 17:42:57 +08:00
|
|
|
|
ParallelAnimation {
|
|
|
|
|
id: fullShow
|
|
|
|
|
NumberAnimation { target: fullScreenLoader; properties: "opacity"; from: 0; to: 1; duration: root.animationDuration; easing.type: Easing.InQuint }
|
|
|
|
|
NumberAnimation { target: fullScreenLoader; properties: "y"; from: -100; to: 0; duration: root.animationDuration; easing.type: Easing.InOutQuad }
|
|
|
|
|
}
|
2023-03-20 15:33:32 +08:00
|
|
|
|
NumberAnimation { id: fullHide; target: fullScreenLoader; properties: "opacity"; from: 1; to: 0; duration: root.animationDuration; easing.type: Easing.OutQuint }
|
2023-03-24 17:47:17 +08:00
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
active = mainWindow.isFullScreen ? true : false;
|
|
|
|
|
opacity = mainWindow.isFullScreen ? 1 : 0;
|
|
|
|
|
}
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: fullSceenComponent
|
|
|
|
|
AppUI.FullScreenUI {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: normalComponent
|
2024-02-23 18:19:22 +08:00
|
|
|
|
AppUI.NormalUI { }
|
2022-12-02 15:58:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|