2023-11-05 23:09:33 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022-2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2022-03-17 04:33:13 +00:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
2023-11-05 23:09:33 +00:00
|
|
|
#include <QOrientationSensor>
|
2022-03-17 04:33:13 +00:00
|
|
|
|
2023-11-05 23:09:33 +00:00
|
|
|
#include <kscreen/config.h>
|
2022-03-17 04:33:13 +00:00
|
|
|
|
|
|
|
|
class ScreenRotationUtil : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2023-11-05 23:09:33 +00:00
|
|
|
Q_PROPERTY(bool autoScreenRotationEnabled READ autoScreenRotationEnabled WRITE setAutoScreenRotationEnabled NOTIFY autoScreenRotationEnabledChanged);
|
2023-02-10 07:00:45 +00:00
|
|
|
Q_PROPERTY(bool available READ isAvailable NOTIFY availableChanged);
|
2022-03-17 04:33:13 +00:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ScreenRotationUtil(QObject *parent = nullptr);
|
|
|
|
|
|
2023-11-05 23:09:33 +00:00
|
|
|
bool autoScreenRotationEnabled();
|
|
|
|
|
void setAutoScreenRotationEnabled(bool value);
|
2022-03-17 04:33:13 +00:00
|
|
|
|
2022-10-04 15:09:18 +00:00
|
|
|
bool isAvailable();
|
|
|
|
|
|
2022-03-17 04:33:13 +00:00
|
|
|
Q_SIGNALS:
|
2023-11-05 23:09:33 +00:00
|
|
|
void autoScreenRotationEnabledChanged();
|
|
|
|
|
void availableChanged();
|
2022-03-17 04:33:13 +00:00
|
|
|
|
|
|
|
|
private:
|
2023-11-05 23:09:33 +00:00
|
|
|
KScreen::ConfigPtr m_config;
|
|
|
|
|
QOrientationSensor *m_sensor;
|
2023-02-10 07:00:45 +00:00
|
|
|
|
|
|
|
|
bool m_available;
|
2022-03-17 04:33:13 +00:00
|
|
|
};
|