|
|
|
@ -12,11 +12,14 @@ import QtQuick.Window 2.11
@@ -12,11 +12,14 @@ import QtQuick.Window 2.11
|
|
|
|
|
import QtQuick.Controls 2.4 |
|
|
|
|
import Qt.labs.settings 1.0 |
|
|
|
|
|
|
|
|
|
import QGroundControl.ScreenTools 1.0 |
|
|
|
|
import QGroundControl 1.0 |
|
|
|
|
import QGroundControl.ScreenTools 1.0 |
|
|
|
|
|
|
|
|
|
Item { |
|
|
|
|
property Window window |
|
|
|
|
|
|
|
|
|
property bool _enabled: !ScreenTools.isMobile && QGroundControl.corePlugin.options.enableSaveMainWindowPosition |
|
|
|
|
|
|
|
|
|
Settings { |
|
|
|
|
id: s |
|
|
|
|
category: "MainWindowState" |
|
|
|
@ -29,7 +32,7 @@ Item {
@@ -29,7 +32,7 @@ Item {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Component.onCompleted: { |
|
|
|
|
if (!ScreenTools.isMobile && s.width && s.height) { |
|
|
|
|
if (_enabled && s.width && s.height) { |
|
|
|
|
window.x = s.x; |
|
|
|
|
window.y = s.y; |
|
|
|
|
window.width = s.width; |
|
|
|
@ -39,12 +42,12 @@ Item {
@@ -39,12 +42,12 @@ Item {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Connections { |
|
|
|
|
target: ScreenTools.isMobile ? null : window |
|
|
|
|
onXChanged: saveSettingsTimer.restart() |
|
|
|
|
onYChanged: saveSettingsTimer.restart() |
|
|
|
|
onWidthChanged: saveSettingsTimer.restart() |
|
|
|
|
onHeightChanged: saveSettingsTimer.restart() |
|
|
|
|
onVisibilityChanged: saveSettingsTimer.restart() |
|
|
|
|
target: window |
|
|
|
|
onXChanged: if(_enabled) saveSettingsTimer.restart() |
|
|
|
|
onYChanged: if(_enabled) saveSettingsTimer.restart() |
|
|
|
|
onWidthChanged: if(_enabled) saveSettingsTimer.restart() |
|
|
|
|
onHeightChanged: if(_enabled) saveSettingsTimer.restart() |
|
|
|
|
onVisibilityChanged: if(_enabled) saveSettingsTimer.restart() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Timer { |
|
|
|
@ -55,20 +58,22 @@ Item {
@@ -55,20 +58,22 @@ Item {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function saveSettings() { |
|
|
|
|
switch(window.visibility) { |
|
|
|
|
case ApplicationWindow.Windowed: |
|
|
|
|
s.x = window.x; |
|
|
|
|
s.y = window.y; |
|
|
|
|
s.width = window.width; |
|
|
|
|
s.height = window.height; |
|
|
|
|
s.visibility = window.visibility; |
|
|
|
|
break; |
|
|
|
|
case ApplicationWindow.FullScreen: |
|
|
|
|
s.visibility = window.visibility; |
|
|
|
|
break; |
|
|
|
|
case ApplicationWindow.Maximized: |
|
|
|
|
s.visibility = window.visibility; |
|
|
|
|
break; |
|
|
|
|
if(_enabled) { |
|
|
|
|
switch(window.visibility) { |
|
|
|
|
case ApplicationWindow.Windowed: |
|
|
|
|
s.x = window.x; |
|
|
|
|
s.y = window.y; |
|
|
|
|
s.width = window.width; |
|
|
|
|
s.height = window.height; |
|
|
|
|
s.visibility = window.visibility; |
|
|
|
|
break; |
|
|
|
|
case ApplicationWindow.FullScreen: |
|
|
|
|
s.visibility = window.visibility; |
|
|
|
|
break; |
|
|
|
|
case ApplicationWindow.Maximized: |
|
|
|
|
s.visibility = window.visibility; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|