Fixes in GUI: start/stop timers

This commit is contained in:
Klaus Basan
2014-04-28 19:28:18 +02:00
parent 5e0e9faf71
commit a8783b0b5b
3 changed files with 24 additions and 15 deletions

View File

@@ -73,17 +73,7 @@ void MainWindow::gracefulShutdown()
}
// shut down all timers
this->stopUpdateTimers(true);
if (this->m_timerContextWatchdog)
{
this->m_timerContextWatchdog->stop();
this->m_timerContextWatchdog->disconnect(this);
}
if (this->m_timerCollectedCockpitUpdates)
{
this->m_timerCollectedCockpitUpdates->stop();
this->m_timerCollectedCockpitUpdates->disconnect(this);
}
this->stopAllTimers(true);
// if we have a context, we shut some things down
if (this->m_contextNetworkAvailable)
@@ -253,6 +243,7 @@ bool MainWindow::isContextAudioAvailableCheck()
*/
void MainWindow::displayStatusMessage(const CStatusMessage &statusMessage)
{
if (!this->m_init) return;
this->ui->sb_MainStatusBar->show();
this->m_timerStatusBar->start(3000);
this->m_statusBarIcon->setPixmap(statusMessage.toIcon());
@@ -271,7 +262,7 @@ void MainWindow::displayStatusMessage(const CStatusMessage &statusMessage)
*/
void MainWindow::displayStatusMessages(const CStatusMessageList &messages)
{
if (messages.isEmpty()) return;
if (!this->m_init || messages.isEmpty()) return;
foreach(CStatusMessage msg, messages)
{
this->displayStatusMessage(msg);

View File

@@ -232,6 +232,12 @@ private:
*/
void stopUpdateTimers(bool disconnect = false);
/*!
* \brief Stop all timers
* \param disconnect also disconnect signal/slots
*/
void stopAllTimers(bool disconnect);
//! Currently selected SELCAL code
QString getSelcalCode() const;
@@ -244,7 +250,6 @@ private:
//! Update simulator page with latest user aircraft data
void updateSimulatorData();
private slots:
//

View File

@@ -15,6 +15,7 @@
#include "blackgui/atcstationlistmodel.h"
#include "blackgui/keyboardkeylistmodel.h"
#include "blackmisc/avselcal.h"
#include "blackmisc/project.h"
#include <QSortFilterProxyModel>
#include <QSizeGrip>
#include <QHBoxLayout>
@@ -325,12 +326,24 @@ void MainWindow::stopUpdateTimers(bool disconnect)
this->m_timerUpdateAircraftsInRange->stop();
this->m_timerUpdateAtcStationsOnline->stop();
this->m_timerUpdateUsers->stop();
this->m_timerAudioTests->stop();
this->m_timerSimulator->stop();
if (!disconnect) return;
this->disconnect(this->m_timerUpdateAircraftsInRange);
this->disconnect(this->m_timerUpdateAtcStationsOnline);
this->disconnect(this->m_timerUpdateUsers);
}
void MainWindow::stopAllTimers(bool disconnect)
{
this->m_timerStatusBar->stop();
this->m_timerContextWatchdog->stop();
this->m_timerCollectedCockpitUpdates->stop();
this->m_timerAudioTests->stop();
this->m_timerSimulator->stop();
this->stopUpdateTimers(disconnect);
if (!disconnect) return;
this->disconnect(this->m_timerStatusBar);
this->disconnect(this->m_timerContextWatchdog);
this->disconnect(this->m_timerCollectedCockpitUpdates);
this->disconnect(this->m_timerAudioTests);
this->disconnect(this->m_timerSimulator);
}