shift-shell/initialstart/devicecontext.h
Marco Allegretti 42d41351e2 Add profile-aware initial setup
Detect the device class, stage the selected experience, and write the resulting setup choices through SetupState.

Load the new device and experience modules before the existing setup pages, and use the Shift icon on the finished page.
2026-05-11 10:03:07 +02:00

57 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;
};