File indexing completed on 2024-05-12 04:45:57

0001 /*
0002     SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 
0011 class LockBackend : public QObject
0012 {
0013 public:
0014     explicit LockBackend(QObject *parent = nullptr) : QObject(parent)
0015     {}
0016     ~LockBackend() override = default;
0017     virtual void setInhibitionOn(const QString &explanation) = 0;
0018     virtual void setInhibitionOff() = 0;
0019 };
0020 
0021 class LockManager : public QObject
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit LockManager(QObject *parent = nullptr);
0027     ~LockManager() override;
0028 
0029 public Q_SLOTS:
0030     /** Toggle screen lock inhibition.
0031      *  @param explanation A human-readable explanation on why the screen lock is inhibited.
0032      *  (not used on all platforms).
0033      */
0034     void toggleInhibitScreenLock(const QString &explanation);
0035     void setInhibitionOff();
0036     void setInhibitionOn(const QString &explanation);
0037 
0038 private:
0039 
0040     LockBackend *m_backend;
0041     bool m_inhibit;
0042 };