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:
@@ -2,6 +2,7 @@
|
||||
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
|
||||
|
||||
#include "commandlineparser.h"
|
||||
#include "src/utils/globalvalues.h"
|
||||
#include <QApplication>
|
||||
#include <QTextStream>
|
||||
|
||||
@@ -305,8 +306,7 @@ QString CommandLineParser::value(const CommandOption& option) const
|
||||
|
||||
void CommandLineParser::printVersion()
|
||||
{
|
||||
out << "Flameshot " << qApp->applicationVersion() << "\nCompiled with Qt "
|
||||
<< static_cast<QString>(QT_VERSION_STR) << "\n";
|
||||
out << GlobalValues::versionInfo() << QStringLiteral("\n");
|
||||
}
|
||||
|
||||
void CommandLineParser::printHelp(QStringList args, const Node* node)
|
||||
|
||||
@@ -9,3 +9,9 @@ int GlobalValues::buttonBaseSize()
|
||||
{
|
||||
return QApplication::fontMetrics().lineSpacing() * 2.2;
|
||||
}
|
||||
|
||||
QString GlobalValues::versionInfo()
|
||||
{
|
||||
return QStringLiteral("Flameshot " APP_VERSION " (" FLAMESHOT_GIT_HASH ")"
|
||||
"\nCompiled with Qt " QT_VERSION_STR);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class QString;
|
||||
|
||||
namespace GlobalValues {
|
||||
|
||||
int buttonBaseSize();
|
||||
QString versionInfo();
|
||||
|
||||
}
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -24,5 +24,4 @@ private:
|
||||
QVBoxLayout* m_layout;
|
||||
};
|
||||
|
||||
QString generateVersionString();
|
||||
QString generateKernelString();
|
||||
|
||||
Reference in New Issue
Block a user