EstervVault 1.0.0
Store encrypted data on the local system
Loading...
Searching...
No Matches
about.hpp
1#pragma once
2#include <QDateTime>
3#include <QObject>
4#include <QString>
5#include <QUrl>
6
7#if defined(USE_QML)
8#include <QtQml>
9#endif
10
11#if defined(ABOUT_SHARED)
12#include <QtCore/QtGlobal>
13#ifdef WINDOWS_EXPORT
14#define ABOUT_EXPORT Q_DECL_EXPORT
15#else
16#define ABOUT_EXPORT Q_DECL_IMPORT
17#endif
18#else
19#define ABOUT_EXPORT
20#endif
21
22namespace Esterv::Utils {
23
24class ABOUT_EXPORT AboutThis : public QObject {
25 QString m_version;
26 QString m_name;
27 const QString m_buildArch;
28 const QDateTime m_buildTime;
29 static AboutThis *m_instance;
30
31 Q_OBJECT
32#if defined(USE_QML)
33 Q_PROPERTY(QString version READ version WRITE setVersion NOTIFY changed)
34 Q_PROPERTY(QString name MEMBER m_name NOTIFY changed)
35 Q_PROPERTY(QString buildArch READ buildArch CONSTANT)
36 Q_PROPERTY(QDateTime buildTime READ buildTime CONSTANT)
37 QML_ELEMENT
38 QML_SINGLETON
39#endif
40
41 AboutThis(QObject *parent = nullptr);
42
43public:
44 static AboutThis *instance() {
45 if (!m_instance) {
46 m_instance = new AboutThis();
47 }
48 return m_instance;
49 };
50#if defined(USE_QML)
51 static AboutThis *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine) {
52 return instance();
53 }
54#endif
55 QString version() const { return m_version; }
56 QString name() const { return m_name; }
57 QString buildArch() const { return m_buildArch; }
58 QDateTime buildTime() const { return m_buildTime; }
59
60 void setName(const QString name) {
61 if (name != m_name) {
62 m_name = name;
63 emit changed();
64 }
65 }
66 void setVersion(const QString version) {
67 if (version != m_version) {
68 m_version = version;
69 emit changed();
70 }
71 }
72
73signals:
74 void changed();
75};
76
77}; // namespace Esterv::Utils
Definition about.hpp:24
QString name() const
Definition about.hpp:56
QString buildArch() const
Definition about.hpp:57
void setVersion(const QString version)
Definition about.hpp:66
void setName(const QString name)
Definition about.hpp:60
QDateTime buildTime() const
Definition about.hpp:58
QString version() const
Definition about.hpp:55
static AboutThis * instance()
Definition about.hpp:44
Definition about.hpp:22