LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
item.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <memory>
12#include <optional>
13#include <QHash>
14#include <QDebug>
15#include <QIcon>
17#include "xdgconfig.h"
18#include "itemtypes.h"
19
20namespace LC::Util::XDG
21{
22 class Item;
23
24 using Item_ptr = std::shared_ptr<Item>;
25
36 {
37 QHash<QString, QString> Name_;
38 QHash<QString, QString> GenericName_;
39 QHash<QString, QString> Comments_;
40
41 QStringList Categories_;
42 QString Command_;
43 QString WD_;
44
45 QString IconName_;
46 mutable std::optional<QIcon> Icon_;
47
48 bool IsHidden_ = false;
49 Type Type_ = Type::Other;
50 public:
60 friend UTIL_XDG_API bool operator== (const Item& left, const Item& right);
61
71 friend UTIL_XDG_API bool operator!= (const Item& left, const Item& right);
72
79 bool IsValid () const;
80
88 bool IsHidden () const;
89
99 void Execute (const ICoreProxy_ptr& proxy) const;
100
110 QString GetName (const QString& language) const;
111
122 QString GetGenericName (const QString& language) const;
123
132 QString GetComment (const QString& language) const;
133
143 QString GetIconName () const;
144
149 QStringList GetCategories () const;
150
155 Type GetType () const;
156
167 QString GetCommand () const;
168
179 QString GetWorkingDirectory () const;
180
188 QString GetPermanentID () const;
189
206 QIcon GetIcon (const ICoreProxy_ptr&) const;
207
217 QDebug DebugPrint (QDebug stream) const;
218
228 static Item_ptr FromDesktopFile (const QString& file);
229 };
230
241}
Describes a single XDG .desktop entry.
Definition item.h:36
auto operator==(const T &left, const T &right)
Definition common.h:38
std::string Name_
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Definition icoreproxy.h:181
std::shared_ptr< Item > Item_ptr
Definition item.h:24
Type
Describes the various types of XDG .desktop files.
Definition itemtypes.h:24
QDebug operator<<(QDebug dbg, const Item &item)
Serializes item contents to the debugging stream.
Definition item.cpp:239
class UTIL_XDG_API Item
Definition itemsfinder.h:19
Container< T > Filter(const Container< T > &c, F f)
Definition prelude.h:118
#define UTIL_XDG_API
Definition xdgconfig.h:16