Merge pull request #1315 from leon-richardt/commit-hash-settings

Add Version Information to "About" Page
This commit is contained in:
pajlada
2019-09-21 10:10:04 +02:00
committed by GitHub
6 changed files with 113 additions and 20 deletions
+1 -19
View File
@@ -364,30 +364,12 @@ void Window::addMenuBar()
[=] { this->notebook_->selectPreviousTab(); });
}
#define UGLYMACROHACK1(s) #s
#define UGLYMACROHACK(s) UGLYMACROHACK1(s)
void Window::onAccountSelected()
{
auto user = getApp()->accounts->twitch.getCurrent();
// update title
QString title = "Chatterino ";
if (Modes::getInstance().isNightly)
{
title += "Nightly ";
}
title += CHATTERINO_VERSION;
if (Modes::getInstance().isNightly)
{
#ifdef CHATTERINO_NIGHTLY_VERSION_STRING
title +=
QString(" (" UGLYMACROHACK(CHATTERINO_NIGHTLY_VERSION_STRING) ")");
#endif
}
this->setWindowTitle(title);
this->setWindowTitle(Version::getInstance().getFullVersion());
// update user
if (user->isAnon())
+20
View File
@@ -1,5 +1,7 @@
#include "AboutPage.hpp"
#include "common/Modes.hpp"
#include "common/Version.hpp"
#include "debug/Log.hpp"
#include "util/LayoutCreator.hpp"
#include "util/RemoveScrollAreaBackground.hpp"
@@ -71,6 +73,24 @@ AboutPage::AboutPage()
// }
}*/
auto versionInfo = layout.emplace<QGroupBox>("Version");
{
auto version = Version::getInstance();
QString text = QString("%1 (commit %2%3)")
.arg(version.getFullVersion())
.arg("<a "
"href=\"https://github.com/Chatterino/"
"chatterino2/commit/" +
version.getCommitHash() + "\">" +
version.getCommitHash() + "</a>")
.arg(Modes::getInstance().isNightly ? ", " + version.getDateOfBuild() : "");
auto versionLabel = versionInfo.emplace<QLabel>(text);
versionLabel->setOpenExternalLinks(true);
versionLabel->setTextInteractionFlags(Qt::TextSelectableByMouse |
Qt::LinksAccessibleByMouse);
}
auto licenses =
layout.emplace<QGroupBox>("Open source software used...");
{