KWin
Loading...
Searching...
No Matches
Classes | Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
KWin::EffectsModel Class Reference

#include <effectsmodel.h>

Inheritance diagram for KWin::EffectsModel:
KWin::AnimationsModel

Classes

struct  EffectData
 

Public Types

enum  AdditionalRoles {
  NameRole = Qt::UserRole + 1 , DescriptionRole , AuthorNameRole , AuthorEmailRole ,
  LicenseRole , VersionRole , CategoryRole , ServiceNameRole ,
  IconNameRole , StatusRole , VideoRole , WebsiteRole ,
  SupportedRole , ExclusiveRole , InternalRole , ConfigurableRole ,
  EnabledByDefaultRole , ConfigModuleRole , EnabledByDefaultFunctionRole
}
 
enum class  Status { Disabled = Qt::Unchecked , EnabledUndeterminded = Qt::PartiallyChecked , Enabled = Qt::Checked }
 
enum class  LoadOptions { None , KeepDirty }
 

Signals

void loaded ()
 

Public Member Functions

 EffectsModel (QObject *parent=nullptr)
 
QHash< int, QByteArray > roleNames () const override
 
QModelIndex index (int row, int column, const QModelIndex &parent={}) const override
 
QModelIndex parent (const QModelIndex &child) const override
 
int rowCount (const QModelIndex &parent={}) const override
 
int columnCount (const QModelIndex &parent={}) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
void updateEffectStatus (const QModelIndex &rowIndex, Status effectState)
 
void load (LoadOptions options=LoadOptions::None)
 
void save ()
 
void defaults ()
 
bool isDefaults () const
 
bool needsSave () const
 
QModelIndex findByPluginId (const QString &pluginId) const
 
void requestConfigure (const QModelIndex &index, QWindow *transientParent)
 

Protected Member Functions

virtual bool shouldStore (const EffectData &data) const
 

Detailed Description

Definition at line 25 of file effectsmodel.h.

Member Enumeration Documentation

◆ AdditionalRoles

This enum type is used to specify data roles.

Enumerator
NameRole 

The user-friendly name of the effect.

DescriptionRole 

The description of the effect.

AuthorNameRole 

The name of the effect's author. If there are several authors, they will be comma separated.

AuthorEmailRole 

The email of the effect's author. If there are several authors, the emails will be comma separated.

LicenseRole 

The license of the effect.

VersionRole 

The version of the effect.

CategoryRole 

The category of the effect.

ServiceNameRole 

The service name(plugin name) of the effect.

IconNameRole 

The icon name of the effect.

StatusRole 

Whether the effect is enabled or disabled.

VideoRole 

Link to a video demonstration of the effect.

WebsiteRole 

Link to the home page of the effect.

SupportedRole 

Whether the effect is supported.

ExclusiveRole 

The exclusive group of the effect.

InternalRole 

Whether the effect is internal.

ConfigurableRole 

Whether the effect has a KCM.

EnabledByDefaultRole 

Whether the effect is enabled by default.

ConfigModuleRole 

Id of the effect's config module, empty if the effect has no config.

EnabledByDefaultFunctionRole 

Whether the effect has a function to determine if the effect is enabled by default.

Definition at line 33 of file effectsmodel.h.

◆ LoadOptions

This enum type is used to specify load options.

Enumerator
None 
KeepDirty 

Do not discard unsaved changes when reloading the model.

Definition at line 157 of file effectsmodel.h.

◆ Status

enum class KWin::EffectsModel::Status
strong

This enum type is used to specify the status of a given effect.

Enumerator
Disabled 

The effect is disabled.

EnabledUndeterminded 

An enable function is used to determine whether the effect is enabled. For example, such function can be useful to disable the blur effect when running in a virtual machine.

Enabled 

The effect is enabled.

Definition at line 117 of file effectsmodel.h.

Constructor & Destructor Documentation

◆ EffectsModel()

KWin::EffectsModel::EffectsModel ( QObject * parent = nullptr)
explicit

Definition at line 69 of file effectsmodel.cpp.

Member Function Documentation

◆ columnCount()

int KWin::EffectsModel::columnCount ( const QModelIndex & parent = {}) const
override

Definition at line 112 of file effectsmodel.cpp.

◆ data()

QVariant KWin::EffectsModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
override

Definition at line 125 of file effectsmodel.cpp.

◆ defaults()

void KWin::EffectsModel::defaults ( )

Resets the status of each effect to the default state.

Note
In order to actually apply the change, you have to call save().

Definition at line 541 of file effectsmodel.cpp.

◆ findByPluginId()

QModelIndex KWin::EffectsModel::findByPluginId ( const QString & pluginId) const

Finds an effect with the given plugin id.

Definition at line 574 of file effectsmodel.cpp.

◆ index()

QModelIndex KWin::EffectsModel::index ( int row,
int column,
const QModelIndex & parent = {} ) const
override

Definition at line 98 of file effectsmodel.cpp.

◆ isDefaults()

bool KWin::EffectsModel::isDefaults ( ) const

Whether the status of each effect is its default state.

Definition at line 553 of file effectsmodel.cpp.

◆ load()

void KWin::EffectsModel::load ( LoadOptions options = LoadOptions::None)

Loads effects.

You have to call this method in order to populate the model.

Definition at line 377 of file effectsmodel.cpp.

◆ loaded

void KWin::EffectsModel::loaded ( )
signal

This signal is emitted when the model is loaded or reloaded.

See also
load

◆ needsSave()

bool KWin::EffectsModel::needsSave ( ) const

Whether the model has unsaved changes.

Definition at line 566 of file effectsmodel.cpp.

◆ parent()

QModelIndex KWin::EffectsModel::parent ( const QModelIndex & child) const
override

Definition at line 107 of file effectsmodel.cpp.

◆ requestConfigure()

void KWin::EffectsModel::requestConfigure ( const QModelIndex & index,
QWindow * transientParent )

Shows a configuration dialog for a given effect.

Parameters
indexAn effect represented by the given index.
transientParentThe transient parent of the configuration dialog.

Definition at line 586 of file effectsmodel.cpp.

◆ roleNames()

QHash< int, QByteArray > KWin::EffectsModel::roleNames ( ) const
override

Definition at line 74 of file effectsmodel.cpp.

◆ rowCount()

int KWin::EffectsModel::rowCount ( const QModelIndex & parent = {}) const
override

Definition at line 117 of file effectsmodel.cpp.

◆ save()

void KWin::EffectsModel::save ( )

Saves status of each modified effect.

Definition at line 484 of file effectsmodel.cpp.

◆ setData()

bool KWin::EffectsModel::setData ( const QModelIndex & index,
const QVariant & value,
int role = Qt::EditRole )
override

Definition at line 177 of file effectsmodel.cpp.

◆ shouldStore()

bool KWin::EffectsModel::shouldStore ( const EffectData & data) const
protectedvirtual

Returns whether the given effect should be stored in the model.

Parameters
dataThe effect.
Returns
true if the effect should be stored, otherwise false.

Reimplemented in KWin::AnimationsModel.

Definition at line 603 of file effectsmodel.cpp.

◆ updateEffectStatus()

void KWin::EffectsModel::updateEffectStatus ( const QModelIndex & rowIndex,
Status effectState )

Changes the status of a given effect.

Parameters
rowIndexAn effect represented by the given index.
effectStateThe new state.
Note
In order to actually apply the change, you have to call save().

Definition at line 479 of file effectsmodel.cpp.


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