7#include "phosphorscreenscore_export.h"
32 static constexpr int DefaultMaxScreensPerPhysical = 8;
39 explicit InMemoryConfigStore(
int maxScreensPerPhysical = DefaultMaxScreensPerPhysical, QObject* parent =
nullptr)
41 , m_maxScreensPerPhysical(maxScreensPerPhysical)
45 QHash<QString, VirtualScreenConfig>
loadAll()
const override
52 return m_configs.value(physicalScreenId);
58 return remove(physicalScreenId);
66 if (!VirtualScreenConfig::isValid(config, physicalScreenId, m_maxScreensPerPhysical)) {
69 const auto it = m_configs.constFind(physicalScreenId);
77 if (it != m_configs.constEnd() && it.value() == config) {
80 m_configs.insert(physicalScreenId, config);
85 bool remove(
const QString& physicalScreenId)
override
87 if (m_configs.remove(physicalScreenId) > 0) {
94 QHash<QString, VirtualScreenConfig> m_configs;
95 int m_maxScreensPerPhysical;
Pluggable persistence for virtual-screen configurations.
Definition IConfigStore.h:37
Trivial IConfigStore that holds its state in process memory.
Definition InMemoryConfigStore.h:22
VirtualScreenConfig get(const QString &physicalScreenId) const override
Single-key read for callers that only need one entry (e.g.
Definition InMemoryConfigStore.h:50
bool remove(const QString &physicalScreenId) override
Drop the entry for physicalScreenId.
Definition InMemoryConfigStore.h:85
InMemoryConfigStore(int maxScreensPerPhysical=DefaultMaxScreensPerPhysical, QObject *parent=nullptr)
Construct with an optional maximum-virtual-screens-per-physical cap.
Definition InMemoryConfigStore.h:39
QHash< QString, VirtualScreenConfig > loadAll() const override
Snapshot every persisted virtual-screen config, keyed by physical screen ID.
Definition InMemoryConfigStore.h:45
bool save(const QString &physicalScreenId, const VirtualScreenConfig &config) override
Persist config for physicalScreenId.
Definition InMemoryConfigStore.h:55
Definition IWindowTrackingService.h:27
Configuration for how a physical screen is subdivided into virtual screens.
Definition VirtualScreen.h:124
bool isEmpty() const
Definition VirtualScreen.h:132