ScreenLockDetector/src/screenlockdetector_base.cpp

36 lines
827 B
C++

#include "screenlockdetector_base.h"
#include <QDebug>
ScreenLockDetectorBase::ScreenLockDetectorBase(QObject *parent)
: QObject(parent)
, m_isLocked(false)
{
}
ScreenLockDetectorBase::~ScreenLockDetectorBase()
{
}
bool ScreenLockDetectorBase::isScreenLocked() const
{
return m_isLocked;
}
void ScreenLockDetectorBase::setLockState(bool locked)
{
if (m_isLocked != locked) {
m_isLocked = locked;
qDebug() << "##################################################";
qDebug() << "## Screen lock state changed:" << (locked ? "LOCKED" : "UNLOCKED");
qDebug() << "##################################################";
emit lockStateChanged(locked);
if (locked) {
emit screenLocked();
} else {
emit screenUnlocked();
}
}
}