mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +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::vitalityLost, this, &CLoginAdvComponent::autoLogoffDetection, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CLoginAdvComponent::onSimulatorStatusChanged, 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
|
// inital setup, if data already available
|
||||||
@@ -341,6 +342,22 @@ namespace BlackGui
|
|||||||
emit this->requestLoginPage();
|
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()
|
bool CLoginAdvComponent::updateOwnAircraftCallsignAndPilotFromGuiValues()
|
||||||
{
|
{
|
||||||
if (!this->hasValidContexts()) { return false; }
|
if (!this->hasValidContexts()) { return false; }
|
||||||
|
|||||||
@@ -127,6 +127,9 @@ namespace BlackGui
|
|||||||
//! Auto-logoff detection
|
//! Auto-logoff detection
|
||||||
void autoLogoffDetection();
|
void autoLogoffDetection();
|
||||||
|
|
||||||
|
//! Logoff due to insufficient simulator frame rate
|
||||||
|
void autoLogoffFrameRate(bool fatal);
|
||||||
|
|
||||||
//! Pause/Continue timeout
|
//! Pause/Continue timeout
|
||||||
void toggleTimeout();
|
void toggleTimeout();
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ namespace BlackGui
|
|||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::ownAircraftModelChanged, this, &CLoginComponent::onSimulatorModelChanged, Qt::QueuedConnection);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::ownAircraftModelChanged, this, &CLoginComponent::onSimulatorModelChanged, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::vitalityLost, this, &CLoginComponent::autoLogoffDetection, Qt::QueuedConnection);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::vitalityLost, this, &CLoginComponent::autoLogoffDetection, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CLoginComponent::onSimulatorStatusChanged, Qt::QueuedConnection);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CLoginComponent::onSimulatorStatusChanged, Qt::QueuedConnection);
|
||||||
|
connect(sGui->getIContextSimulator(), &IContextSimulator::insufficientFrameRateDetected, this, &CLoginComponent::autoLogoffFrameRate, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sGui && sGui->getIContextNetwork())
|
if (sGui && sGui->getIContextNetwork())
|
||||||
@@ -722,6 +723,23 @@ namespace BlackGui
|
|||||||
emit this->requestLoginPage();
|
emit this->requestLoginPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CLoginComponent::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));
|
||||||
|
if (fatal) { this->setLogoffCountdown(delaySecs); }
|
||||||
|
|
||||||
|
emit this->requestLoginPage();
|
||||||
|
}
|
||||||
|
|
||||||
void CLoginComponent::lookupOwnAircraftModel()
|
void CLoginComponent::lookupOwnAircraftModel()
|
||||||
{
|
{
|
||||||
if (!this->hasValidContexts()) { return; }
|
if (!this->hasValidContexts()) { return; }
|
||||||
|
|||||||
@@ -182,6 +182,9 @@ namespace BlackGui
|
|||||||
//! Auto-logoff detection
|
//! Auto-logoff detection
|
||||||
void autoLogoffDetection();
|
void autoLogoffDetection();
|
||||||
|
|
||||||
|
//! Logoff due to insufficient simulator frame rate
|
||||||
|
void autoLogoffFrameRate(bool fatal);
|
||||||
|
|
||||||
//! Lookup own model
|
//! Lookup own model
|
||||||
void lookupOwnAircraftModel();
|
void lookupOwnAircraftModel();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user