Commit 9f4d98a5 authored by Gus Grubba's avatar Gus Grubba

Make custom dialog into a function

Internet available now has a signal
parent f8bb0a63
......@@ -573,7 +573,7 @@ QGCView {
/// Close all dialogs
function closeAll() {
rootLoader.sourceComponent = null
mainWindow.resetCustomDialog()
guidedActionConfirm.visible = false
guidedActionList.visible = false
altitudeSlider.visible = false
......
......@@ -500,7 +500,10 @@ QGCMapEngine::testInternet()
void
QGCMapEngine::_internetStatus(bool active)
{
_isInternetActive = active;
if(_isInternetActive != active) {
_isInternetActive = active;
emit internetUpdated();
}
}
// Resolution math: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Resolution_and_Scale
......
......@@ -107,6 +107,7 @@ private slots:
signals:
void updateTotals (quint32 totaltiles, quint64 totalsize, quint32 defaulttiles, quint64 defaultsize);
void internetUpdated ();
private:
void _wipeOldCaches ();
......
......@@ -958,7 +958,7 @@ QGCView {
visible: !ScreenTools.isMobile
onClicked: {
QGroundControl.mapEngineManager.importAction = QGCMapEngineManager.ActionNone
rootLoader.sourceComponent = importDialog
mainWindow.showCustomDialog(importDialog)
}
}
QGCButton {
......@@ -1032,7 +1032,7 @@ QGCView {
onClicked: {
showList();
if(QGroundControl.mapEngineManager.exportSets()) {
rootLoader.sourceComponent = exportToDiskProgress
mainWindow.showCustomDialog(exportToDiskProgress)
}
}
}
......@@ -1090,7 +1090,7 @@ QGCView {
visible: !QGroundControl.mapEngineManager.exporting
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
rootLoader.sourceComponent = null
mainWindow.closeCustomDialog()
}
}
}
......@@ -1173,7 +1173,7 @@ QGCView {
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
showList();
rootLoader.sourceComponent = null
mainWindow.closeCustomDialog()
}
}
Row {
......@@ -1186,7 +1186,7 @@ QGCView {
onClicked: {
if(!QGroundControl.mapEngineManager.importSets()) {
showList();
rootLoader.sourceComponent = null
mainWindow.closeCustomDialog()
}
}
}
......@@ -1195,7 +1195,7 @@ QGCView {
width: _bigButtonSize * 1.25
onClicked: {
showList();
rootLoader.sourceComponent = null
mainWindow.closeCustomDialog()
}
}
}
......
......@@ -63,7 +63,7 @@ Item {
}
function showSettingsView() {
rootLoader.sourceComponent = null
resetCustomDialog()
if(currentPopUp) {
currentPopUp.close()
}
......@@ -78,7 +78,7 @@ Item {
}
function showSetupView() {
rootLoader.sourceComponent = null
resetCustomDialog()
if(currentPopUp) {
currentPopUp.close()
}
......@@ -93,7 +93,7 @@ Item {
}
function showPlanView() {
rootLoader.sourceComponent = null
resetCustomDialog()
if(currentPopUp) {
currentPopUp.close()
}
......@@ -107,7 +107,7 @@ Item {
}
function showFlyView() {
rootLoader.sourceComponent = null
resetCustomDialog()
if(currentPopUp) {
currentPopUp.close()
}
......@@ -118,7 +118,7 @@ Item {
}
function showAnalyzeView() {
rootLoader.sourceComponent = null
resetCustomDialog()
if(currentPopUp) {
currentPopUp.close()
}
......@@ -148,6 +148,20 @@ Item {
}
}
function showCustomDialog(dlg) {
rootLoader.sourceComponent = dlg
}
function closeCustomDialog() {
mainWindow.enableToolbar()
rootLoader.sourceComponent = null
}
function resetCustomDialog() {
rootLoader.sourceComponent = null
mainWindow.enableToolbar()
}
MessageDialog {
id: unsavedMissionCloseDialog
title: qsTr("%1 close").arg(QGroundControl.appName)
......@@ -223,7 +237,7 @@ Item {
}
function showMessageArea() {
rootLoader.sourceComponent = null
mainWindow.resetCustomDialog()
var currentlyVisible = messageArea.visible
if(currentPopUp) {
currentPopUp.close()
......@@ -244,7 +258,7 @@ Item {
}
function showPopUp(dropItem, centerX) {
rootLoader.sourceComponent = null
mainWindow.resetCustomDialog()
var oldIndicator = indicatorDropdown.sourceComponent
if(currentPopUp) {
currentPopUp.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