chore(@main): unbreak minimize/fullscreen shortcuts

those need proper context
(plus some warnings fixed)
This commit is contained in:
Lukáš Tinkl 2022-07-19 14:15:00 +02:00 committed by Lukáš Tinkl
parent 8c2b4ed89f
commit a130681dd5
1 changed files with 9 additions and 10 deletions

View File

@ -5,7 +5,6 @@ import Qt.labs.platform 1.1
import Qt.labs.settings 1.0 import Qt.labs.settings 1.0
import QtQuick.Window 2.12 import QtQuick.Window 2.12
import QtQml 2.13 import QtQml 2.13
import QtQuick.Window 2.0
import QtQuick.Controls.Universal 2.12 import QtQuick.Controls.Universal 2.12
import DotherSide 0.1 import DotherSide 0.1
@ -61,7 +60,7 @@ StatusWindow {
} }
applicationWindow.visibility = visibility; applicationWindow.visibility = visibility;
if (visibility == Window.Windowed) { if (visibility === Window.Windowed) {
applicationWindow.x = geometry.x; applicationWindow.x = geometry.x;
applicationWindow.y = geometry.y; applicationWindow.y = geometry.y;
applicationWindow.width = geometry.width; applicationWindow.width = geometry.width;
@ -74,7 +73,7 @@ StatusWindow {
return; return;
localAppSettings.visibility = applicationWindow.visibility; localAppSettings.visibility = applicationWindow.visibility;
if (applicationWindow.visibility == Window.Windowed) { if (applicationWindow.visibility === Window.Windowed) {
localAppSettings.geometry = Qt.rect(applicationWindow.x, applicationWindow.y, localAppSettings.geometry = Qt.rect(applicationWindow.x, applicationWindow.y,
applicationWindow.width, applicationWindow.height); applicationWindow.width, applicationWindow.height);
} }
@ -88,7 +87,7 @@ StatusWindow {
Action { Action {
shortcut: StandardKey.FullScreen shortcut: StandardKey.FullScreen
onTriggered: { onTriggered: {
if (visibility === Window.FullScreen) { if (applicationWindow.visibility === Window.FullScreen) {
showNormal() showNormal()
} else { } else {
showFullScreen() showFullScreen()
@ -99,7 +98,7 @@ StatusWindow {
Action { Action {
shortcut: "Ctrl+M" shortcut: "Ctrl+M"
onTriggered: { onTriggered: {
if (visibility === Window.Minimized) { if (applicationWindow.visibility === Window.Minimized) {
showNormal() showNormal()
} else { } else {
showMinimized() showMinimized()
@ -126,12 +125,12 @@ StatusWindow {
Connections { Connections {
target: startupModule target: startupModule
onStartUpUIRaised: { function onStartUpUIRaised() {
applicationWindow.appIsReady = true; applicationWindow.appIsReady = true;
applicationWindow.storeAppState(); applicationWindow.storeAppState();
} }
onAppStateChanged: { function onAppStateChanged(state) {
if(state === Constants.appState.main) { if(state === Constants.appState.main) {
// We set main module to the Global singleton once user is logged in and we move to the main app. // We set main module to the Global singleton once user is logged in and we move to the main app.
Global.mainModuleInst = mainModule Global.mainModuleInst = mainModule
@ -155,7 +154,7 @@ StatusWindow {
//! Workaround for custom QQuickWindow //! Workaround for custom QQuickWindow
Connections { Connections {
target: applicationWindow target: applicationWindow
onClosing: { function onClosing(close) {
if (Qt.platform.os === "osx") { if (Qt.platform.os === "osx") {
loader.sourceComponent = undefined loader.sourceComponent = undefined
close.accepted = true close.accepted = true
@ -177,7 +176,7 @@ StatusWindow {
Connections { Connections {
target: singleInstance target: singleInstance
onSecondInstanceDetected: { function onSecondInstanceDetected() {
console.log("User attempted to run the second instance of the application") console.log("User attempted to run the second instance of the application")
// activating this instance to give user visual feedback // activating this instance to give user visual feedback
applicationWindow.show() applicationWindow.show()
@ -185,7 +184,7 @@ StatusWindow {
applicationWindow.requestActivate() applicationWindow.requestActivate()
} }
onEventReceived: { function onEventReceived(eventStr) {
let event = JSON.parse(eventStr) let event = JSON.parse(eventStr)
if (event.hasOwnProperty("uri")) { if (event.hasOwnProperty("uri")) {
// Not Refactored Yet // Not Refactored Yet