Shutdown timer changes (#2084)
* change msg popup time from 10min to 30min * countdown at half time * simplify math * move shutdown after checks
This commit is contained in:
parent
3365e0461c
commit
d82564d84c
2 changed files with 7 additions and 3 deletions
|
@ -599,6 +599,7 @@ void Servatrice::scheduleShutdown(const QString &reason, int minutes)
|
|||
{
|
||||
shutdownReason = reason;
|
||||
shutdownMinutes = minutes + 1;
|
||||
nextShutdownMessageMinutes = shutdownMinutes;
|
||||
if (minutes > 0) {
|
||||
shutdownTimer = new QTimer;
|
||||
connect(shutdownTimer, SIGNAL(timeout()), this, SLOT(shutdownTimeout()));
|
||||
|
@ -623,10 +624,11 @@ void Servatrice::incRxBytes(quint64 num)
|
|||
|
||||
void Servatrice::shutdownTimeout()
|
||||
{
|
||||
--shutdownMinutes;
|
||||
// Show every time counter cut in half & every minute for last 5 minutes
|
||||
if (shutdownMinutes <= 5 || shutdownMinutes == nextShutdownMessageMinutes) {
|
||||
if (shutdownMinutes == nextShutdownMessageMinutes)
|
||||
nextShutdownMessageMinutes = shutdownMinutes / 2;
|
||||
|
||||
if (shutdownMinutes <= 5 || isFirstShutdownMessage || shutdownMinutes % 10 == 0) {
|
||||
isFirstShutdownMessage = false;
|
||||
SessionEvent *se;
|
||||
if (shutdownMinutes) {
|
||||
Event_ServerShutdown event;
|
||||
|
@ -648,6 +650,7 @@ void Servatrice::shutdownTimeout()
|
|||
if (!shutdownMinutes)
|
||||
deleteLater();
|
||||
}
|
||||
shutdownMinutes--;
|
||||
}
|
||||
|
||||
bool Servatrice::islConnectionExists(int serverId) const
|
||||
|
|
|
@ -139,6 +139,7 @@ private:
|
|||
|
||||
QString shutdownReason;
|
||||
int shutdownMinutes;
|
||||
int nextShutdownMessageMinutes;
|
||||
QTimer *shutdownTimer;
|
||||
bool isFirstShutdownMessage, clientIdRequired, regServerOnly;
|
||||
|
||||
|
|
Loading…
Reference in a new issue