import QtQuick as Quick import Fluent Quick.Window { id: root property string windowIcon: App.windowIcon property bool showStayTop: false property bool showMaximize: true property bool showMinimize: true property bool showClose: true property bool showDark: false property bool fixSize: false property bool stayTop: false property int __margins: 0 property var background : com_background property Quick.color backgroundColor: { if(active){ return Theme.windowActiveBackgroundColor } return Theme.windowBackgroundColor } property Quick.Item appBar: AppBar { title: root.title height: 30 showDark: root.showDark showClose: root.showClose showMinimize: root.showMinimize showMaximize: root.showMaximize showStayTop: root.showStayTop icon: root.windowIcon } Frameless { id: frameless appBar: root.appBar maximizeButton: appBar.buttonMaximize fixSize: root.fixSize topmost: root.stayTop disabled: App.useSystemAppBar Quick.Component.onCompleted: { frameless.setHitTestVisible(appBar.layoutMacosButtons) frameless.setHitTestVisible(appBar.layoutStandardbuttons) } Quick.Component.onDestruction: { frameless.onDestruction() } } Quick.Component.onCompleted: { Router.addWindow(root) } Quick.Component { id:com_app_bar Quick.Item{ data: root.appBar Quick.Component.onCompleted: { root.appBar.width = Qt.binding(function(){ return this.parent.width }) } } } Quick.Item{ id: layout_container anchors.fill: parent anchors.margins: root.__margins Quick.Loader{ anchors.fill: parent sourceComponent: background Quick.Component.onDestruction: sourceComponent = undefined } Quick.Loader{ id:loader_app_bar anchors { top: parent.top left: parent.left right: parent.right } height: { if(root.useSystemAppBar){ return 0 } return root.fitsAppBarWindows ? 0 : root.appBar.height } sourceComponent: root.useSystemAppBar ? undefined : com_app_bar Quick.Component.onDestruction: sourceComponent = undefined } Quick.Item{ id:layout_content anchors{ top: loader_app_bar.bottom left: parent.left right: parent.right bottom: parent.bottom } clip: true } Quick.Loader{ property string loadingText property bool cancel: false id:loader_loading anchors.fill: parent Quick.Component.onDestruction: sourceComponent = undefined } InfoBar{ id:info_bar root: layout_container } Quick.Loader{ id:loader_border anchors.fill: parent sourceComponent: { if(root.useSystemAppBar || Utilities.isWin() || root.visibility === Window.Maximized || root.visibility === Window.FullScreen){ return undefined } return com_border } Quick.Component.onDestruction: sourceComponent = undefined } } Quick.Component { id:com_background Quick.Item{ Rectangle{ anchors.fill: parent color: root.backgroundColor } Quick.Image{ id:img_back visible: false cache: false fillMode: Quick.Image.PreserveAspectCrop asynchronous: true Quick.Component.onCompleted: { img_back.updateLayout() source = Utilities.getUrlByFilePath(Theme.desktopImagePath) } Quick.Connections{ target: root function onScreenChanged(){ img_back.updateLayout() } } function updateLayout(){ var geometry = Utilities.desktopAvailableGeometry(root) img_back.width = geometry.width img_back.height = geometry.height img_back.sourceSize = Qt.size(img_back.width,img_back.height) } Quick.Connections{ target: Theme function onDesktopImagePathChanged(){ timer_update_image.restart() } function onBlurBehindWindowEnabledChanged(){ if(Theme.blurBehindWindowEnabled){ img_back.source = Utilities.getUrlByFilePath(Theme.desktopImagePath) }else{ img_back.source = "" } } } Quick.Timer{ id:timer_update_image interval: 150 onTriggered: { img_back.source = "" img_back.source = Utilities.getUrlByFilePath(Theme.desktopImagePath) } } } Acrylic{ anchors.fill: parent target: img_back tintOpacity: Theme.dark ? 0.80 : 0.75 blurRadius: 64 visible: root.active && Theme.blurBehindWindowEnabled tintColor: Theme.dark ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1) targetRect: Qt.rect(root.x-root.screen.virtualX,root.y-root.screen.virtualY,root.width,root.height) } } } }