Revamp version tagging, remove ugly suffix on git hash. Refs #571

* Tacking -official onto the git hash was a hack only needed on windows,
  and since we want more information it doesn't scale.
* Instead we track anything we need to know about the version in
  separate variables, like whether it's a stable build or a nightly/
  local build. Or if it's built by a downstream distribution then the
  version number for the downstream build.
This commit is contained in:
baldurk
2017-04-27 19:15:31 +01:00
parent 4199a857f5
commit ae50fa99ee
17 changed files with 213 additions and 106 deletions
+6 -26
View File
@@ -49,25 +49,6 @@
#define JSON_ID "rdocLayoutData"
#define JSON_VER 1
struct Version
{
static bool isOfficialVersion() { return QString(GIT_COMMIT_HASH).indexOf("-official") > 0; }
static bool isBetaVersion() { return QString(GIT_COMMIT_HASH).indexOf("-beta") > 0; }
static QString bareString() { return RENDERDOC_VERSION_STRING; }
static QString string() { return "v" RENDERDOC_VERSION_STRING; }
static QString gitCommitHash()
{
QString hash(GIT_COMMIT_HASH);
int dash = hash.indexOf(QChar('-'));
if(dash < 0)
return hash;
else
return hash.left(dash);
}
static bool isMismatched() { return RENDERDOC_GetVersionString() != bareString(); }
};
#if defined(Q_OS_WIN32)
extern "C" void *__stdcall GetModuleHandleA(const char *);
#endif
@@ -740,14 +721,12 @@ void MainWindow::SetTitle(const QString &filename)
QString text = prefix + "RenderDoc ";
if(Version::isOfficialVersion())
text += Version::string();
else if(Version::isBetaVersion())
text += tr("%1-beta - %2").arg(Version::string()).arg(Version::gitCommitHash());
if(RENDERDOC_STABLE_BUILD)
text += FULL_VERSION_STRING;
else
text += tr("Unofficial release (%1 - %2)").arg(Version::string()).arg(Version::gitCommitHash());
text += tr("Unstable release (%1 - %2)").arg(FULL_VERSION_STRING).arg(GIT_COMMIT_HASH);
if(Version::isMismatched())
if(QString::fromUtf8(RENDERDOC_GetVersionString()) != QString(MAJOR_MINOR_VERSION_STRING))
text += " - !! VERSION MISMATCH DETECTED !!";
setWindowTitle(text);
@@ -1184,7 +1163,8 @@ void MainWindow::switchContext()
}
else if(host->VersionMismatch)
{
statusText->setText(tr("Remote server is not running RenderDoc %1").arg(Version::string()));
statusText->setText(
tr("Remote server is not running RenderDoc %1").arg(FULL_VERSION_STRING));
}
else if(host->Busy)
{