mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +08:00
refs #799, adjusted swift client reg. the settings updates
This commit is contained in:
@@ -70,6 +70,8 @@ namespace BlackGui
|
|||||||
ui->tvp_RenderedAircraft->setAircraftMode(CSimulatedAircraftListModel::RenderedMode);
|
ui->tvp_RenderedAircraft->setAircraftMode(CSimulatedAircraftListModel::RenderedMode);
|
||||||
ui->tvp_RenderedAircraft->setResizeMode(CAircraftModelView::ResizingOnce);
|
ui->tvp_RenderedAircraft->setResizeMode(CAircraftModelView::ResizingOnce);
|
||||||
|
|
||||||
|
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMappingComponent::ps_connectionStatusChanged);
|
||||||
|
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onModelsUpdateRequested);
|
connect(ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onModelsUpdateRequested);
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::modelDataChanged, this, &CMappingComponent::ps_onRowCountChanged);
|
connect(ui->tvp_AircraftModels, &CAircraftModelView::modelDataChanged, this, &CMappingComponent::ps_onRowCountChanged);
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onModelSelectedInView);
|
connect(ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onModelSelectedInView);
|
||||||
@@ -386,6 +388,8 @@ namespace BlackGui
|
|||||||
void CMappingComponent::ps_markRenderedViewForUpdate()
|
void CMappingComponent::ps_markRenderedViewForUpdate()
|
||||||
{
|
{
|
||||||
m_missedRenderedAircraftUpdate = true;
|
m_missedRenderedAircraftUpdate = true;
|
||||||
|
m_updateTimer.start();
|
||||||
|
this->ps_backgroundUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_addingRemoteAircraftFailed(const CSimulatedAircraft &aircraft, const CStatusMessage &message)
|
void CMappingComponent::ps_addingRemoteAircraftFailed(const CSimulatedAircraft &aircraft, const CStatusMessage &message)
|
||||||
@@ -445,7 +449,21 @@ namespace BlackGui
|
|||||||
void CMappingComponent::ps_settingsChanged()
|
void CMappingComponent::ps_settingsChanged()
|
||||||
{
|
{
|
||||||
const CViewUpdateSettings settings = this->m_settings.get();
|
const CViewUpdateSettings settings = this->m_settings.get();
|
||||||
this->m_updateTimer.setInterval(settings.getAircraftUpdateTime().toMs());
|
this->m_updateTimer.setInterval(settings.getRenderingUpdateTime().toMs());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to)
|
||||||
|
{
|
||||||
|
Q_UNUSED(from);
|
||||||
|
if (INetwork::isDisconnectedStatus(to))
|
||||||
|
{
|
||||||
|
ui->tvp_RenderedAircraft->clear();
|
||||||
|
this->m_updateTimer.stop();
|
||||||
|
}
|
||||||
|
else if (INetwork::isConnectedStatus(to))
|
||||||
|
{
|
||||||
|
this->m_updateTimer.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -148,6 +148,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
//! Settings have been changed
|
//! Settings have been changed
|
||||||
void ps_settingsChanged();
|
void ps_settingsChanged();
|
||||||
|
|
||||||
|
//! Connection status has been changed
|
||||||
|
void ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
class QEvent;
|
class QEvent;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -327,7 +326,7 @@ void SwiftGuiStd::updateGuiStatusInformation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update status fields
|
// update status fields
|
||||||
QString s = QString("network: %1").arg(network);
|
const QString s = QString("network: %1").arg(network);
|
||||||
ui->comp_InfoBarStatus->setDBusTooltip(s);
|
ui->comp_InfoBarStatus->setDBusTooltip(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,9 +105,9 @@ private:
|
|||||||
QScopedPointer<Ui::SwiftGuiStd> ui;
|
QScopedPointer<Ui::SwiftGuiStd> ui;
|
||||||
// if I pass the parent, the dialog is always center over the parent
|
// if I pass the parent, the dialog is always center over the parent
|
||||||
QScopedPointer<BlackGui::Components::CNavigatorDialog> m_navigator{new BlackGui::Components::CNavigatorDialog()};
|
QScopedPointer<BlackGui::Components::CNavigatorDialog> m_navigator{new BlackGui::Components::CNavigatorDialog()};
|
||||||
bool m_init = false;
|
bool m_init = false;
|
||||||
BlackGui::CManagedStatusBar m_statusBar;
|
BlackGui::CManagedStatusBar m_statusBar;
|
||||||
BlackMisc::CLogSubscriber m_logSubscriber { this, &SwiftGuiStd::ps_displayStatusMessageInGui };
|
BlackMisc::CLogSubscriber m_logSubscriber { this, &SwiftGuiStd::ps_displayStatusMessageInGui };
|
||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
bool m_coreAvailable = false;
|
bool m_coreAvailable = false;
|
||||||
@@ -169,12 +169,6 @@ private:
|
|||||||
//! \param mainPage index to be checked
|
//! \param mainPage index to be checked
|
||||||
bool isMainPageSelected(MainPageIndex mainPage) const;
|
bool isMainPageSelected(MainPageIndex mainPage) const;
|
||||||
|
|
||||||
//! Start all update timers
|
|
||||||
void startUpdateTimersWhenConnected();
|
|
||||||
|
|
||||||
//! Stop all update timers
|
|
||||||
void stopUpdateTimersWhenDisconnected();
|
|
||||||
|
|
||||||
//! Stop all timers
|
//! Stop all timers
|
||||||
//! \param disconnect also disconnect signal/slots
|
//! \param disconnect also disconnect signal/slots
|
||||||
void stopAllTimers(bool disconnectSignalSlots);
|
void stopAllTimers(bool disconnectSignalSlots);
|
||||||
|
|||||||
@@ -141,9 +141,6 @@ void SwiftGuiStd::init()
|
|||||||
ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(sGui->swiftVersionString());
|
ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(sGui->swiftVersionString());
|
||||||
ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CBuildConfig::compiledWithInfo());
|
ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CBuildConfig::compiledWithInfo());
|
||||||
|
|
||||||
// update timers
|
|
||||||
this->startUpdateTimersWhenConnected();
|
|
||||||
|
|
||||||
// do this as last statement, so it can be used as flag
|
// do this as last statement, so it can be used as flag
|
||||||
// whether init has been completed
|
// whether init has been completed
|
||||||
this->setVisible(true);
|
this->setVisible(true);
|
||||||
@@ -205,11 +202,6 @@ void SwiftGuiStd::initGuiSignals()
|
|||||||
connect(ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &SwiftGuiStd::ps_onChangedWindowOpacity);
|
connect(ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &SwiftGuiStd::ps_onChangedWindowOpacity);
|
||||||
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &SwiftGuiStd::ps_onStyleSheetsChanged);
|
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &SwiftGuiStd::ps_onStyleSheetsChanged);
|
||||||
|
|
||||||
// sliders
|
|
||||||
connect(ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedUsersUpdateInterval, ui->comp_MainInfoArea->getUserComponent(), &CUserComponent::setUpdateIntervalSeconds);
|
|
||||||
connect(ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAircraftUpdateInterval, ui->comp_MainInfoArea->getAircraftComponent(), &CAircraftComponent::setUpdateIntervalSeconds);
|
|
||||||
connect(ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAtcStationsUpdateInterval, ui->comp_MainInfoArea->getAtcStationComponent(), &::CAtcStationComponent::setUpdateIntervalSeconds);
|
|
||||||
|
|
||||||
// login
|
// login
|
||||||
connect(ui->comp_Login, &CLoginComponent::loginOrLogoffCancelled, this, &SwiftGuiStd::ps_setMainPageToInfoArea);
|
connect(ui->comp_Login, &CLoginComponent::loginOrLogoffCancelled, this, &SwiftGuiStd::ps_setMainPageToInfoArea);
|
||||||
connect(ui->comp_Login, &CLoginComponent::loginOrLogoffSuccessful, this, &SwiftGuiStd::ps_setMainPageToInfoArea);
|
connect(ui->comp_Login, &CLoginComponent::loginOrLogoffSuccessful, this, &SwiftGuiStd::ps_setMainPageToInfoArea);
|
||||||
@@ -244,24 +236,9 @@ void SwiftGuiStd::initialDataReads()
|
|||||||
CLogMessage(this).info("Initial data read");
|
CLogMessage(this).info("Initial data read");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwiftGuiStd::startUpdateTimersWhenConnected()
|
|
||||||
{
|
|
||||||
ui->comp_MainInfoArea->getAtcStationComponent()->setUpdateIntervalSeconds(ui->comp_MainInfoArea->getSettingsComponent()->getAtcUpdateIntervalSeconds());
|
|
||||||
ui->comp_MainInfoArea->getAircraftComponent()->setUpdateIntervalSeconds(ui->comp_MainInfoArea->getSettingsComponent()->getAircraftUpdateIntervalSeconds());
|
|
||||||
ui->comp_MainInfoArea->getUserComponent()->setUpdateIntervalSeconds(ui->comp_MainInfoArea->getSettingsComponent()->getUsersUpdateIntervalSeconds());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SwiftGuiStd::stopUpdateTimersWhenDisconnected()
|
|
||||||
{
|
|
||||||
ui->comp_MainInfoArea->getAtcStationComponent()->stopTimer();
|
|
||||||
ui->comp_MainInfoArea->getAircraftComponent()->stopTimer();
|
|
||||||
ui->comp_MainInfoArea->getUserComponent()->stopTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SwiftGuiStd::stopAllTimers(bool disconnectSignalSlots)
|
void SwiftGuiStd::stopAllTimers(bool disconnectSignalSlots)
|
||||||
{
|
{
|
||||||
this->m_timerContextWatchdog->stop();
|
this->m_timerContextWatchdog->stop();
|
||||||
this->stopUpdateTimersWhenDisconnected();
|
|
||||||
if (!disconnectSignalSlots) { return; }
|
if (!disconnectSignalSlots) { return; }
|
||||||
this->disconnect(this->m_timerContextWatchdog);
|
this->disconnect(this->m_timerContextWatchdog);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user