Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorShellLauncher::LauncherModel Class Reference

#include <PhosphorShellLauncher/LauncherModel.h>

Inheritance diagram for PhosphorShellLauncher::LauncherModel:
[legend]

Public Types

enum  Role {
  TitleRole = Qt::UserRole + 1 , SubtitleRole , IconNameRole , ProviderIdRole ,
  ProviderNameRole , ProviderIconRole , ResultIdRole , PrimaryActionLabelRole ,
  AlternateActionLabelRole , HasAlternateActionRole , ScoreRole
}

Signals

void queryChanged ()
void activeChanged ()
void providerFilterChanged ()
void countChanged ()
void providersChanged ()

Public Member Functions

 LauncherModel (QObject *parent=nullptr)
 ~LauncherModel () override
void addProvider (PhosphorRegistry::ILauncherProvider *provider)
QList< PhosphorRegistry::ILauncherProvider * > providerObjects () const
QString query () const
void setQuery (const QString &query)
bool active () const
 Whether the surface showing this model is on screen.
void setActive (bool active)
QString providerFilter () const
void setProviderFilter (const QString &providerId)
void cycleProviderFilter (int direction)
QVariantList providers () const
int rowCount (const QModelIndex &parent=QModelIndex()) const override
QVariant data (const QModelIndex &index, int role) const override
QHash< int, QByteArray > roleNames () const override
bool activate (int row, bool alternate=false)
bool alternateIsRepeatable (int row) const
 Whether row's ALTERNATE action can sensibly be repeated on the same list, which is what decides whether the surface closes after it.

Member Enumeration Documentation

◆ Role

Enumerator
TitleRole 
SubtitleRole 
IconNameRole 
ProviderIdRole 
ProviderNameRole 
ProviderIconRole 
ResultIdRole 
PrimaryActionLabelRole 
AlternateActionLabelRole 
HasAlternateActionRole 
ScoreRole 

Constructor & Destructor Documentation

◆ LauncherModel()

PhosphorShellLauncher::LauncherModel::LauncherModel ( QObject * parent = nullptr)
explicit

◆ ~LauncherModel()

PhosphorShellLauncher::LauncherModel::~LauncherModel ( )
override

Member Function Documentation

◆ activate()

bool PhosphorShellLauncher::LauncherModel::activate ( int row,
bool alternate = false )
nodiscard

◆ active()

bool PhosphorShellLauncher::LauncherModel::active ( ) const
nodiscard

Whether the surface showing this model is on screen.

Providers stay subscribed to their sources for the whole session, because a launcher that rescanned on open would be slow exactly when the user is waiting. That means every clipboard copy and every window opening drives a recompute, and each one used to rebuild the model too: a full reset, destroying every delegate, for a surface nobody is looking at. While inactive the rebuild is deferred, and one runs when the surface comes back.

Defaults to true, so a host that never sets it behaves as before.

◆ activeChanged

void PhosphorShellLauncher::LauncherModel::activeChanged ( )
signal

◆ addProvider()

void PhosphorShellLauncher::LauncherModel::addProvider ( PhosphorRegistry::ILauncherProvider * provider)

◆ alternateIsRepeatable()

bool PhosphorShellLauncher::LauncherModel::alternateIsRepeatable ( int row) const
nodiscard

Whether row's ALTERNATE action can sensibly be repeated on the same list, which is what decides whether the surface closes after it.

The clipboard's remove is the case this exists for: pruning history is something a user does several times in a row, and closing after the first meant reopening and retyping to remove the second. False for a row out of range, and irrelevant to the primary action, which always finishes the interaction.

◆ countChanged

void PhosphorShellLauncher::LauncherModel::countChanged ( )
signal

◆ cycleProviderFilter()

void PhosphorShellLauncher::LauncherModel::cycleProviderFilter ( int direction)

◆ data()

QVariant PhosphorShellLauncher::LauncherModel::data ( const QModelIndex & index,
int role ) const
nodiscardoverride

◆ providerFilter()

QString PhosphorShellLauncher::LauncherModel::providerFilter ( ) const
nodiscard

◆ providerFilterChanged

void PhosphorShellLauncher::LauncherModel::providerFilterChanged ( )
signal

◆ providerObjects()

QList< PhosphorRegistry::ILauncherProvider * > PhosphorShellLauncher::LauncherModel::providerObjects ( ) const
nodiscard

◆ providers()

QVariantList PhosphorShellLauncher::LauncherModel::providers ( ) const
nodiscard

◆ providersChanged

void PhosphorShellLauncher::LauncherModel::providersChanged ( )
signal

◆ query()

QString PhosphorShellLauncher::LauncherModel::query ( ) const
nodiscard

◆ queryChanged

void PhosphorShellLauncher::LauncherModel::queryChanged ( )
signal

◆ roleNames()

QHash< int, QByteArray > PhosphorShellLauncher::LauncherModel::roleNames ( ) const
nodiscardoverride

◆ rowCount()

int PhosphorShellLauncher::LauncherModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
nodiscardoverride

◆ setActive()

void PhosphorShellLauncher::LauncherModel::setActive ( bool active)

◆ setProviderFilter()

void PhosphorShellLauncher::LauncherModel::setProviderFilter ( const QString & providerId)

◆ setQuery()

void PhosphorShellLauncher::LauncherModel::setQuery ( const QString & query)

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