mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 21:35:40 +08:00
Issue #37 GUI message when FPS drops below threshold
This commit is contained in:
@@ -108,6 +108,7 @@ namespace BlackGui
|
||||
{
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::vitalityLost, this, &CLoginAdvComponent::autoLogoffDetection, Qt::QueuedConnection);
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CLoginAdvComponent::onSimulatorStatusChanged, Qt::QueuedConnection);
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::insufficientFrameRateDetected, this, &CLoginAdvComponent::autoLogoffFrameRate, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
// inital setup, if data already available
|
||||
@@ -341,6 +342,22 @@ namespace BlackGui
|
||||
emit this->requestLoginPage();
|
||||
}
|
||||
|
||||
void CLoginAdvComponent::autoLogoffFrameRate(bool fatal)
|
||||
{
|
||||
//! \fixme code duplication with function above
|
||||
if (!ui->cb_AutoLogoff->isChecked()) { return; }
|
||||
if (!this->hasValidContexts()) { return; }
|
||||
if (!sGui->getIContextNetwork()->isConnected()) { return; }
|
||||
|
||||
const auto msg = fatal
|
||||
? CStatusMessage(this, CStatusMessage::SeverityError, u"Sim frame rate too low to maintain constant simulation rate. Disconnecting to avoid disrupting the network.")
|
||||
: CStatusMessage(this, CStatusMessage::SeverityWarning, u"Sim frame rate too low to maintain constant simulation rate. Reduce graphics quality to avoid disconnection.");
|
||||
const int delaySecs = 30;
|
||||
this->showOverlayHTMLMessage(msg, qRound(1000 * delaySecs * 0.8));
|
||||
|
||||
emit this->requestLoginPage();
|
||||
}
|
||||
|
||||
bool CLoginAdvComponent::updateOwnAircraftCallsignAndPilotFromGuiValues()
|
||||
{
|
||||
if (!this->hasValidContexts()) { return false; }
|
||||
|
||||
Reference in New Issue
Block a user