mirror-chatterino2/src/common/Version.hpp
Kasia a7939b727f
Organized version information (#3781)
added new `GIT_MODIFIED` variable - used to determine whether the vcs tree was compiled or not at the time of building the app
added information about running in DEBUG mode which might be very helpful to determine whether one is running a DEBUG build, e.g. in the process of troubleshooting/determining crash causes

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
2022-06-04 19:00:42 +00:00

67 lines
1.8 KiB
C++

#pragma once
#include <QString>
#include <QtGlobal>
#define CHATTERINO_VERSION "2.3.5"
#if defined(Q_OS_WIN)
# define CHATTERINO_OS "win"
#elif defined(Q_OS_MACOS)
# define CHATTERINO_OS "macos"
#elif defined(Q_OS_LINUX)
# define CHATTERINO_OS "linux"
#elif defined(Q_OS_FREEBSD)
# define CHATTERINO_OS "freebsd"
#else
# define CHATTERINO_OS "unknown"
#endif
namespace chatterino {
class Version
{
public:
static const Version &instance();
const QString &version() const;
const QString &commitHash() const;
// Whether or not the vcs tree had any changes at the time of build
const bool &isModified() const;
// Date of build file generation (≈ date of build)
const QString &dateOfBuild() const;
// "Full" version string, as displayed in window title
const QString &fullVersion() const;
const bool &isSupportedOS() const;
bool isFlatpak() const;
// Returns a list of tags for this build, e.g. what compiler was used, what Qt version etc
QStringList buildTags() const;
// Returns a string containing build information of this Chatterino binary
const QString &buildString() const;
// Returns a string about the current running system
const QString &runningString() const;
private:
Version();
QString version_;
QString commitHash_;
bool isModified_{false};
QString dateOfBuild_;
QString fullVersion_;
bool isSupportedOS_;
QString buildString_;
// Generate a build string (e.g. Chatterino 2.3.5 (commit ...)) and store it in buildString_ for future use
void generateBuildString();
QString runningString_;
// Generate a running string (e.g. Running on Arch Linux, kernel 5.14.3) and store it in runningString_ for future use
void generateRunningString();
};
}; // namespace chatterino