Qx v0.5.7
Qt Extensions Library
Loading...
Searching...
No Matches
qx-desktopentry.h
1#ifndef QX_DESKTOP_ENTRY_H
2#define QX_DESKTOP_ENTRY_H
3
4// Shared Lib Support
5#include "qx/linux/qx_linux_export.h"
6
7// Qt Includes
8#include <QString>
9#include <QUrl>
10
11// Extra-component Includes
12#include "qx/io/qx-ioopreport.h"
13
14namespace Qx
15{
16
17/* TODO: Don't use values that were not explicitly set by the user when writing or converting to a string.
18 * This is already the case for strings/string lists, can be enabled by an internal/public std::optional for
19 * booleans.
20 */
21
22class QX_LINUX_EXPORT DesktopEntry
23{
24//-Class Members----------------------------------------------------------------------------------------------------
25private:
26 static inline const QString MAIN_GROUP = u"[Desktop Entry]"_s;
27
28//-Instance Members-------------------------------------------------------------------------------------------------
29private:
30 QString mName;
31 QString mGenericName;
32 bool mNoDisplay;
33 QString mComment;
34 QString mIcon;
35 bool mHidden;
36 QStringList mOnlyShowIn;
37 QStringList mNotShowIn;
38
39//-Constructor-------------------------------------------------------------------------------------------------------
40protected:
42
43//-Destructor-------------------------------------------------------------------------------------------------------
44public:
45 virtual ~DesktopEntry() = default;
46
47//-Class Functions----------------------------------------------------------------------------------------------
48protected:
49 static QString keyValueString(const QString& key, bool value);
50 static QString keyValueString(const QString& key, const char* value);
51 static QString keyValueString(const QString& key, const QString& value);
52 static QString keyValueString(const QString& key, const QStringList& value);
53
54public:
55 static IoOpReport writeToDisk(QString path, const DesktopEntry* entry);
56
57//-Instance Functions----------------------------------------------------------------------------------------------
58public:
59 virtual QString type() const = 0;
60 virtual QString extension() const = 0;
61 virtual QString toString() const;
62
63 QString name() const;
64 QString genericName() const;
65 bool isNoDisplay() const;
66 QString comment() const;
67 QString icon() const;
68 bool isHidden() const;
69 QStringList onlyShowIn() const;
70 QStringList notShowIn() const;
71
72 void setName(const QString& name);
73 void setGenericName(const QString& name);
74 void setNoDisplay(bool display);
75 void setComment(const QString& comment);
76 void setIcon(const QString& icon);
77 void setHidden(bool hidden);
78 void setOnlyShowIn(const QStringList& showIn);
79 void setNotShowIn(const QStringList& notIn);
80};
81
82}
83
84#endif // QX_DESKTOP_ENTRY_H
The DesktopEntry class provides the base functionality common to all Linux desktop entry files.
Definition qx-desktopentry.h:23
virtual QString type() const =0
virtual QString extension() const =0
The IoOpReport class is a container for details regarding the outcome of an IO operation.
Definition qx-ioopreport.h:53
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5