-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.sh
More file actions
executable file
·45 lines (42 loc) · 1.3 KB
/
version.sh
File metadata and controls
executable file
·45 lines (42 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
last_commit=$(git rev-parse HEAD)
commit_count=$(git log --pretty=format:'' | wc -l)
version_number=$((commit_count + 1))
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
gcc_version=$(gcc --version | head -1)
if (($(git status 2> /dev/null | wc -l) == 8)); then
if git status 2> /dev/null | grep version\.h > /dev/null; then
wip_build=""
else
wip_build="-WIP"
fi
elif (($(git status 2> /dev/null | wc -l) != 2)); then
wip_build="-WIP"
else
wip_build=""
fi
echo "#include <QMessageBox>
#include <QSysInfo>
void display_version_dialog()
{
QString OS;
#if defined(Q_OS_LINUX)
OS = \"Operating system: Linux\";
#elif defined(Q_OS_WIN32)
OS = \"Operating system: Windows\";
#elif defined(Q_OS_MAC)
OS = \"Operating system: Mac\";
#else
OS = \"Operating system: Unknown or unsupported\";
#endif
QMessageBox version_info;
version_info.setText(QString(\"The current version is: v${version_number}${wip_build}\").leftJustified(100));
version_info.setWindowTitle(\"Version info\");
version_info.setDetailedText(
\"The current build branch is: ${git_branch}\\n\"
\"The current commit sha1 is: ${last_commit}\\n\"
\"Compiled with: ${gcc_version}\\n\" + OS
);
version_info.setWindowFlags(version_info.windowFlags());
version_info.exec();
}" > version.h