Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
CompositeLayoutSource.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <phosphorlayoutapi_export.h>
7
9
10#include <QHash>
11#include <QVector>
12
13#include <utility>
14
15namespace PhosphorLayout {
16
38class PHOSPHORLAYOUTAPI_EXPORT CompositeLayoutSource : public ILayoutSource
39{
40 Q_OBJECT
41public:
42 explicit CompositeLayoutSource(QObject* parent = nullptr);
44
49 void addSource(ILayoutSource* source);
50
58
64 void setSources(QVector<ILayoutSource*> sources);
65
70
78
79 QVector<LayoutPreview> availableLayouts() const override;
80
81 LayoutPreview previewAt(const QString& id, int windowCount = DefaultPreviewWindowCount,
82 const QSize& canvas = {}) override;
83
84private:
89 void connectSource(ILayoutSource* source);
90
94 void disconnectSource(ILayoutSource* source);
95
96 QVector<ILayoutSource*> m_sources;
97
102 QHash<ILayoutSource*, std::pair<QMetaObject::Connection, QMetaObject::Connection>> m_connections;
103};
104
105} // namespace PhosphorLayout
Aggregates multiple ILayoutSource implementations behind one ILayoutSource interface.
Definition CompositeLayoutSource.h:39
void clearSources()
Drop every child source (without deleting — sources are borrowed).
QVector< LayoutPreview > availableLayouts() const override
Enumerate every layout this source can render.
void setSources(QVector< ILayoutSource * > sources)
Replace the child-source set in one shot.
void addSource(ILayoutSource *source)
Append a child source to the aggregation.
void removeSource(ILayoutSource *source)
Remove source from the aggregation.
void clearSourcesSilent()
Drop every child source WITHOUT emitting contentsChanged.
LayoutPreview previewAt(const QString &id, int windowCount=DefaultPreviewWindowCount, const QSize &canvas={}) override
Produce a fully-realised preview for one layout entry.
CompositeLayoutSource(QObject *parent=nullptr)
Abstract producer of LayoutPreview values.
Definition ILayoutSource.h:48
Definition AlgorithmMetadata.h:10
Renderer-ready snapshot of one layout entry (manual zone layout OR autotile algorithm result).
Definition LayoutPreview.h:44