2019-09-08 22:27:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-10-07 18:57:33 +02:00
|
|
|
#include <QString>
|
2019-09-08 22:27:57 +02:00
|
|
|
#include <QtGlobal>
|
|
|
|
|
2022-04-05 14:11:02 +02:00
|
|
|
#define CHATTERINO_VERSION "2.3.5"
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
#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"
|
2020-08-24 12:02:56 +02:00
|
|
|
#elif defined(Q_OS_FREEBSD)
|
|
|
|
# define CHATTERINO_OS "freebsd"
|
2019-09-08 22:27:57 +02:00
|
|
|
#else
|
|
|
|
# define CHATTERINO_OS "unknown"
|
|
|
|
#endif
|
2019-09-16 18:35:51 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class Version
|
|
|
|
{
|
|
|
|
public:
|
2019-10-07 22:42:34 +02:00
|
|
|
static const Version &instance();
|
2019-09-16 18:35:51 +02:00
|
|
|
|
2019-10-07 22:29:35 +02:00
|
|
|
const QString &version() const;
|
|
|
|
const QString &commitHash() const;
|
2022-06-04 21:00:42 +02:00
|
|
|
// 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)
|
2019-10-07 22:29:35 +02:00
|
|
|
const QString &dateOfBuild() const;
|
2022-06-04 21:00:42 +02:00
|
|
|
// "Full" version string, as displayed in window title
|
2019-10-07 22:29:35 +02:00
|
|
|
const QString &fullVersion() const;
|
2020-08-24 12:02:56 +02:00
|
|
|
const bool &isSupportedOS() const;
|
2021-08-21 13:00:01 +02:00
|
|
|
bool isFlatpak() const;
|
2019-09-16 18:35:51 +02:00
|
|
|
|
2022-06-04 21:00:42 +02:00
|
|
|
// 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;
|
|
|
|
|
2019-09-16 18:35:51 +02:00
|
|
|
private:
|
|
|
|
Version();
|
|
|
|
|
|
|
|
QString version_;
|
|
|
|
QString commitHash_;
|
2022-06-04 21:00:42 +02:00
|
|
|
bool isModified_{false};
|
2019-09-16 18:35:51 +02:00
|
|
|
QString dateOfBuild_;
|
|
|
|
QString fullVersion_;
|
2020-08-24 12:02:56 +02:00
|
|
|
bool isSupportedOS_;
|
2022-06-04 21:00:42 +02:00
|
|
|
|
|
|
|
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();
|
2019-09-16 18:35:51 +02:00
|
|
|
};
|
|
|
|
|
2019-09-22 16:59:51 +02:00
|
|
|
}; // namespace chatterino
|