mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
toggle action background color when toggling flashlight
This commit is contained in:
parent
d3e03c6ca5
commit
a13831bc42
3 changed files with 10 additions and 3 deletions
|
|
@ -213,7 +213,7 @@ Item {
|
||||||
settingsModel.append({
|
settingsModel.append({
|
||||||
"text": i18n("Flashlight"),
|
"text": i18n("Flashlight"),
|
||||||
"icon": "flashlight-on",
|
"icon": "flashlight-on",
|
||||||
"enabled": false,
|
"enabled": plasmoid.nativeInterface.torchEnabled,
|
||||||
"settingsCommand": "",
|
"settingsCommand": "",
|
||||||
"toggleFunction": "toggleTorch",
|
"toggleFunction": "toggleTorch",
|
||||||
"applet": null
|
"applet": null
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,12 @@ void PhonePanel::toggleTorch()
|
||||||
write(fd, m_running ? "0" : "1", 1);
|
write(fd, m_running ? "0" : "1", 1);
|
||||||
close(fd);
|
close(fd);
|
||||||
m_running = !m_running;
|
m_running = !m_running;
|
||||||
|
Q_EMIT torchChanged(m_running);
|
||||||
|
}
|
||||||
|
bool PhonePanel::torchEnabled() const
|
||||||
|
{
|
||||||
|
return m_running;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhonePanel::autoRotate()
|
bool PhonePanel::autoRotate()
|
||||||
{
|
{
|
||||||
QDBusPendingReply<bool> reply = m_kscreenInterface->getAutoRotate();
|
QDBusPendingReply<bool> reply = m_kscreenInterface->getAutoRotate();
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class PhonePanel : public Plasma::Containment
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool autoRotateEnabled READ autoRotate WRITE setAutoRotate NOTIFY autoRotateChanged);
|
Q_PROPERTY(bool autoRotateEnabled READ autoRotate WRITE setAutoRotate NOTIFY autoRotateChanged);
|
||||||
|
Q_PROPERTY(bool torchEnabled READ torchEnabled NOTIFY torchChanged);
|
||||||
public:
|
public:
|
||||||
PhonePanel( QObject *parent, const QVariantList &args );
|
PhonePanel( QObject *parent, const QVariantList &args );
|
||||||
~PhonePanel() override;
|
~PhonePanel() override;
|
||||||
|
|
@ -44,8 +44,11 @@ public Q_SLOTS:
|
||||||
bool autoRotate();
|
bool autoRotate();
|
||||||
void setAutoRotate(bool value);
|
void setAutoRotate(bool value);
|
||||||
|
|
||||||
|
bool torchEnabled() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void autoRotateChanged(bool value);
|
void autoRotateChanged(bool value);
|
||||||
|
void torchChanged(bool value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_running = false;
|
bool m_running = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue