mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
It appears that the screen rotation DBus API was dropped with https://invent.kde.org/plasma/kscreen/-/merge_requests/237 Port to the new API. Fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/257
34 lines
850 B
C++
34 lines
850 B
C++
// SPDX-FileCopyrightText: 2022-2023 Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QOrientationSensor>
|
|
|
|
#include <kscreen/config.h>
|
|
|
|
class ScreenRotationUtil : public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(bool autoScreenRotationEnabled READ autoScreenRotationEnabled WRITE setAutoScreenRotationEnabled NOTIFY autoScreenRotationEnabledChanged);
|
|
Q_PROPERTY(bool available READ isAvailable NOTIFY availableChanged);
|
|
|
|
public:
|
|
ScreenRotationUtil(QObject *parent = nullptr);
|
|
|
|
bool autoScreenRotationEnabled();
|
|
void setAutoScreenRotationEnabled(bool value);
|
|
|
|
bool isAvailable();
|
|
|
|
Q_SIGNALS:
|
|
void autoScreenRotationEnabledChanged();
|
|
void availableChanged();
|
|
|
|
private:
|
|
KScreen::ConfigPtr m_config;
|
|
QOrientationSensor *m_sensor;
|
|
|
|
bool m_available;
|
|
};
|