mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Ref T556, FP related fixes
* myself guard * improved overlay messages * removed redundant constexpr.
This commit is contained in:
committed by
Mat Sutcliffe
parent
503bbf3a26
commit
1055c0fb17
@@ -156,6 +156,7 @@ namespace BlackCore
|
||||
CFlightPlan CAirspaceMonitor::loadFlightPlanFromNetwork(const CCallsign &callsign)
|
||||
{
|
||||
CFlightPlan plan;
|
||||
QPointer<CAirspaceMonitor> myself(this);
|
||||
|
||||
// use cache, but not for own callsign (always reload)
|
||||
if (m_flightPlanCache.contains(callsign)) { plan = m_flightPlanCache[callsign]; }
|
||||
@@ -167,12 +168,12 @@ namespace BlackCore
|
||||
// with this little trick we try to make an asynchronous signal / slot
|
||||
// based approach a synchronous return value
|
||||
const QTime waitForFlightPlan = QTime::currentTime().addMSecs(1000);
|
||||
while (QTime::currentTime() < waitForFlightPlan)
|
||||
while (sApp && QTime::currentTime() < waitForFlightPlan)
|
||||
{
|
||||
// process some other events and hope network answer is received already
|
||||
// CEventLoop::processEventsUntil cannot be used, as a received flight plan might be for another callsign
|
||||
sApp->processEventsFor(100);
|
||||
if (!sApp || sApp->isShuttingDown()) { return CFlightPlan(); }
|
||||
if (!myself || !sApp || sApp->isShuttingDown()) { return CFlightPlan(); }
|
||||
if (m_flightPlanCache.contains(callsign))
|
||||
{
|
||||
plan = m_flightPlanCache[callsign];
|
||||
|
||||
@@ -447,7 +447,14 @@ namespace BlackGui
|
||||
m = CStatusMessage(this).validationError(u"No errors, but not connected, cannot send flight plan");
|
||||
}
|
||||
ui->le_LastSent->setText(lastSent);
|
||||
this->showOverlayMessage(m, OverlayMessageMs);
|
||||
if (m.isSeverityInfoOrLess())
|
||||
{
|
||||
this->showOverlayHTMLMessage(m, OverlayTimeoutMs);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->showOverlayMessage(m, OverlayTimeoutMs);
|
||||
}
|
||||
m_sentFlightPlan = flightPlan; // last valid FP
|
||||
}
|
||||
else
|
||||
@@ -496,7 +503,7 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
this->showOverlayMessages(msgs, OverlayMessageMs);
|
||||
this->showOverlayMessages(msgs, OverlayTimeoutMs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -789,7 +796,7 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
// messages
|
||||
this->showOverlayMessages(msgs, false, OverlayMessageMs);
|
||||
this->showOverlayMessages(msgs, false, OverlayTimeoutMs);
|
||||
|
||||
// copy over
|
||||
if (msgs.isSuccess())
|
||||
|
||||
@@ -73,8 +73,6 @@ namespace BlackGui
|
||||
BlackMisc::CDataReadOnly<BlackMisc::Simulation::Data::TLastModel> m_lastAircraftModel { this }; //!< recently used aircraft model
|
||||
BlackMisc::CDataReadOnly<BlackMisc::Network::Data::TLastServer> m_lastServer { this }; //!< recently used server (VATSIM, other)
|
||||
|
||||
static constexpr int OverlayMessageMs = 5000;
|
||||
|
||||
//! Validate, generates status messages
|
||||
BlackMisc::CStatusMessageList validateAndInitializeFlightPlan(BlackMisc::Aviation::CFlightPlan &fligtPlan);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user