From 1de3b28c49b966c5e22794640aa966f32c377808 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 17 Sep 2018 18:25:20 +0200 Subject: [PATCH] Ref T345, clear online views when disconnected --- src/blackgui/components/atcstationcomponent.cpp | 10 +++++++++- src/blackgui/components/atcstationcomponent.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/blackgui/components/atcstationcomponent.cpp b/src/blackgui/components/atcstationcomponent.cpp index f7b8bc893..a99ac7719 100644 --- a/src/blackgui/components/atcstationcomponent.cpp +++ b/src/blackgui/components/atcstationcomponent.cpp @@ -282,6 +282,7 @@ namespace BlackGui else if (INetwork::isDisconnectedStatus(to)) { m_updateTimer.stop(); + this->clearOnlineViews(); } } @@ -402,7 +403,7 @@ namespace BlackGui } if (stationClicked.hasMetar()) { - if (!infoMessage.isEmpty()) infoMessage.append("\n\n"); + if (!infoMessage.isEmpty()) { infoMessage.append("\n\n"); } infoMessage.append(stationClicked.getMetar().getMessage()); } ui->te_AtcStationsOnlineInfo->setText(infoMessage); @@ -430,5 +431,12 @@ namespace BlackGui if (!sGui || sGui->isShuttingDown() || !sGui->getIContextNetwork()) { return false; } return true; } + + void CAtcStationComponent::clearOnlineViews() + { + ui->tvp_AtcStationsOnline->clear(); + QAbstractItemModel *treeModelOld = (ui->tvp_AtcStationsOnlineTree->model()); + if (treeModelOld) { CGuiUtility::clearModel(treeModelOld); } + } } // namespace } // namespace diff --git a/src/blackgui/components/atcstationcomponent.h b/src/blackgui/components/atcstationcomponent.h index b30227657..9765a6710 100644 --- a/src/blackgui/components/atcstationcomponent.h +++ b/src/blackgui/components/atcstationcomponent.h @@ -145,6 +145,9 @@ namespace BlackGui //! Contexts? bool canAccessContext() const; + //! Clear the online views + void clearOnlineViews(); + QScopedPointer ui; QTimer m_updateTimer; QDateTime m_timestampLastReadOnlineStations; //!< stations read