Make CLI and GUI version info match (#1853)

`flameshot --version` now includes the git commit hash, same as the
About window.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
This commit is contained in:
Haris Gušić
2021-08-30 15:39:59 +02:00
committed by GitHub
parent 69a43fb791
commit d54a515574
5 changed files with 15 additions and 15 deletions

View File

@@ -3,6 +3,7 @@
#include "infowindow.h"
#include "src/core/qguiappcurrentscreen.h"
#include "src/utils/globalvalues.h"
#include <QApplication>
#include <QClipboard>
#include <QHeaderView>
@@ -65,9 +66,7 @@ void InfoWindow::initLabels()
versionTitleLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
m_layout->addWidget(versionTitleLabel);
QString versionMsg = generateVersionString();
auto* versionLabel = new QLabel(versionMsg, this);
auto* versionLabel = new QLabel(GlobalValues::versionInfo(), this);
versionLabel->setAlignment(Qt::AlignHCenter);
versionLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
m_layout->addWidget(versionLabel);
@@ -88,7 +87,8 @@ void InfoWindow::initLabels()
void InfoWindow::copyInfo()
{
QClipboard* clipboard = QApplication::clipboard();
clipboard->setText(generateVersionString() + "\n" + generateKernelString());
clipboard->setText(GlobalValues::versionInfo() + "\n" +
generateKernelString());
}
void InfoWindow::keyPressEvent(QKeyEvent* e)
@@ -98,14 +98,6 @@ void InfoWindow::keyPressEvent(QKeyEvent* e)
}
}
QString generateVersionString()
{
QString version = "Flameshot " + QStringLiteral(APP_VERSION) + " (" +
QStringLiteral(FLAMESHOT_GIT_HASH) +
")\nCompiled with Qt " + QT_VERSION_STR;
return version;
}
QString generateKernelString()
{
QString kernelVersion =