Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorTiles::ITileAlgorithmRegistry Class Referenceabstract

Abstract contract for a tiling-algorithm registry. More...

#include <phosphor-tiles/include/PhosphorTiles/ITileAlgorithmRegistry.h>

Inheritance diagram for PhosphorTiles::ITileAlgorithmRegistry:
[legend]

Signals

void algorithmRegistered (const QString &id)
 An algorithm has been registered.
 
void algorithmUnregistered (const QString &id, bool replacing)
 An algorithm has been unregistered or is being replaced.
 
void previewParamsChanged ()
 Preview parameters changed via setPreviewParams.
 
- Signals inherited from PhosphorLayout::ILayoutSourceRegistry
void contentsChanged ()
 Emitted when the set of layouts this registry produces changes in any way that invalidates cached previews — entries added, removed, renamed, or re-parameterised.
 

Public Member Functions

 ITileAlgorithmRegistry (QObject *parent=nullptr)
 
 ~ITileAlgorithmRegistry () override
 
virtual TilingAlgorithmalgorithm (const QString &id) const =0
 Resolve an algorithm by its stable id.
 
virtual QStringList availableAlgorithms () const =0
 All registered algorithm ids, in registration order.
 
virtual QList< TilingAlgorithm * > allAlgorithms () const =0
 Every registered algorithm pointer.
 
virtual bool hasAlgorithm (const QString &id) const =0
 Whether an algorithm is registered under id.
 
virtual TilingAlgorithmdefaultAlgorithm () const =0
 Convenience: the registry's recommended default algorithm.
 
virtual QString defaultAlgorithmId () const =0
 Stable id of the registry's recommended default algorithm.
 
virtual void registerAlgorithm (const QString &id, TilingAlgorithm *algorithm)=0
 Register an algorithm under id.
 
virtual bool unregisterAlgorithm (const QString &id)=0
 Unregister and delete the algorithm with id.
 
virtual void setPreviewParams (const AlgorithmPreviewParams &params)=0
 Apply the user-configured tiling parameters.
 
virtual const AlgorithmPreviewParamspreviewParams () const noexcept=0
 The currently-configured preview parameters.
 
- Public Member Functions inherited from PhosphorLayout::ILayoutSourceRegistry
 ILayoutSourceRegistry (QObject *parent=nullptr)
 
 ~ILayoutSourceRegistry () override
 

Detailed Description

Abstract contract for a tiling-algorithm registry.

Symmetric with PhosphorZones::IZoneLayoutRegistry — the two provider libraries expose the same shape: an ILayoutSourceRegistry-derived interface plus one concrete implementation. Fixture tests stub this contract rather than the concrete AlgorithmRegistry; the upcoming AutotileLayoutSourceFactory binds to this interface so dependency injection can hand in alternative implementations (per-process instances, test fakes, future scripted-engine registries).

Inherits PhosphorLayout::ILayoutSourceRegistry for the unified contentsChanged signal that AutotileLayoutSource self-wires to invalidate its preview cache on any registry change. The three finer-grained signals declared here (algorithmRegistered, algorithmUnregistered, previewParamsChanged) stay available for callers that need to discriminate between cause types — e.g. UI code that animates only on preview-param changes.

Constructor & Destructor Documentation

◆ ITileAlgorithmRegistry()

PhosphorTiles::ITileAlgorithmRegistry::ITileAlgorithmRegistry ( QObject *  parent = nullptr)
explicit

◆ ~ITileAlgorithmRegistry()

PhosphorTiles::ITileAlgorithmRegistry::~ITileAlgorithmRegistry ( )
override

Member Function Documentation

◆ algorithm()

virtual TilingAlgorithm * PhosphorTiles::ITileAlgorithmRegistry::algorithm ( const QString &  id) const
pure virtual

Resolve an algorithm by its stable id.

Returns nullptr when no algorithm with that id is registered.

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ algorithmRegistered

