mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
Avoid issues during shutdown in login component
This commit is contained in:
committed by
Roland Winklmeier
parent
4423f8503f
commit
04f99d10ac
@@ -385,6 +385,15 @@ namespace BlackGui
|
|||||||
ui->editor_Pilot->setUser(server.getUser(), true);
|
ui->editor_Pilot->setUser(server.getUser(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CLoginComponent::hasContexts()
|
||||||
|
{
|
||||||
|
if (!sApp || !sApp->supportsContexts()) { return false; }
|
||||||
|
if (!sApp->getIContextSimulator()) { return false; }
|
||||||
|
if (!sApp->getIContextNetwork()) { return false; }
|
||||||
|
if (!sApp->getIContextOwnAircraft()) { return false; }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
CLoginComponent::CGuiAircraftValues CLoginComponent::getAircraftValuesFromGui() const
|
CLoginComponent::CGuiAircraftValues CLoginComponent::getAircraftValuesFromGui() const
|
||||||
{
|
{
|
||||||
CGuiAircraftValues values;
|
CGuiAircraftValues values;
|
||||||
@@ -435,9 +444,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CLoginComponent::setOwnModelAndIcaoValues()
|
void CLoginComponent::setOwnModelAndIcaoValues()
|
||||||
{
|
{
|
||||||
Q_ASSERT(sGui->getIContextOwnAircraft());
|
if (!this->hasContexts()) { return; }
|
||||||
Q_ASSERT(sGui->getIContextSimulator());
|
|
||||||
|
|
||||||
CAircraftModel model;
|
CAircraftModel model;
|
||||||
const bool simulating = sGui->getIContextSimulator() &&
|
const bool simulating = sGui->getIContextSimulator() &&
|
||||||
(sGui->getIContextSimulator()->getSimulatorStatus() & ISimulator::Simulating);
|
(sGui->getIContextSimulator()->getSimulatorStatus() & ISimulator::Simulating);
|
||||||
@@ -505,7 +512,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
bool CLoginComponent::validateAircraftValues()
|
bool CLoginComponent::validateAircraftValues()
|
||||||
{
|
{
|
||||||
const CGuiAircraftValues values = getAircraftValuesFromGui();
|
const CGuiAircraftValues values = this->getAircraftValuesFromGui();
|
||||||
|
|
||||||
const bool validCombinedType = CAircraftIcaoCode::isValidCombinedType(values.ownAircraftCombinedType);
|
const bool validCombinedType = CAircraftIcaoCode::isValidCombinedType(values.ownAircraftCombinedType);
|
||||||
ui->lblp_AircraftCombinedType->setTicked(validCombinedType);
|
ui->lblp_AircraftCombinedType->setTicked(validCombinedType);
|
||||||
|
|||||||
@@ -201,6 +201,9 @@ namespace BlackGui
|
|||||||
//! Tab widget (server) changed
|
//! Tab widget (server) changed
|
||||||
void onServerTabWidgetChanged(int index);
|
void onServerTabWidgetChanged(int index);
|
||||||
|
|
||||||
|
//! Has contexts
|
||||||
|
bool hasContexts();
|
||||||
|
|
||||||
static const int OverlayMessageMs = 5000;
|
static const int OverlayMessageMs = 5000;
|
||||||
QScopedPointer<Ui::CLoginComponent> ui;
|
QScopedPointer<Ui::CLoginComponent> ui;
|
||||||
QScopedPointer<CDbQuickMappingWizard> m_mappingWizard;
|
QScopedPointer<CDbQuickMappingWizard> m_mappingWizard;
|
||||||
|
|||||||
Reference in New Issue
Block a user