pPauseAction_->setCheckable(true);
connect(pPauseAction_,SIGNAL(toggled(bool)),this,SLOT(pause(bool)));
- connect(&deviceInfo_,SIGNAL(lockStatusChanged(bool)),this,SLOT(handleDeviceLocked(bool)));
+
+ deviceLockPollTimer_.setInterval(20*60); // 2s
+ connect(&deviceLockPollTimer_,SIGNAL(timeout()),this,SLOT(pollDeviceLocked()));
+ deviceLockPollTimer_.start();
autopauseTimer.setSingleShot(true);
pPausetextItem_->hide();
autopauseTimer.start(); //Start counting towards autopause
+ deviceLockPollTimer_.start(); //Start polling whether device is locked
}
else
// else qDebug() << "No pause text available";
autopauseTimer.stop(); //No need to count toward autopause when already paused
+ deviceLockPollTimer_.stop(); //No need to check for unlock as no unpause anyway
}
}
pPauseAction_->setChecked(true);
}
}
+
+void SeaScene::pollDeviceLocked()
+{
+
+ bool locked = deviceInfo_.isDeviceLocked();
+
+ if (locked)
+ {
+ if (!alreadyLocked_)
+ {
+ pPauseAction_->setChecked(true);
+ alreadyLocked_ = true;
+ }
+
+ else
+ {
+ alreadyLocked_ = false;
+ }
+ }
+}
void vibrationActivated(bool on);
void minimizeRequested();
void fullscreenRequested();
+ void deviceJustLocked();
public slots:
void handleDeviceLocked(bool isLocked);
+ void pollDeviceLocked();
+
protected:
QSystemDeviceInfo deviceInfo_;
+ bool alreadyLocked_;
+
+ QTimer deviceLockPollTimer_;
+
};
#endif // SEASCENE_H