Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
ILauncherProviderFactory.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
7#include <PhosphorRegistry/phosphorregistry_export.h>
8
9#include <QtCore/qtclasshelpermacros.h>
10
11QT_BEGIN_NAMESPACE
12class QObject;
13QT_END_NAMESPACE
14
15namespace PhosphorRegistry {
16
17// Factory for one query-answering provider inside the spotlight-style
18// launcher (apps from .desktop files, calculator, window switcher,
19// emoji, clipboard, command runner).
20//
21// Unlike the visual factories (IBarWidgetFactory, IControlCenterTileFactory),
22// a launcher provider is a pure data source: it accepts a query
23// string and returns matching results. The launcher's UI is owned
24// by the launcher surface itself; providers contribute rows.
25//
26// Phase 1.3 shipped this returning a bare QObject* because the provider
27// contract was not yet locked. Phase 4.2 locked it as ILauncherProvider
28// (query in, rows out; see ILauncherProvider.h), and createProvider now
29// returns that type directly, so the surface needs no qobject_cast and a
30// factory cannot hand back something that is not a provider.
31class PHOSPHORREGISTRY_EXPORT ILauncherProviderFactory : public IFactoryBase
32{
33public:
35 ~ILauncherProviderFactory() override = default;
36 Q_DISABLE_COPY_MOVE(ILauncherProviderFactory)
37
38 // Construct a provider rooted at parent. Same lifetime contract as
39 // the visual factories: parent owns, factory does not retain.
40 // Returning nullptr means "unavailable in this environment" (no
41 // clipboard service, no foreign-toplevel support) and is not an
42 // error; the surface simply has one provider fewer.
43 // ABI NOTE. This signature returned QObject* before the launcher
44 // surface existed, and narrowing it to ILauncherProvider* changed the
45 // vtable slot's type before any external ABI contract existed. That is
46 // safe only because no plugin implements this interface yet: it has never
47 // shipped in a release, and the one in-tree implementation is rebuilt with
48 // the library. Once launcher providers load as plugins, their seam's
49 // ApiVersion binds this signature, and any change to it needs a bump.
50 [[nodiscard]] virtual ILauncherProvider* createProvider(QObject* parent) = 0;
51};
52
53} // namespace PhosphorRegistry
virtual ILauncherProvider * createProvider(QObject *parent)=0
Definition ILauncherProvider.h:106
Definition IBarWidgetFactory.h:16