Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
IFactoryBase.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3#pragma once
4
5#include <PhosphorRegistry/phosphorregistry_export.h>
6
7#include <QString>
8#include <QStringList>
9#include <QtCore/qtclasshelpermacros.h> // Q_DISABLE_COPY_MOVE
10
11namespace PhosphorRegistry {
12
13// Common base for every factory interface registered with a Registry<T>.
14//
15// id() is the stable lookup key callers pass to Registry::factory().
16// displayName() is the human-readable label a plugin browser or
17// settings UI shows. capabilities() is the metadata slot for the
18// Phase-5 sandbox; today it is advisory only (no enforcement), but
19// every factory ships with the list so the enforcement layer can be
20// added without an ABI break.
21//
22// All five UI-seam interfaces (IBarWidgetFactory,
23// IControlCenterTileFactory, ILauncherProviderFactory, IOSDFactory,
24// IDesktopWidgetFactory) inherit this base and add a single
25// surface-specific create*() method.
26class PHOSPHORREGISTRY_EXPORT IFactoryBase
27{
28public:
29 IFactoryBase() = default;
30 virtual ~IFactoryBase() = default;
31 Q_DISABLE_COPY_MOVE(IFactoryBase)
32
33 // Stable identifier for this factory. Used by the registry as the
34 // lookup key. Examples are "clock", "control-center.network",
35 // "launcher.calculator". Convention: lowercase ASCII + dot
36 // namespace separators. Two factories registering the same id is
37 // rejected by Registry::registerFactory.
38 [[nodiscard]] virtual QString id() const = 0;
39
40 // Human-readable label for plugin browsers / settings UIs. May be
41 // translated by the factory implementation.
42 [[nodiscard]] virtual QString displayName() const = 0;
43
44 // Declared capabilities, declared by the factory a plugin hands out
45 // or hardcoded for built-ins. Standard names follow the
46 // dot-namespaced convention documented in the design docs
47 // (`bar.widget`, `control-center.tile`, `network.read`,
48 // `notify.send`, etc.). Enforcement is deferred to Phase 5; today
49 // the list is informational.
50 //
51 // Defaulted to an empty list rather than pure-virtual: the five
52 // UI-seam plugin factories override it with the capabilities their
53 // plugins declare, but the domain registries unified onto Registry<T>
54 // (shader packs, animation effects, easing curves, tiling
55 // algorithms, layout sources) carry no capability metadata and
56 // should not have to fabricate an override returning `{}`. The
57 // advisory contract is unchanged — an entry that declares nothing
58 // simply declares nothing.
59 [[nodiscard]] virtual QStringList capabilities() const
60 {
61 return {};
62 }
63};
64
65} // namespace PhosphorRegistry
virtual QString id() const =0
virtual QString displayName() const =0
virtual ~IFactoryBase()=default
virtual QStringList capabilities() const
Definition IFactoryBase.h:59
Definition IBarWidgetFactory.h:16