Commit 0bfb4de8 authored by Don Gagne's avatar Don Gagne

parent 0cf4b6ee
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
<file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file> <file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/JoystickThumbPad.qml">src/QmlControls/JoystickThumbPad.qml</file> <file alias="QGroundControl/Controls/JoystickThumbPad.qml">src/QmlControls/JoystickThumbPad.qml</file>
<file alias="QGroundControl/Controls/LogReplayStatusBar.qml">src/QmlControls/LogReplayStatusBar.qml</file> <file alias="QGroundControl/Controls/LogReplayStatusBar.qml">src/QmlControls/LogReplayStatusBar.qml</file>
<file alias="QGroundControl/Controls/MainWindowSavedState.qml">src/QmlControls/MainWindowSavedState.qml</file>
<file alias="QGroundControl/Controls/MAVLinkMessageButton.qml">src/QmlControls/MAVLinkMessageButton.qml</file> <file alias="QGroundControl/Controls/MAVLinkMessageButton.qml">src/QmlControls/MAVLinkMessageButton.qml</file>
<file alias="QGroundControl/Controls/MissionCommandDialog.qml">src/QmlControls/MissionCommandDialog.qml</file> <file alias="QGroundControl/Controls/MissionCommandDialog.qml">src/QmlControls/MissionCommandDialog.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/PlanView/MissionItemEditor.qml</file> <file alias="QGroundControl/Controls/MissionItemEditor.qml">src/PlanView/MissionItemEditor.qml</file>
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.11
import QtQuick.Window 2.11
import QtQuick.Controls 2.4
import Qt.labs.settings 1.0
import QGroundControl.ScreenTools 1.0
Item {
property Window window
Settings {
id: s
category: "MainWindowState"
property int x
property int y
property int width
property int height
property int visibility
}
Component.onCompleted: {
if (!ScreenTools.isMobile && s.width && s.height) {
window.x = s.x;
window.y = s.y;
window.width = s.width;
window.height = s.height;
window.visibility = s.visibility;
}
}
Connections {
target: ScreenTools.isMobile ? null : window
onXChanged: saveSettingsTimer.restart()
onYChanged: saveSettingsTimer.restart()
onWidthChanged: saveSettingsTimer.restart()
onHeightChanged: saveSettingsTimer.restart()
onVisibilityChanged: saveSettingsTimer.restart()
}
Timer {
id: saveSettingsTimer
interval: 1000
repeat: false
onTriggered: saveSettings()
}
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;
}
}
}
...@@ -24,6 +24,7 @@ HeightIndicator 1.0 HeightIndicator.qml ...@@ -24,6 +24,7 @@ HeightIndicator 1.0 HeightIndicator.qml
IndicatorButton 1.0 IndicatorButton.qml IndicatorButton 1.0 IndicatorButton.qml
JoystickThumbPad 1.0 JoystickThumbPad.qml JoystickThumbPad 1.0 JoystickThumbPad.qml
LogReplayStatusBar 1.0 LogReplayStatusBar.qml LogReplayStatusBar 1.0 LogReplayStatusBar.qml
MainWindowSavedState 1.0 MainWindowSavedState.qml
MAVLinkMessageButton 1.0 MAVLinkMessageButton.qml MAVLinkMessageButton 1.0 MAVLinkMessageButton.qml
MissionCommandDialog 1.0 MissionCommandDialog.qml MissionCommandDialog 1.0 MissionCommandDialog.qml
MissionItemEditor 1.0 MissionItemEditor.qml MissionItemEditor 1.0 MissionItemEditor.qml
......
...@@ -122,6 +122,10 @@ ApplicationWindow { ...@@ -122,6 +122,10 @@ ApplicationWindow {
simpleMessageDialog.open() simpleMessageDialog.open()
} }
MainWindowSavedState {
window: mainWindow
}
MessageDialog { MessageDialog {
id: simpleMessageDialog id: simpleMessageDialog
standardButtons: StandardButton.Ok standardButtons: StandardButton.Ok
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment