diff options
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-screensaver')
3 files changed, 20 insertions, 23 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp index cdcf2434..0ff70142 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp @@ -10,17 +10,15 @@ #include <unistd.h> #define NUMTRIES 3 -//#define WAITMINS 1 #define DEBUG 1 LLockScreen::LLockScreen(QWidget *parent) : QWidget(parent), ui(new Ui::LLockScreen()){ ui->setupUi(this); waittime = new QTimer(this); - //waittime->setInterval(WAITMINS*60000); //(too many attempts in short time) waittime->setSingleShot(true); refreshtime = new QTimer(this); //timer to update the wait time display refreshtime->setInterval(6000); //6 seconds (1/10 second) - + connect(ui->tool_unlock, SIGNAL(clicked()), this, SLOT(TryUnlock()) ); connect(ui->line_password, SIGNAL(returnPressed()), this, SLOT(TryUnlock()) ); connect(ui->line_password, SIGNAL(textEdited(QString)), this, SIGNAL(InputDetected()) ); @@ -30,7 +28,7 @@ LLockScreen::LLockScreen(QWidget *parent) : QWidget(parent), ui(new Ui::LLockScr } LLockScreen::~LLockScreen(){ - + } void LLockScreen::LoadSystemDetails(){ @@ -47,7 +45,7 @@ void LLockScreen::aboutToHide(){ ui->line_password->clear(); ui->line_password->clearFocus(); if(refreshtime->isActive()){ refreshtime->stop(); } -} +} void LLockScreen::aboutToShow(){ if(!waittime->isActive()){ @@ -61,21 +59,17 @@ void LLockScreen::aboutToShow(){ UpdateLockInfo(); ui->line_password->clear(); ui->line_password->setFocus(); -} +} // ================= // PRIVATE SLOTS // ================= void LLockScreen::UpdateLockInfo(){ QString info; - /*if(triesleft>0 && triesleft<NUMTRIES ){ - if(triesleft==1){info = tr("1 Attempt Left"); } - else{info = QString(tr("%1 Attempts Left")).arg(QString::number(triesleft)); } - }else*/ - if(waittime->isActive()){ + if(waittime->isActive()){ info = tr("Too Many Failures")+"\n"+ QString(tr("Wait %1 Minutes")).arg( QString::number(qRound(waittime->remainingTime()/6000.0)/10.0) ); }else if(attempts>0){ info.append("\n"+QString(tr("Failed Attempts: %1")).arg(QString::number(attempts)) ); } - ui->label_info->setText(info); + ui->label_info->setText(info); } void LLockScreen::TryUnlock(){ @@ -89,11 +83,11 @@ void LLockScreen::TryUnlock(){ this->setEnabled(true); }else{ triesleft--; - if(triesleft>0){ + if(triesleft>0){ this->setEnabled(true); - }else{ + }else{ waittime->setInterval( (attempts/NUMTRIES)*60000); - waittime->start(); + waittime->start(); refreshtime->start(); } ui->line_password->setFocus(); diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp index 3dcbf85e..9f280a47 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp @@ -17,7 +17,7 @@ LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::Windo locktimer->setSingleShot(true); hidetimer = new QTimer(this); hidetimer->setSingleShot(true); - + LOCKER = new LLockScreen(this); LOCKER->hide(); settings = new QSettings("lumina-desktop","lumina-screensaver",this); @@ -33,7 +33,7 @@ LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::Windo } LScreenSaver::~LScreenSaver(){ - + } bool LScreenSaver::isLocked(){ @@ -66,7 +66,7 @@ void LScreenSaver::reloadSettings(){ hidetimer->setInterval( settings->value("hidesecs",15).toInt() * 1000 ); } -void LScreenSaver::newInputEvent(){ +void LScreenSaver::newInputEvent(){ if(updating){ return; } //in the middle of making changes which could cause an event if(DEBUG){ qDebug() << "New Input Event"; } if(SSRunning && SSLocked){ @@ -79,7 +79,6 @@ void LScreenSaver::newInputEvent(){ HideScreenSaver(); } UpdateTimers(); - } void LScreenSaver::LockScreenNow(){ @@ -119,7 +118,7 @@ void LScreenSaver::ShowScreenSaver(){ if(!this->isActiveWindow()){ this->raise(); this->show(); - this->activateWindow(); + this->activateWindow(); } for(int i=0; i<BASES.length(); i++){ BASES[i]->show(); @@ -149,10 +148,11 @@ void LScreenSaver::HideScreenSaver(){ if(!SSLocked){ this->hide(); emit ClosingScreenSaver(); + emit LockStatusChanged(false); } - for(int i=0; i<BASES.length(); i++){ + for(int i=0; i<BASES.length(); i++){ BASES[i]->hide(); - BASES[i]->stopPainting(); + BASES[i]->stopPainting(); } UpdateTimers(); } @@ -171,6 +171,7 @@ void LScreenSaver::LockScreen(){ if(SSLocked){ return; } if(DEBUG){ qDebug() << "Locking Screen:" << QDateTime::currentDateTime().toString(); } SSLocked = true; + emit LockStatusChanged(true); LOCKER->LoadSystemDetails(); UpdateTimers(); } @@ -178,6 +179,7 @@ void LScreenSaver::LockScreen(){ void LScreenSaver::SSFinished(){ if(DEBUG){ qDebug() << "Screensaver Finished:" << QDateTime::currentDateTime().toString(); } SSLocked = false; + emit LockStatusChanged(false); HideLockScreen(); HideScreenSaver(); } diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h index d27db37e..18f12fab 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h @@ -19,7 +19,7 @@ public: ~LScreenSaver(); bool isLocked(); - + private: QTimer *starttimer, *locktimer, *hidetimer; QSettings *settings; @@ -48,6 +48,7 @@ private slots: signals: void StartingScreenSaver(); void ClosingScreenSaver(); + void LockStatusChanged(bool locked); protected: void mouseMoveEvent(QMouseEvent*){ |