Skip to content

Commit 56b075f

Browse files
committed
Added OMEdit git hash to about dialog.
1 parent 22a1579 commit 56b075f

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

OMEdit/OMEditGUI/MainWindow.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
#include "SimulationOutputWidget.h"
4444
#include "FetchInterfaceDataDialog.h"
4545
#include "TLMCoSimulationOutputWidget.h"
46+
#ifdef WIN32
47+
#include "version.h"
48+
#endif
4649

4750
MainWindow::MainWindow(QSplashScreen *pSplashScreen, bool debug, QWidget *parent)
4851
: QMainWindow(parent), mDebug(debug), mExitApplicationStatus(false)
@@ -3293,9 +3296,15 @@ AboutOMEditWidget::AboutOMEditWidget(MainWindow *pMainWindow)
32933296
// OMEdit intro text
32943297
Label *pIntroLabel = new Label(Helper::applicationIntroText);
32953298
pIntroLabel->setFont(QFont(Helper::systemFontInfo.family(), Helper::systemFontInfo.pointSize() + 3 + MAC_FONT_FACTOR));
3299+
#ifdef WIN32
3300+
Label *pOMEditVersionLabel = new Label(GIT_SHA);
3301+
#else
3302+
Label *pOMEditVersionLabel = new Label;
3303+
#endif
3304+
pOMEditVersionLabel->setFont(QFont(Helper::systemFontInfo.family(), Helper::systemFontInfo.pointSize() - 3 + MAC_FONT_FACTOR));
32963305
// OpenModelica compiler info
32973306
Label *pConnectedLabel = new Label(QString("Connected to ").append(Helper::OpenModelicaVersion));
3298-
pConnectedLabel->setFont(QFont(Helper::systemFontInfo.family(), Helper::systemFontInfo.pointSize() - 2 + MAC_FONT_FACTOR));
3307+
pConnectedLabel->setFont(QFont(Helper::systemFontInfo.family(), Helper::systemFontInfo.pointSize() - 3 + MAC_FONT_FACTOR));
32993308
// about text
33003309
QString aboutText = QString("Copyright <b>Open Source Modelica Consortium (OSMC)</b>.<br />")
33013310
.append("Distributed under OSMC-PL and GPL, see <u><a href=\"http://www.openmodelica.org\">www.openmodelica.org</a></u>.<br /><br />")
@@ -3346,11 +3355,12 @@ AboutOMEditWidget::AboutOMEditWidget(MainWindow *pMainWindow)
33463355
pMainLayout->setContentsMargins(45, 200, 45, 20);
33473356
pMainLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
33483357
pMainLayout->addWidget(pIntroLabel, 1, 0, 1, 1, Qt::AlignHCenter);
3349-
pMainLayout->addWidget(pConnectedLabel, 2, 0, 1, 1, Qt::AlignHCenter);
3350-
pMainLayout->addLayout(pAboutLayout, 3, 0, 1, 1);
3351-
pMainLayout->addWidget(pContributorsHeading, 4, 0, 1, 1);
3352-
pMainLayout->addWidget(pScrollArea, 5, 0, 1, 1);
3353-
pMainLayout->addWidget(pCloseButton, 6, 0, 1, 1, Qt::AlignRight);
3358+
pMainLayout->addWidget(pOMEditVersionLabel, 2, 0, 1, 1, Qt::AlignHCenter);
3359+
pMainLayout->addWidget(pConnectedLabel, 3, 0, 1, 1, Qt::AlignHCenter);
3360+
pMainLayout->addLayout(pAboutLayout, 4, 0, 1, 1);
3361+
pMainLayout->addWidget(pContributorsHeading, 5, 0, 1, 1);
3362+
pMainLayout->addWidget(pScrollArea, 6, 0, 1, 1);
3363+
pMainLayout->addWidget(pCloseButton, 7, 0, 1, 1, Qt::AlignRight);
33543364
setLayout(pMainLayout);
33553365
}
33563366

OMEdit/OMEditGUI/Makefile.omdev.mingw

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ ifeq ($(OMBUILDDIR),)
22
$(error OMBUILDDIR variable is not set.)
33
endif
44

5-
.PHONY: install build $(NAME)
5+
.PHONY: install build $(NAME) version
66

77
builddir_bin=$(OMBUILDDIR)/bin
88
builddir_share=$(OMBUILDDIR)/share/
99
resourcedir=./Resources/nls/
1010
SHREXT=.dll
11+
GIT_SHA = $(shell git describe --match "v*.*" --always)
1112

1213
NAME=OMEdit
1314
EXE=.exe
@@ -46,9 +47,28 @@ clean: MakefileClean
4647
parsergen:
4748
$(MAKE) -C Debugger/Parser -f Makefile.lib.omdev.mingw
4849

49-
build: $(NAME)
50+
build: version $(NAME)
5051
$(MAKE) -f Makefile
5152
Makefile: parsergen OMEditGUI.pro
5253
$(QMAKE) "CONFIG+=release"
5354
MakefileClean: OMEditGUI.pro
54-
$(QMAKE) "CONFIG+=release"
55+
$(QMAKE) "CONFIG+=release"
56+
57+
version:
58+
@echo Current version: $(GIT_SHA)
59+
ifeq ($(GIT_SHA),)
60+
@if test -f version.h; \
61+
then echo Could not retrieve version number. version.h not updated; \
62+
else echo "" > version.h; echo Could not retrieve version number. empty version.h was created; \
63+
fi;
64+
else # version is not empty, update it if it changed
65+
@if test -f version.h; \
66+
then \
67+
echo "#define GIT_SHA \"OMEdit $(GIT_SHA)\"" > version.h.tmp; diff version.h version.h.tmp > /dev/null; \
68+
if [ $$? -eq 0 ]; then echo No change in version; rm version.h.tmp; \
69+
else echo version has changed. updating version.h; \mv version.h.tmp version.h; \
70+
fi; \
71+
else \
72+
echo "#define GIT_SHA \"$(GIT_SHA)\"" > version.h; echo Retrieved version number. version.h was created; \
73+
fi;
74+
endif

OMEdit/OMEditGUI/OMEditGUI.pro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
QT += network core gui webkit xml xmlpatterns svg
3232
greaterThan(QT_MAJOR_VERSION, 4) {
33-
QT *= printsupport widgets webkitwidgets
33+
QT *= printsupport widgets webkitwidgets
3434
}
3535

3636
TRANSLATIONS = Resources/nls/OMEdit_de.ts \
@@ -65,7 +65,7 @@ win32 {
6565
QMAKE_CXXFLAGS += -g
6666
QMAKE_LFLAGS_RELEASE =
6767
# required for backtrace
68-
LIBS += -L$$(OMDEV)/tools/mingw/bin -limagehlp -lbfd -LF:/msys/mingw64/lib/binutils -lintl -liberty
68+
LIBS += -L$$(OMDEV)/tools/mingw/bin -limagehlp -lbfd -lintl -liberty
6969
}
7070
LIBS += -L../OMEditGUI/Debugger/Parser -lGDBMIParser \
7171
-L$$(OMBUILDDIR)/lib/omc -lomantlr3 -lOMPlot -lomqwt \
@@ -83,7 +83,7 @@ win32 {
8383
# options. For systems using the GNU linker, it is necessary to use
8484
# the -rdynamic linker option. Note that names of "static" functions
8585
# are not exposed, and won't be available in the backtrace.
86-
CONFIG(release, debug|release){
86+
CONFIG(release, debug|release) {
8787
QMAKE_LFLAGS_RELEASE += -rdynamic
8888
}
8989
}

0 commit comments

Comments
 (0)