LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
LC::Util::XDG::ItemsFinder Class Reference

Finds and parses XDG .desktop files. More...

#include "itemsfinder.h"

+ Inheritance diagram for LC::Util::XDG::ItemsFinder:
+ Collaboration diagram for LC::Util::XDG::ItemsFinder:

Signals

void itemsListChanged ()
 Notifies when the list of items changes in any way.
 

Public Member Functions

 ItemsFinder (const ICoreProxy_ptr &, const QList< Type > &types, QObject *parent=nullptr)
 Constructs the items finder for the given types.
 
bool IsReady () const
 Checks whether this items finder is ready.
 
Cat2Items_t GetItems () const
 Returns the categorized list of XDG items.
 
Item_ptr FindItem (const QString &permanentID) const
 Finds an XDG item for the given permanent ID.
 

Protected Member Functions

void Update ()
 

Detailed Description

Finds and parses XDG .desktop files.

The .desktop files are found in the directories matching the types passed to the object's constructor.

Parsing is done asynchronously in a separate thread, and the itemsListChanged() signal is emitted each time the list of files changes.

This class does not watch for changes in the said paths. Use the ItemsDatabase instead if that functionality is required.

See also
ItemsDatabase

Definition at line 40 of file itemsfinder.h.

Constructor & Destructor Documentation

◆ ItemsFinder()

LC::Util::XDG::ItemsFinder::ItemsFinder ( const ICoreProxy_ptr & proxy,
const QList< Type > & types,
QObject * parent = nullptr )

Constructs the items finder for the given types.

ToPaths() is used to get the list of directories for each of the types.

The ItemsFinder will asynchronously update itself automatically a few moments after creation and emit itemsListChanged() when the update finishes.

Parameters
[in]proxyThe proxy to use to get the icons of the items that were found.
[in]typesThe item types to watch for.
[in]parentThe parent object of this finder.

Definition at line 22 of file itemsfinder.cpp.

References Update().

+ Here is the call graph for this function:

Member Function Documentation

◆ FindItem()

Item_ptr LC::Util::XDG::ItemsFinder::FindItem ( const QString & permanentID) const

Finds an XDG item for the given permanent ID.

Parameters
[in]permanentIDThe permanent ID of the item as returned by Item::GetPermanentID().
Returns
The item matching the permanentID or a null pointer if there is no such item.

Definition at line 41 of file itemsfinder.cpp.

◆ GetItems()

Cat2Items_t LC::Util::XDG::ItemsFinder::GetItems ( ) const

Returns the categorized list of XDG items.

The returned hash contains the mapping from XDG category ID to the list of items in that category. A single item can appear in multiple categories at the same time.

If the finder is not ready (IsReady() returns false), this function returns an empty hash.

Returns
The categorized list of items.

Definition at line 36 of file itemsfinder.cpp.

◆ IsReady()

bool LC::Util::XDG::ItemsFinder::IsReady ( ) const

Checks whether this items finder is ready.

An items finder is ready if it has finished at least one search process. In other words, IsReady() returns true iff itemsListChanged() has been emitted at least once.

Returns
Whether the items finder has finished at least one items search.

Definition at line 31 of file itemsfinder.cpp.

◆ itemsListChanged

void LC::Util::XDG::ItemsFinder::itemsListChanged ( )
signal

Notifies when the list of items changes in any way.

Referenced by Update().

+ Here is the caller graph for this function:

◆ Update()

void LC::Util::XDG::ItemsFinder::Update ( )
protected

Definition at line 215 of file itemsfinder.cpp.

References itemsListChanged().

Referenced by LC::Util::XDG::ItemsDatabase::ItemsDatabase(), and ItemsFinder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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