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
|
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")
|
|
|
|
|
property var normalGeometry: mainWindow.normalScreenSize()
|
|
|
|
|
property double transparency: mainWindow.transparency
|
|
|
|
|
property bool onComlpeted: false
|
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);
|
|
|
|
|
onComlpeted = true;
|
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();
|
|
|
|
|
backgroundMask.state = "fullScreen";
|
|
|
|
|
if (root.transparency <= 0.6) {
|
|
|
|
|
maskHide.start();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-20 15:33:32 +08:00
|
|
|
|
function exitFullScreen() {
|
|
|
|
|
normalShow.start();
|
|
|
|
|
fullHide.start();
|
|
|
|
|
backgroundMask.state = "normalScreen";
|
|
|
|
|
if (root.transparency <= 0.6) {
|
|
|
|
|
maskShow.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
|
|
|
|
|
2023-03-20 15:33:32 +08:00
|
|
|
|
onTransparencyChanged: {
|
|
|
|
|
if (transparency > 0.6) {
|
|
|
|
|
backgroundMask.opacity = 1;
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AppControls2.StyleBackground {
|
|
|
|
|
id: backgroundMask
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.bottom: parent.bottom
|
2023-03-20 15:33:32 +08:00
|
|
|
|
radius: 12
|
|
|
|
|
state: "normalScreen"
|
2023-03-17 17:25:50 +08:00
|
|
|
|
|
2023-03-20 15:33:32 +08:00
|
|
|
|
onHeightChanged: {
|
|
|
|
|
if (root.transparency <= 0.6 && root.onComlpeted) {
|
|
|
|
|
mainWindow.changeWindowBlurRegion(0, root.height - height, width, height)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
id: maskHide
|
|
|
|
|
target: backgroundMask; property: "opacity"
|
|
|
|
|
from: 1.0; to: 0;
|
|
|
|
|
duration: root.animationDuration / 4; easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
id: maskShow
|
|
|
|
|
target: backgroundMask; property: "opacity"
|
|
|
|
|
from: 0; to: 1.0;
|
|
|
|
|
duration: root.animationDuration * 2; easing.type: Easing.InOutExpo
|
|
|
|
|
}
|
2023-03-17 17:25:50 +08:00
|
|
|
|
|
|
|
|
|
states: [
|
|
|
|
|
State {
|
2023-03-20 15:33:32 +08:00
|
|
|
|
name: "normalScreen"
|
|
|
|
|
PropertyChanges { target: backgroundMask; height: root.normalGeometry.height; width: root.normalGeometry.width }
|
2023-03-17 17:25:50 +08:00
|
|
|
|
},
|
|
|
|
|
State {
|
2023-03-20 15:33:32 +08:00
|
|
|
|
name: "fullScreen"
|
|
|
|
|
PropertyChanges { target: backgroundMask; height: root.height; width: root.width }
|
|
|
|
|
PropertyChanges { target: normalScreenLoader; anchors.margins: 8 }
|
|
|
|
|
AnchorChanges { target: normalScreenLoader; anchors.bottom: root.bottom; anchors.left: root.left }
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
2023-03-20 15:33:32 +08:00
|
|
|
|
transitions: [
|
|
|
|
|
Transition {
|
|
|
|
|
to: "fullScreen"
|
|
|
|
|
SequentialAnimation {
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
|
|
|
|
normalScreenLoader.anchors.left = root.left;
|
|
|
|
|
normalScreenLoader.anchors.bottom = root.bottom;
|
|
|
|
|
normalScreenLoader.anchors.margins = 8;
|
|
|
|
|
fullScreenLoader.active = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
NumberAnimation { properties: "height,width"; duration: root.animationDuration; easing.type: Easing.InOutQuad }
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
|
|
|
|
normalScreenLoader.active = false;
|
|
|
|
|
mainWindow.enableWindowBlur(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Transition {
|
|
|
|
|
to: "normalScreen"
|
|
|
|
|
SequentialAnimation {
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
|
|
|
|
normalScreenLoader.active = true;
|
|
|
|
|
mainWindow.enableWindowBlur(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
NumberAnimation { properties: "height,width"; duration: root.animationDuration; easing.type: Easing.InOutQuad }
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
|
|
|
|
fullScreenLoader.active = false;
|
|
|
|
|
mainWindow.isFullScreen = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
2023-03-20 15:33:32 +08:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: normalScreenLoader
|
|
|
|
|
height: root.normalGeometry.height; width: root.normalGeometry.width
|
|
|
|
|
anchors.bottom: root.bottom
|
|
|
|
|
anchors.left: root.left
|
|
|
|
|
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 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: fullScreenLoader
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
sourceComponent: fullSceenComponent
|
|
|
|
|
opacity: 0
|
|
|
|
|
NumberAnimation { id: fullShow; target: fullScreenLoader; properties: "opacity"; from: 0; to: 1; duration: root.animationDuration; easing.type: Easing.InQuint }
|
|
|
|
|
NumberAnimation { id: fullHide; target: fullScreenLoader; properties: "opacity"; from: 1; to: 0; duration: root.animationDuration; easing.type: Easing.OutQuint }
|
2023-03-17 17:25:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: fullSceenComponent
|
|
|
|
|
AppUI.FullScreenUI {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: normalComponent
|
|
|
|
|
AppUI.NormalUI {}
|
2022-12-02 15:58:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|