![]() |
LeechCraft
0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
|
Finds and parses XDG .desktop
files.
More...
#include "itemsfinder.h"
Public Slots | |
void | update () |
Updates the list of items. More... | |
Signals | |
void | itemsListChanged () |
Notifies when the list of items changes in any way. More... | |
Public Member Functions | |
ItemsFinder (ICoreProxy_ptr, const QList< Type > &types, QObject *parent=nullptr) | |
Constructs the items finder for the given types. More... | |
bool | IsReady () const |
Checks whether this items finder is ready. More... | |
Cat2Items_t | GetItems () const |
Returns the categorized list of XDG items. More... | |
Item_ptr | FindItem (const QString &permanentID) const |
Finds an XDG item for the given permanent ID. More... | |
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.
Definition at line 65 of file itemsfinder.h.
LeechCraft::Util::XDG::ItemsFinder::ItemsFinder | ( | 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.
[in] | proxy | The proxy to use to get the icons of the items that were found. |
[in] | types | The item types to watch for. |
[in] | parent | The parent object of this finder. |
Definition at line 47 of file itemsfinder.cpp.
Item_ptr LeechCraft::Util::XDG::ItemsFinder::FindItem | ( | const QString & | permanentID | ) | const |
Finds an XDG item for the given permanent ID.
[in] | permanentID | The permanent ID of the item as returned by Item::GetPermanentID(). |
Definition at line 66 of file itemsfinder.cpp.
Cat2Items_t LeechCraft::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.
Definition at line 61 of file itemsfinder.cpp.
bool LeechCraft::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.
Definition at line 56 of file itemsfinder.cpp.
|
signal |
Notifies when the list of items changes in any way.
Referenced by update().
|
slot |
Updates the list of items.
If IsReady() returns false, and thus no items are known to the finder yet, this function blocks and emits itemsListChanged() before returning.
Otherwise, this function spawns an asynchronous update process.
Definition at line 240 of file itemsfinder.cpp.
References itemsListChanged().