Ref T420, logoff countdown time configurable

This commit is contained in:
Klaus Basan
2018-10-31 15:33:04 +01:00
parent 699684bce0
commit 6755fd68dc
2 changed files with 20 additions and 6 deletions

View File

@@ -77,8 +77,7 @@ namespace BlackGui
{
ui->setupUi(this);
m_logoffCountdownTimer.setObjectName("CLoginComponent:m_logoffCountdownTimer");
ui->pb_LogoffTimeout->setMaximum(LogoffIntervalSeconds);
ui->pb_LogoffTimeout->setValue(LogoffIntervalSeconds);
this->setLogoffCountdown();
connect(&m_logoffCountdownTimer, &QTimer::timeout, this, &CLoginComponent::logoffCountdown);
ui->tw_Network->setCurrentIndex(0);
@@ -205,6 +204,15 @@ namespace BlackGui
}
}
void CLoginComponent::setLogoffCountdown(int timeout)
{
if (timeout < 0) { timeout = LogoffIntervalSeconds; }
ui->pb_LogoffTimeout->setMaximum(timeout);
ui->pb_LogoffTimeout->setValue(timeout);
m_logoffIntervalSeconds = timeout;
}
void CLoginComponent::loginCancelled()
{
m_logoffCountdownTimer.stop();
@@ -450,8 +458,8 @@ namespace BlackGui
void CLoginComponent::startLogoffTimerCountdown()
{
ui->pb_LogoffTimeout->setValue(LogoffIntervalSeconds);
m_logoffCountdownTimer.setInterval(1000);
ui->pb_LogoffTimeout->setValue(m_logoffIntervalSeconds);
m_logoffCountdownTimer.setInterval(m_logoffIntervalSeconds * 1000 / 10);
m_logoffCountdownTimer.start();
}

View File

@@ -81,6 +81,9 @@ namespace BlackGui
//! Main info area changed
void mainInfoAreaChanged(const QWidget *currentWidget);
//! Set a logoof time
void setLogoffCountdown(int timeout = -1);
signals:
//! Login
void loginOrLogoffSuccessful();
@@ -216,7 +219,9 @@ namespace BlackGui
//! Has contexts?
bool hasValidContexts();
static const int OverlayMessageMs = 5000;
static constexpr int OverlayMessageMs = 5000;
static constexpr int LogoffIntervalSeconds = 20; //!< time before logoff
QScopedPointer<Ui::CLoginComponent> ui;
QScopedPointer<CDbQuickMappingWizard> m_mappingWizard;
BlackMisc::CDigestSignal m_changedLoginDataDigestSignal { this, &CLoginComponent::loginDataChangedDigest, 1500, 10 };
@@ -225,8 +230,9 @@ namespace BlackGui
bool m_updatePilotOnServerChanges = true;
const QIcon m_iconPlay {":/famfamfam/icons/famfamfam/icons/silk/control_play_blue.png"};
const QIcon m_iconPause {":/famfamfam/icons/famfamfam/icons/silk/control_pause_blue.png"};
const int LogoffIntervalSeconds = 20; //!< time before logoff
int m_logoffIntervalSeconds = LogoffIntervalSeconds;
QTimer m_logoffCountdownTimer; //!< timer for logoff countdown
BlackMisc::CData<BlackMisc::Simulation::Data::TLastModel> m_lastAircraftModel { this }; //!< recently used aircraft model
BlackCore::Data::CNetworkSetup m_networkSetup; //!< servers last used
};