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
|
2023-03-17 17:25:50 +08:00
|
|
|
|
import QtQml 2.12
|
2022-12-02 15:58:09 +08:00
|
|
|
|
|
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
|
|
|
|
|
property int animationDuration: 150
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
loader.reloadUI();
|
|
|
|
|
mainWindow.beforeFullScreenChanged.connect(beforeFullScreenSlot);
|
|
|
|
|
mainWindow.fullScreenChanged.connect(fullScreenChangedSlot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fullScreenChangedSlot() {
|
|
|
|
|
loader.opacity = 0;
|
|
|
|
|
fullScreenAnimation.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function beforeFullScreenSlot(status) {
|
|
|
|
|
if (!status) {
|
|
|
|
|
loader.sourceComponent = undefined;
|
|
|
|
|
}
|
|
|
|
|
backgroundMask.alpha = status ? 0.5 : 0
|
|
|
|
|
backgroundMask.enableSizeChange = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ParallelAnimation {
|
|
|
|
|
id: fullScreenAnimation
|
|
|
|
|
NumberAnimation { target: backgroundMask; property: "width"; to: root.width; duration: root.animationDuration }
|
|
|
|
|
NumberAnimation { target: backgroundMask; property: "height"; to: root.height; duration: root.animationDuration }
|
|
|
|
|
|
|
|
|
|
onFinished: {
|
|
|
|
|
backgroundMask.enableSizeChange = true;
|
|
|
|
|
loader.reloadUI();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AppControls2.StyleBackground {
|
|
|
|
|
id: backgroundMask
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
alpha: 0
|
|
|
|
|
useStyleTransparent: false
|
|
|
|
|
paletteRole: Palette.Dark
|
|
|
|
|
|
|
|
|
|
property bool enableSizeChange: true
|
|
|
|
|
|
|
|
|
|
states: [
|
|
|
|
|
State {
|
|
|
|
|
name: "disableSizeChange"
|
|
|
|
|
when: !backgroundMask.enableSizeChange
|
|
|
|
|
AnchorChanges {
|
|
|
|
|
target: backgroundMask
|
|
|
|
|
anchors.top: undefined
|
|
|
|
|
anchors.right: undefined
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "enableSizeChange"
|
|
|
|
|
when: backgroundMask.enableSizeChange
|
|
|
|
|
AnchorChanges {
|
|
|
|
|
target: backgroundMask
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: loader
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
Behavior on opacity {
|
|
|
|
|
NumberAnimation { duration: root.animationDuration }
|
|
|
|
|
}
|
|
|
|
|
function reloadUI() {
|
|
|
|
|
loader.sourceComponent = mainWindow.isFullScreen ? fullSceenComponent : normalComponent;
|
|
|
|
|
loader.opacity = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: fullSceenComponent
|
|
|
|
|
AppUI.FullScreenUI {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: normalComponent
|
|
|
|
|
AppUI.NormalUI {}
|
2022-12-02 15:58:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|