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