7#include "phosphorscreenscore_export.h"
32 static constexpr int DefaultMaxScreensPerPhysical = 8;
36 , m_maxScreensPerPhysical(DefaultMaxScreensPerPhysical)
45 , m_maxScreensPerPhysical(maxScreensPerPhysical)
49 QHash<QString, VirtualScreenConfig>
loadAll()
const override
56 return m_configs.value(physicalScreenId);
62 return remove(physicalScreenId);
70 if (!VirtualScreenConfig::isValid(config, physicalScreenId, m_maxScreensPerPhysical)) {
73 const auto it = m_configs.constFind(physicalScreenId);
81 if (it != m_configs.constEnd() && it.value() == config) {
84 m_configs.insert(physicalScreenId, config);
89 bool remove(
const QString& physicalScreenId)
override
91 if (m_configs.remove(physicalScreenId) > 0) {
98 QHash<QString, VirtualScreenConfig> m_configs;
99 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
bool remove(const QString &physicalScreenId) override
Drop the entry for physicalScreenId.
Definition InMemoryConfigStore.h:89
InMemoryConfigStore(QObject *parent=nullptr)
Definition InMemoryConfigStore.h:34
bool save(const QString &physicalScreenId, const VirtualScreenConfig &config) override
Persist config for physicalScreenId.
Definition InMemoryConfigStore.h:59
QHash< QString, VirtualScreenConfig > loadAll() const override
Snapshot every persisted virtual-screen config, keyed by physical screen ID.
Definition InMemoryConfigStore.h:49
InMemoryConfigStore(int maxScreensPerPhysical, QObject *parent=nullptr)
Construct with an explicit maximum-virtual-screens-per-physical cap.
Definition InMemoryConfigStore.h:43
VirtualScreenConfig get(const QString &physicalScreenId) const override
Single-key read for callers that only need one entry (e.g.
Definition InMemoryConfigStore.h:54
Definition IWindowTrackingService.h:26
Configuration for how a physical screen is subdivided into virtual screens.
Definition VirtualScreen.h:124
bool isEmpty() const
Definition VirtualScreen.h:132