File indexing completed on 2024-05-05 17:42:30

0001 /*
0002  * SPDX-FileCopyrightText: 2022 by Devin Lin <devin@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 
0011 class FlashlightUtil : public QObject
0012 {
0013     Q_OBJECT
0014     Q_PROPERTY(bool torchEnabled READ torchEnabled NOTIFY torchChanged);
0015     Q_PROPERTY(bool available READ isAvailable CONSTANT);
0016 
0017 public:
0018     FlashlightUtil(QObject *parent = nullptr);
0019 
0020     Q_INVOKABLE void toggleTorch();
0021     bool torchEnabled() const;
0022     bool isAvailable() const;
0023 
0024 Q_SIGNALS:
0025     void torchChanged(bool value);
0026 
0027 private:
0028     bool m_torchEnabled;
0029 };