GlosSIConfig: Show version in UI

pull/183/head
Peter Repukat 2 years ago
parent 711a0cd2ed
commit da1e46f102

2
.gitignore vendored

@ -1,3 +1,5 @@
version.hpp
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##

@ -26,6 +26,8 @@ limitations under the License.
#include <Windows.h>
#endif
#include "../version.hpp"
UIModel::UIModel() : QObject(nullptr)
{
auto path = std::filesystem::temp_directory_path()
@ -362,6 +364,11 @@ void UIModel::writeTarget(const QJsonObject& json, const QString& name) const
file.close();
}
QString UIModel::getVersionString() const
{
return QString(version::VERSION_STR);
}
std::filesystem::path UIModel::getSteamPath() const
{
try {

@ -30,6 +30,9 @@ class UIModel : public QObject {
Q_PROPERTY(bool foundSteam READ foundSteam CONSTANT)
Q_PROPERTY(bool steamInputXboxSupportEnabled READ isSteamInputXboxSupportEnabled CONSTANT)
Q_PROPERTY(QString versionString READ getVersionString CONSTANT)
public:
UIModel();
@ -84,6 +87,8 @@ class UIModel : public QObject {
void writeTarget(const QJsonObject& json, const QString& name) const;
QString getVersionString() const;
std::filesystem::path getSteamPath() const;
std::wstring getSteamUserId() const;
bool foundSteam() const;

@ -258,6 +258,15 @@ Window {
}
}
Label {
id: versionInfo
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.margins: 8
opacity: 0.5
text: uiModel.versionString
}
AddSelectTypeDialog {
id: selectTypeDialog
visible: false

@ -10,6 +10,29 @@ $commatag = $commatag -replace "[A-z]","0"
((Get-Content -path ./Resource.rc -Raw) -replace '"FileVersion", ".*"', ('"FileVersion", "' + $tag + '"')) | Set-Content -Path ./Resource.rc
((Get-Content -path ./Resource.rc -Raw) -replace '"ProductVersion", ".*"', ('"ProductVersion", "' + $tag + '"')) | Set-Content -Path ./Resource.rc
$cleanTag = git describe --tags --abbrev=0
$versionFileText = "
/* Autogenerated version info file */
#pragma once
namespace version {
inline const auto VERSION_STR = ""$tag"";
inline const auto IS_SNAPSHOT = $( If ($tag.Length -gt 10) {'true'} Else {'false'});
inline const auto VERSION_MAJOR = $($cleanTag.Split('.')[0]);
inline const auto VERSION_MINOR = $($cleanTag.Split('.')[1]);
inline const auto VERSION_PATCH = $($cleanTag.Split('.')[2]);
inline const auto VERSION_REVISION = $($cleanTag.Split('.')[3]);
}
"
if (!(Test-Path '../version.hpp')) {
New-Item -Path ".." -Name "version.hpp" -ItemType "file" -Value $versionFileText
} else {
Set-Content -Path "../version.hpp" -Value $versionFileText
}
if ((Test-Path '../Installer/Installer.nsi')) {
((Get-Content -path '../Installer/Installer.nsi' -Raw) -replace '!define VERSION ".*"', ('!define VERSION "' + $tag + '"')) | Set-Content -Path '../Installer/Installer.nsi'
}
Loading…
Cancel
Save