Chatterino
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Version.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QString>
4 #include <QtGlobal>
5 
6 #define CHATTERINO_VERSION "2.4.0-beta"
7 
8 #if defined(Q_OS_WIN)
9 # define CHATTERINO_OS "win"
10 #elif defined(Q_OS_MACOS)
11 # define CHATTERINO_OS "macos"
12 #elif defined(Q_OS_LINUX)
13 # define CHATTERINO_OS "linux"
14 #elif defined(Q_OS_FREEBSD)
15 # define CHATTERINO_OS "freebsd"
16 #else
17 # define CHATTERINO_OS "unknown"
18 #endif
19 
20 namespace chatterino {
21 
22 class Version
23 {
24 public:
25  static const Version &instance();
26 
27  const QString &version() const;
28  const QString &commitHash() const;
29  // Whether or not the vcs tree had any changes at the time of build
30  const bool &isModified() const;
31  // Date of build file generation (≈ date of build)
32  const QString &dateOfBuild() const;
33  // "Full" version string, as displayed in window title
34  const QString &fullVersion() const;
35  const bool &isSupportedOS() const;
36  bool isFlatpak() const;
37 
38  // Returns a list of tags for this build, e.g. what compiler was used, what Qt version etc
39  QStringList buildTags() const;
40 
41  // Returns a string containing build information of this Chatterino binary
42  const QString &buildString() const;
43 
44  // Returns a string about the current running system
45  const QString &runningString() const;
46 
47 private:
48  Version();
49 
50  QString version_;
51  QString commitHash_;
52  bool isModified_{false};
53  QString dateOfBuild_;
54  QString fullVersion_;
55  bool isSupportedOS_;
56 
57  QString buildString_;
58  // Generate a build string (e.g. Chatterino 2.3.5 (commit ...)) and store it in buildString_ for future use
59  void generateBuildString();
60 
61  QString runningString_;
62  // Generate a running string (e.g. Running on Arch Linux, kernel 5.14.3) and store it in runningString_ for future use
63  void generateRunningString();
64 };
65 
66 }; // namespace chatterino
const QString & fullVersion() const
Definition: Version.cpp:61
const QString & runningString() const
Definition: Version.cpp:112
bool isFlatpak() const
Definition: Version.cpp:86
const QString & version() const
Definition: Version.cpp:56
QStringList buildTags() const
Definition: Version.cpp:91
Definition: Application.cpp:48
static const Version & instance()
Definition: Version.cpp:50
Definition: Version.hpp:22
const QString & buildString() const
Definition: Version.cpp:107
const bool & isSupportedOS() const
Definition: Version.cpp:81
const QString & commitHash() const
Definition: Version.cpp:66
const QString & dateOfBuild() const
Definition: Version.cpp:76
const bool & isModified() const
Definition: Version.cpp:71