mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-11 00:47:22 +00:00
58 lines
1.8 KiB
C
58 lines
1.8 KiB
C
|
|
// SPDX-FileCopyrightText: 2026 Marco Allegretti
|
||
|
|
// SPDX-License-Identifier: EUPL-1.2
|
||
|
|
|
||
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <QObject>
|
||
|
|
#include <QString>
|
||
|
|
#include <qqmlregistration.h>
|
||
|
|
|
||
|
|
class QQmlEngine;
|
||
|
|
class QJSEngine;
|
||
|
|
|
||
|
|
class DeviceContext : public QObject
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
QML_ELEMENT
|
||
|
|
QML_SINGLETON
|
||
|
|
|
||
|
|
Q_PROPERTY(QString runtimePlatform READ runtimePlatform CONSTANT)
|
||
|
|
Q_PROPERTY(QString recommendedDeviceClass READ recommendedDeviceClass CONSTANT)
|
||
|
|
Q_PROPERTY(QString recommendedExperienceProfile READ recommendedExperienceProfile CONSTANT)
|
||
|
|
Q_PROPERTY(bool hasTouch READ hasTouch CONSTANT)
|
||
|
|
Q_PROPERTY(bool hasKeyboard READ hasKeyboard CONSTANT)
|
||
|
|
Q_PROPERTY(bool hasMouse READ hasMouse CONSTANT)
|
||
|
|
Q_PROPERTY(bool hasBattery READ hasBattery CONSTANT)
|
||
|
|
Q_PROPERTY(int displayCount READ displayCount CONSTANT)
|
||
|
|
Q_PROPERTY(bool hasExternalDisplay READ hasExternalDisplay CONSTANT)
|
||
|
|
Q_PROPERTY(bool primaryDisplayLandscape READ primaryDisplayLandscape CONSTANT)
|
||
|
|
|
||
|
|
public:
|
||
|
|
explicit DeviceContext(QObject *parent = nullptr);
|
||
|
|
|
||
|
|
static DeviceContext *self();
|
||
|
|
static DeviceContext *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine);
|
||
|
|
|
||
|
|
QString runtimePlatform() const;
|
||
|
|
QString recommendedDeviceClass() const;
|
||
|
|
QString recommendedExperienceProfile() const;
|
||
|
|
bool hasTouch() const;
|
||
|
|
bool hasKeyboard() const;
|
||
|
|
bool hasMouse() const;
|
||
|
|
bool hasBattery() const;
|
||
|
|
int displayCount() const;
|
||
|
|
bool hasExternalDisplay() const;
|
||
|
|
bool primaryDisplayLandscape() const;
|
||
|
|
|
||
|
|
private:
|
||
|
|
QString m_runtimePlatform;
|
||
|
|
QString m_recommendedDeviceClass;
|
||
|
|
QString m_recommendedExperienceProfile;
|
||
|
|
bool m_hasTouch = false;
|
||
|
|
bool m_hasKeyboard = false;
|
||
|
|
bool m_hasMouse = false;
|
||
|
|
bool m_hasBattery = false;
|
||
|
|
int m_displayCount = 1;
|
||
|
|
bool m_primaryDisplayLandscape = false;
|
||
|
|
};
|