Files
z-bar-qt/Plugins/ZShell/lidwatcher.hpp
T
AramJonghu 2920c57163
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 14s
Python / lint-format (pull_request) Successful in 21s
Python / test (pull_request) Successful in 44s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m6s
removes direct extern access, receives signal properly now, removed declaration unused method
2026-06-03 16:27:31 +02:00

45 lines
859 B
C++

#pragma once
#include <QObject>
#include <QStringList>
#include <QVariantMap>
#include <cstdint>
#include <qqmlintegration.h>
namespace ZShell {
class LidWatcher : public QObject {
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool available READ available NOTIFY availableChanged)
Q_PROPERTY(LidState state READ state NOTIFY stateChanged)
public:
enum LidState : std::uint8_t{ Opened, Closed };
Q_ENUM(LidState)
explicit LidWatcher(QObject* parent = nullptr);
[[nodiscard]] bool available() const;
[[nodiscard]] LidState state() const;
private:
void queryInitialState();
bool m_available;
LidState m_state = Opened;
void onPropertiesChanged(const QString& interface,
const QVariantMap& changed,
const QStringList& invalidated);
Q_SIGNALS:
void availableChanged();
void stateChanged();
};
} // namespace ZShell