EstervQrCode 1.1.1
Library for qr code manipulation
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 #include <QtCore/QtGlobal>
12 #if defined(WINDOWS_ABOUT)
13 #define ABOUT_EXPORT Q_DECL_EXPORT
14 #else
15 #define ABOUT_EXPORT Q_DECL_IMPORT
16 #endif
17 
18 namespace esterv::CustomControls {
19 
20 class ABOUT_EXPORT AboutThis : public QObject {
21  QString m_version;
22  QString m_name;
23  const QString m_buildArch;
24  const QDateTime m_buildTime;
25  static AboutThis *m_instance;
26 
27  Q_OBJECT
28 #if defined(USE_QML)
29  Q_PROPERTY(QString version READ version WRITE setVersion NOTIFY changed)
30  Q_PROPERTY(QString name MEMBER m_name NOTIFY changed)
31  Q_PROPERTY(QString buildArch READ buildArch CONSTANT)
32  Q_PROPERTY(QDateTime buildTime READ buildTime CONSTANT)
33  QML_ELEMENT
34  QML_SINGLETON
35 #endif
36 
37  AboutThis(QObject *parent = nullptr);
38 
39 public:
40  static AboutThis *instance() {
41  if (!m_instance) {
42  m_instance = new AboutThis();
43  }
44  return m_instance;
45  };
46 #if defined(USE_QML)
47  static AboutThis *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine) {
48  return instance();
49  }
50 #endif
51  QString version() const { return m_version; }
52  QString name() const { return m_name; }
53  QString buildArch() const { return m_buildArch; }
54  QDateTime buildTime() const { return m_buildTime; }
55 
56  void setName(const QString name) {
57  if (name != m_name) {
58  m_name = name;
59  emit changed();
60  }
61  }
62  void setVersion(const QString version) {
63  if (version != m_version) {
64  m_version = version;
65  emit changed();
66  }
67  }
68 
69 signals:
70  void changed();
71 };
72 
73 }; // namespace esterv::CustomControls
Definition: about.hpp:20
QString version() const
Definition: about.hpp:51
QString buildArch() const
Definition: about.hpp:53
void setName(const QString name)
Definition: about.hpp:56
QDateTime buildTime() const
Definition: about.hpp:54
static AboutThis * instance()
Definition: about.hpp:40
QString name() const
Definition: about.hpp:52
void setVersion(const QString version)
Definition: about.hpp:62
void * parent
Definition: core_c.h:1913
Definition: about.cpp:3