LeechCraft  0.6.70-3565-g2d86529
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #pragma once
31 
32 #include <memory>
33 #include <QHash>
34 #include <QDebug>
35 #include <QIcon>
37 #include "xdgconfig.h"
38 #include "itemtypes.h"
39 
40 namespace LeechCraft
41 {
42 namespace Util
43 {
44 namespace XDG
45 {
46  class Item;
47 
48  using Item_ptr = std::shared_ptr<Item>;
49 
60  {
61  QHash<QString, QString> Name_;
62  QHash<QString, QString> GenericName_;
63  QHash<QString, QString> Comments_;
64 
65  QStringList Categories_;
66  QString Command_;
67  QString WD_;
68 
69  QString IconName_;
70  QIcon Icon_;
71 
72  bool IsHidden_;
73  Type Type_;
74  public:
84  friend UTIL_XDG_API bool operator== (const Item& left, const Item& right);
85 
92  bool IsValid () const;
93 
101  bool IsHidden () const;
102 
112  void Execute (ICoreProxy_ptr proxy) const;
113 
123  QString GetName (const QString& language) const;
124 
135  QString GetGenericName (const QString& language) const;
136 
145  QString GetComment (const QString& language) const;
146 
156  QString GetIconName () const;
157 
162  QStringList GetCategories () const;
163 
168  Type GetType () const;
169 
180  QString GetCommand () const;
181 
192  QString GetWorkingDirectory () const;
193 
201  QString GetPermanentID () const;
202 
216  void SetIcon (const QIcon& icon);
217 
234  QIcon GetIcon () const;
235 
245  QDebug DebugPrint (QDebug stream) const;
246 
256  static Item_ptr FromDesktopFile (const QString& file);
257  };
258 
268  QDebug operator<< (QDebug debug, const Item& item);
269 }
270 }
271 }
std::string Name_
class UTIL_XDG_API Item
Definition: itemsfinder.h:44
std::shared_ptr< Item > Item_ptr
Definition: item.h:48
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Definition: icoreproxy.h:225
Describes a single XDG .desktop entry.
Definition: item.h:59
bool operator==(const Item &left, const Item &right)
Definition: item.cpp:45
Type
Describes the various types of XDG .desktop files.
Definition: itemtypes.h:49
#define UTIL_XDG_API
Definition: xdgconfig.h:37
QDebug operator<<(QDebug dbg, const Item &item)
Serializes item contents to the debugging stream.
Definition: item.cpp:234