Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
AutotileLayoutSource.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 <phosphortiles_export.h>
7
8// Back-compat include: previewFromAlgorithm(...) used to be declared here;
9// it now lives in AutotilePreviewRender.h. Keep the include so existing
10// consumers that only included <PhosphorTiles/AutotileLayoutSource.h>
11// continue to pick up the free functions without modification.
13
16
17#include <QHash>
18#include <QMutex>
19#include <QStringList>
20
21namespace PhosphorTiles {
22class ITileAlgorithmRegistry;
23class TilingAlgorithm;
24} // namespace PhosphorTiles
25
26namespace PhosphorTiles {
27
46class PHOSPHORTILES_EXPORT AutotileLayoutSource : public PhosphorLayout::ILayoutSource
47{
48 Q_OBJECT
49public:
54 explicit AutotileLayoutSource(PhosphorTiles::ITileAlgorithmRegistry* registry, QObject* parent = nullptr);
56
57 QVector<PhosphorLayout::LayoutPreview> availableLayouts() const override;
58
66 const QSize& canvas = {}) override;
67
72
73private:
76 void insertCacheEntry(const QString& key, const PhosphorLayout::LayoutPreview& preview) const;
77
81 mutable QHash<QString, PhosphorLayout::LayoutPreview> m_cache;
83 mutable QStringList m_cacheOrder;
89 mutable QMutex m_cacheMutex;
90};
91
92} // namespace PhosphorTiles
Abstract producer of LayoutPreview values.
Definition ILayoutSource.h:48
ILayoutSource adapter wrapping an ITileAlgorithmRegistry.
Definition AutotileLayoutSource.h:47
QVector< PhosphorLayout::LayoutPreview > availableLayouts() const override
Enumerate every layout this source can render.
PhosphorLayout::LayoutPreview previewAt(const QString &id, int windowCount=PhosphorLayout::DefaultPreviewWindowCount, const QSize &canvas={}) override
id must be in the form "autotile:<algorithmId>" — returns an empty preview otherwise.
void invalidateCache()
Drop any cached previews — next query re-runs the algorithms.
AutotileLayoutSource(PhosphorTiles::ITileAlgorithmRegistry *registry, QObject *parent=nullptr)
Construct over a borrowed algorithm registry.
Abstract contract for a tiling-algorithm registry.
Definition ITileAlgorithmRegistry.h:41
constexpr int DefaultPreviewWindowCount
Reference window count used by ILayoutSource::previewAt when the caller doesn't specify one.
Definition LayoutPreview.h:20
Definition AutotileEngine.h:71
Renderer-ready snapshot of one layout entry (manual zone layout OR autotile algorithm result).
Definition LayoutPreview.h:44