connect(pPauseAction_,SIGNAL(toggled(bool)),this,SLOT(pause(bool)));
+ deviceLockPollTimer_.setInterval(20*60); // 2s
+ connect(&deviceLockPollTimer_,SIGNAL(timeout()),this,SLOT(pollDeviceLocked()));
+ deviceLockPollTimer_.start();
+
+
autopauseTimer.setSingleShot(true);
autopauseTimer.setInterval(15*60*1000);
- connect(&autopauseTimer,SIGNAL(timeout()),this,SLOT(forcePause()));
+ connect(&autopauseTimer,SIGNAL(timeout()),this,SLOT(turnPauseOn()));
}
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
}
}
prepareForMenu(pRestartLevelItem_);
pSettingsItem_ = new QGraphicsTextItem;
- QString vibraText(tr("Vibration <br> effects "));
+ QString vibraText(tr("Turn vibration <br> effects "));
QString statusText;
if (pVibrateAction_->isChecked())
{
pVictoryCongratulationsItem_ = new QGraphicsTextItem;
pVictoryCongratulationsItem_->setHtml("<font size=\"6\" color = darkorange> Victory!");
pVictoryCongratulationsItem_->hide();
- pVictoryCongratulationsItem_->setPos(300,50);
+ pVictoryCongratulationsItem_->setPos(355,50);
pVictoryCongratulationsItem_->setZValue(1000);
addItem(pVictoryCongratulationsItem_);
pVictoryCongratulationsItem_ = NULL;
}
+
+void SeaScene::turnPauseOn()
+{
+ pPauseAction_->setChecked(true);
+}
+
+void SeaScene::handleDeviceLocked(bool isLocked)
+{
+ //pauses if locked but does not unpause if unlocked
+ if(isLocked)
+ {
+ pPauseAction_->setChecked(true);
+ }
+}
+
+void SeaScene::pollDeviceLocked()
+{
+
+ bool locked = deviceInfo_.isDeviceLocked();
+
+ if (locked)
+ {
+ if (!alreadyLocked_)
+ {
+ pPauseAction_->setChecked(true);
+ alreadyLocked_ = true;
+ }
+
+ else
+ {
+ alreadyLocked_ = false;
+ }
+ }
+}