Commit 03e24506 authored by Don Gagne's avatar Don Gagne

Merge pull request #2377 from DonLakeFlyer/AppClose

Tablet app close
parents 9f86fc06 c2d5bb78
......@@ -52,9 +52,7 @@ MissionController::MissionController(QObject *parent)
MissionController::~MissionController()
{
// Start with empty list
_missionItems = new QmlObjectListModel(this);
_initAllMissionItems();
}
void MissionController::start(bool editMode)
......
......@@ -23,6 +23,7 @@ along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.Controls 1.0
......@@ -41,7 +42,7 @@ Item {
}
function showWindowCloseMessage() {
mainWindowInner.item.showWindowCloseMessage()
windowCloseDialog.open()
}
// The following are use for unit testing only
......@@ -71,5 +72,16 @@ Item {
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: controller.acceptWindowClose()
}
}
......@@ -64,7 +64,7 @@ Item {
flightView.visible = true
setupViewLoader.visible = false
planViewLoader.visible = false
toolbar.checkFlyButton()
toolBar.checkFlyButton()
}
function showPlanView() {
......@@ -93,10 +93,6 @@ Item {
toolBar.checkSetupButton()
}
function showWindowCloseMessage() {
windowCloseDialog.open()
}
// The following are use for unit testing only
function showSetupFirmware() {
......@@ -204,17 +200,6 @@ Item {
currentPopUp = indicatorDropdown
}
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: controller.acceptWindowClose()
}
//-- Left Settings Menu
Loader {
id: leftPanel
......
......@@ -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
/// Native QML top level window
Window {
visible: true
id: _rootWindow
visible: true
onClosing: {
// Disallow window close if there are active connections
......@@ -56,7 +58,7 @@ Window {
}
function showWindowCloseMessage() {
mainWindowInner.item.showWindowCloseMessage()
windowCloseDialog.open()
}
// The following are use for unit testing only
......@@ -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()
// The above shutdown causes a flurry of activity as the vehicle components are removed. This in turn
// causes the Windows Version of Qt to crash if you allow the close event to be accepted. In order to prevent
// the crash, we ignore the close event and setup a delayed timer to close the window after things settle down.
delayedWindowCloseTimer.start()
}
}
Timer {
id: delayedWindowCloseTimer
interval: 1500
running: false
repeat: false
onTriggered: _rootWindow.close()
}
}
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