@ -23,12 +23,14 @@ along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
@@ -23,12 +23,14 @@ along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.5
import QtQuick . Window 2.2
import QtQuick . Dialogs 1.2
import QGroundControl 1.0
/ / / N a t i v e Q M L t o p l e v e l w i n d o w
Window {
visible: true
id: _rootWindow
visible: true
onClosing: {
/ / D i s a l l o w w i n d o w c l o s e i f t h e r e a r e a c t i v e c o n n e c t i o n s
@ -56,7 +58,7 @@ Window {
@@ -56,7 +58,7 @@ Window {
}
function showWindowCloseMessage ( ) {
mainWindowInner . item . showWindowCloseMessage ( )
windowCloseDialog . open ( )
}
/ / T h e f o l l o w i n g a r e u s e f o r u n i t t e s t i n g o n l y
@ -86,5 +88,32 @@ Window {
@@ -86,5 +88,32 @@ Window {
anchors.fill: parent
source: "MainWindowInner.qml"
}
MessageDialog {
id: windowCloseDialog
title: "QGroundControl close"
text: "There are still active connections to vehicles. Do you want to disconnect these before closing?"
standardButtons: StandardButton . Yes | StandardButton . Cancel
modality: Qt . ApplicationModal
visible: false
onYes: {
QGroundControl . linkManager . shutdown ( )
/ / T h e a b o v e s h u t d o w n c a u s e s a f l u r r y o f a c t i v i t y a s t h e v e h i c l e c o m p o n e n t s a r e r e m o v e d . T h i s i n t u r n
/ / c a u s e s t h e W i n d o w s V e r s i o n o f Q t t o c r a s h i f y o u a l l o w t h e c l o s e e v e n t t o b e a c c e p t e d . I n o r d e r t o p r e v e n t
/ / t h e c r a s h , w e i g n o r e t h e c l o s e e v e n t a n d s e t u p a d e l a y e d t i m e r t o c l o s e t h e w i n d o w a f t e r t h i n g s s e t t l e d o w n .
delayedWindowCloseTimer . start ( )
}
}
Timer {
id: delayedWindowCloseTimer
interval: 1500
running: false
repeat: false
onTriggered: _rootWindow . close ( )
}
}