2022-03-17 04:07:29 +00:00
|
|
|
/*
|
|
|
|
|
* SPDX-FileCopyrightText: 2022 by Devin Lin <devin@kde.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
class FlashlightUtil : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
Q_PROPERTY(bool torchEnabled READ torchEnabled NOTIFY torchChanged);
|
2022-07-06 23:15:01 +00:00
|
|
|
Q_PROPERTY(bool available READ isAvailable CONSTANT);
|
2022-03-17 04:07:29 +00:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
FlashlightUtil(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE void toggleTorch();
|
|
|
|
|
bool torchEnabled() const;
|
2022-07-06 23:15:01 +00:00
|
|
|
bool isAvailable() const;
|
2022-03-17 04:07:29 +00:00
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
|
void torchChanged(bool value);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool m_torchEnabled;
|
|
|
|
|
};
|