void PhosphorTiles::ITileAlgorithmRegistry::algorithmRegistered ( const QString &  id)
signal

An algorithm has been registered.

On replacement (re-registration of an existing id), algorithmUnregistered(id, true) fires first, then algorithmRegistered(id). The new algorithm is already queryable via algorithm(id) when either signal fires.

◆ algorithmUnregistered

void PhosphorTiles::ITileAlgorithmRegistry::algorithmUnregistered ( const QString &  id,
bool  replacing 
)
signal

An algorithm has been unregistered or is being replaced.

replacing is true when a new algorithm has already been registered under id; false when the algorithm was explicitly removed.

◆ allAlgorithms()

virtual QList< TilingAlgorithm * > PhosphorTiles::ITileAlgorithmRegistry::allAlgorithms ( ) const
pure virtual

Every registered algorithm pointer.

Ownership stays with the registry.

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ availableAlgorithms()

virtual QStringList PhosphorTiles::ITileAlgorithmRegistry::availableAlgorithms ( ) const
pure virtual

All registered algorithm ids, in registration order.

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ defaultAlgorithm()

virtual TilingAlgorithm * PhosphorTiles::ITileAlgorithmRegistry::defaultAlgorithm ( ) const
pure virtual

Convenience: the registry's recommended default algorithm.

Resolves defaultAlgorithmId() via algorithm() and falls back to the first-registered algorithm if the configured default isn't present. Concrete registries override defaultAlgorithmId to publish their policy id; tests can override either to inject a fake.

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ defaultAlgorithmId()

virtual QString PhosphorTiles::ITileAlgorithmRegistry::defaultAlgorithmId ( ) const
pure virtual

Stable id of the registry's recommended default algorithm.

Virtual so test fakes that derive from this interface can publish their own policy id without taking on AlgorithmRegistry's concrete implementation. The concrete AlgorithmRegistry override returns "bsp"; downstream callers (settings' validate-default check, daemon's algorithm-fallback) should ask the registry rather than hard-coding the id.

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ hasAlgorithm()

virtual bool PhosphorTiles::ITileAlgorithmRegistry::hasAlgorithm ( const QString &  id) const
pure virtual

Whether an algorithm is registered under id.

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ previewParams()

virtual const AlgorithmPreviewParams & PhosphorTiles::ITileAlgorithmRegistry::previewParams ( ) const
pure virtualnoexcept

The currently-configured preview parameters.

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ previewParamsChanged

void PhosphorTiles::ITileAlgorithmRegistry::previewParamsChanged ( )
signal

Preview parameters changed via setPreviewParams.

Preview caches (e.g. AutotileLayoutSource) invalidate on this so the next preview render picks up the new master-count / split-ratio / per-algorithm saved values.

◆ registerAlgorithm()

virtual void PhosphorTiles::ITileAlgorithmRegistry::registerAlgorithm ( const QString &  id,
TilingAlgorithm algorithm 
)
pure virtual

Register an algorithm under id.

Ownership transfers to the registry. Re-registering an existing id replaces the old algorithm; algorithmUnregistered(id, replacing=true) fires before algorithmRegistered(id).

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ setPreviewParams()

virtual void PhosphorTiles::ITileAlgorithmRegistry::setPreviewParams ( const AlgorithmPreviewParams params)
pure virtual

Apply the user-configured tiling parameters.

Emits previewParamsChanged when the stored value differs from the new one; AutotileLayoutSource reacts by invalidating its preview cache.

Implemented in PhosphorTiles::AlgorithmRegistry.

◆ unregisterAlgorithm()

virtual bool PhosphorTiles::ITileAlgorithmRegistry::unregisterAlgorithm ( const QString &  id)
pure virtual

Unregister and delete the algorithm with id.

Returns true when an algorithm was found and removed.

Implemented in PhosphorTiles::AlgorithmRegistry.


The documentation for this class was generated from the following file: