2019-09-16 18:35:51 +02:00
|
|
|
#include "common/Version.hpp"
|
|
|
|
|
|
|
|
#include "common/Modes.hpp"
|
|
|
|
|
2021-08-21 14:16:00 +02:00
|
|
|
#include <QFileInfo>
|
|
|
|
|
2019-09-16 18:35:51 +02:00
|
|
|
#define UGLYMACROHACK1(s) #s
|
|
|
|
#define FROM_EXTERNAL_DEFINE(s) UGLYMACROHACK1(s)
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
Version::Version()
|
|
|
|
{
|
|
|
|
this->version_ = CHATTERINO_VERSION;
|
|
|
|
|
|
|
|
this->commitHash_ =
|
|
|
|
QString(FROM_EXTERNAL_DEFINE(CHATTERINO_GIT_HASH)).remove('"');
|
|
|
|
|
2022-01-07 17:25:57 +01:00
|
|
|
// Date of build file generation (≈ date of build)
|
|
|
|
#ifdef CHATTERINO_CMAKE_GEN_DATE
|
2019-09-16 18:35:51 +02:00
|
|
|
this->dateOfBuild_ =
|
2022-01-07 17:25:57 +01:00
|
|
|
QString(FROM_EXTERNAL_DEFINE(CHATTERINO_CMAKE_GEN_DATE)).remove('"');
|
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_;
|
2020-08-24 12:02:56 +02:00
|
|
|
|
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
|
|
|
this->isSupportedOS_ = true;
|
|
|
|
#else
|
|
|
|
this->isSupportedOS_ = false;
|
|
|
|
#endif
|
2019-09-16 18:35:51 +02:00
|
|
|
}
|
|
|
|
|
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_;
|
|
|
|
}
|
|
|
|
|
2020-08-24 12:02:56 +02:00
|
|
|
const bool &Version::isSupportedOS() const
|
|
|
|
{
|
|
|
|
return this->isSupportedOS_;
|
|
|
|
}
|
|
|
|
|
2021-08-21 13:00:01 +02:00
|
|
|
bool Version::isFlatpak() const
|
|
|
|
{
|
|
|
|
return QFileInfo::exists("/.flatpak-info");
|
|
|
|
}
|
|
|
|
|
2019-09-16 18:35:51 +02:00
|
|
|
} // namespace chatterino
|