Skip to content

Commit d073601

Browse files
committed
Add version to window title
Add git information in debug mode
1 parent c92db83 commit d073601

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

ModbusServer.pro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11

2+
VERSION = v1.0.0
3+
4+
DEFINES += DEBUG
5+
6+
DEFINES += GIT_HASH="\\\"$(shell git --git-dir \""$$PWD/.git"\" rev-parse --short HEAD)\\\""
7+
DEFINES += GIT_BRANCH="\\\"$(shell git --git-dir \""$$PWD/.git"\" rev-parse --abbrev-ref HEAD)\\\""
8+
9+
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
10+
211
QT += core gui widgets serialbus
312

413
TARGET = ModbusTestSlave

src/mainwindow.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ MainWindow::MainWindow(QWidget *parent) :
7272

7373
/* Don't stretch columns, resize to contents */
7474
_pUi->tblRegData->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
75+
76+
QString debugTxt;
77+
#ifdef DEBUG
78+
debugTxt = QString(tr(" beta (git %1:%2)")).arg(GIT_BRANCH).arg(GIT_HASH);
79+
#endif
80+
81+
QString windowCaption;
82+
windowCaption = QString("ModbusTestSlave %1%2").arg(APP_VERSION).arg(debugTxt);
83+
84+
setWindowTitle(windowCaption);
7585
}
7686

7787
MainWindow::~MainWindow()

0 commit comments

Comments
 (0)