13#include <QtConcurrentRun>
43 for (
const auto& list : Items_)
45 const auto pos = std::find_if (list.begin (), list.end (),
46 [&
id] (
const Item_ptr&
item) { return item->GetPermanentID () == id; });
47 if (
pos != list.end ())
64 auto& map =
result [pair.first];
66 map [
item->GetPermanentID ()] =
item;
86 QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
91 return info.isDir () ?
112 catch (
const std::exception&
e)
121 if (!
item->IsValid ())
129 for (
const auto&
cat :
item->GetCategories ())
151 std::back_inserter (
Added_));
164 template<
typename Container>
167 return { std::forward<Container> (
oldCont), std::forward<Container> (
newCont) };
225 return QtConcurrent::run (Merge, Items_,
result);
227 [
this] (
const std::optional<Cat2Items_t>&
result)
static Item_ptr FromDesktopFile(const QString &file)
Loads the XDG .desktop item from file.
bool IsReady() const
Checks whether this items finder is ready.
ItemsFinder(const ICoreProxy_ptr &, const QList< Type > &types, QObject *parent=nullptr)
Constructs the items finder for the given types.
Item_ptr FindItem(const QString &permanentID) const
Finds an XDG item for the given permanent ID.
void itemsListChanged()
Notifies when the list of items changes in any way.
Cat2Items_t GetItems() const
Returns the categorized list of XDG items.
QList< QNetworkCookie > Added_
QList< QNetworkCookie > Removed_
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
std::decay_t< T > Intersection_
QHash< QString, QList< Item_ptr > > Cat2Items_t
std::shared_ptr< Item > Item_ptr
QStringList ToPaths(const QList< Type > &types)
Returns a set of typical directories with desktop files of the given types.
auto Stlize(Assoc &&assoc) noexcept
Converts an Qt's associative sequence assoc to an STL-like iteratable range.
Container< T > Filter(const Container< T > &c, F f)
auto ConcatMap(Cont &&c, F &&f)
decltype(auto) Sorted(Cont &&cont)
void swap(FDGuard &g1, FDGuard &g2)