2019-09-16 18:35:51 +02:00
|
|
|
#include "common/Version.hpp"
|
|
|
|
|
|
|
|
#include "common/Modes.hpp"
|
|
|
|
|
|
|
|
#define UGLYMACROHACK1(s) #s
|
|
|
|
#define FROM_EXTERNAL_DEFINE(s) UGLYMACROHACK1(s)
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
Version::Version()
|
|
|
|
{
|
|
|
|
// Version
|
|
|
|
this->version_ = CHATTERINO_VERSION;
|
|
|
|
|
|
|
|
// Commit hash
|
|
|
|
this->commitHash_ =
|
|
|
|
QString(FROM_EXTERNAL_DEFINE(CHATTERINO_GIT_HASH)).remove('"');
|
|
|
|
|
2019-09-21 20:24:52 +02:00
|
|
|
// Date of build, this is depended on the format not changing
|
2019-09-16 18:35:51 +02:00
|
|
|
#ifdef CHATTERINO_NIGHTLY_VERSION_STRING
|
|
|
|
this->dateOfBuild_ =
|
|
|
|
QString(FROM_EXTERNAL_DEFINE(CHATTERINO_NIGHTLY_VERSION_STRING))
|
2019-09-22 16:59:51 +02:00
|
|
|
.remove('"')
|
|
|
|
.split(' ')[0];
|
2019-09-16 18:35:51 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// "Full" version string, as displayed in window title
|
|
|
|
this->fullVersion_ = "Chatterino ";
|
2019-10-07 22:42:34 +02:00
|
|
|
if (Modes::instance().isNightly)
|
2019-09-16 18:35:51 +02:00
|
|
|
{
|
|
|
|
this->fullVersion_ += "Nightly ";
|
|
|
|
}
|
|
|
|
|
|
|
|
this->fullVersion_ += this->version_;
|
|
|
|
}
|
|
|
|
|
2019-10-07 22:42:34 +02:00
|
|
|
const Version &Version::instance()
|
2019-09-16 18:35:51 +02:00
|
|
|
{
|
|
|
|
static Version instance;
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2019-10-07 22:32:11 +02:00
|
|
|
const QString &Version::version() const
|
2019-09-16 18:35:51 +02:00
|
|
|
{
|
|
|
|
return this->version_;
|
|
|
|
}
|
|
|
|
|
2019-10-07 22:32:11 +02:00
|
|
|
const QString &Version::fullVersion() const
|
2019-09-16 18:35:51 +02:00
|
|
|
{
|
|
|
|
return this->fullVersion_;
|
|
|
|
}
|
|
|
|
|
2019-10-07 22:32:11 +02:00
|
|
|
const QString &Version::commitHash() const
|
2019-09-16 18:35:51 +02:00
|
|
|
{
|
|
|
|
return this->commitHash_;
|
|
|
|
}
|
|
|
|
|
2019-10-07 22:32:11 +02:00
|
|
|
const QString &Version::dateOfBuild() const
|
2019-09-16 18:35:51 +02:00
|
|
|
{
|
|
|
|
return this->dateOfBuild_;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|