mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
Generate the exact version string via Git.
This commit is contained in:
parent
71519ff19b
commit
be23f54914
|
@ -5,6 +5,18 @@ TEMPLATE = app
|
|||
TARGET = goldendict
|
||||
VERSION = 0.9.0+git
|
||||
|
||||
# Generate version file. We do this here and in a build rule described later.
|
||||
# The build rule is required since qmake isn't run each time the project is
|
||||
# rebuilt; and doing it here is required too since any other way the RCC
|
||||
# compiler would complain if version.txt wouldn't exist (fresh checkouts).
|
||||
|
||||
system(git describe --tags --always --dirty > version.txt): hasGit=1
|
||||
|
||||
isEmpty( hasGit ) {
|
||||
message(Failed to precisely describe the version via Git -- using the default version string)
|
||||
system(echo $$VERSION > version.txt)
|
||||
}
|
||||
|
||||
# DEPENDPATH += . generators
|
||||
INCLUDEPATH += .
|
||||
QT += webkit
|
||||
|
@ -241,6 +253,13 @@ TRANSLATIONS += locale/ru_RU.ts \
|
|||
locale/lt_LT.ts \
|
||||
locale/uk_UA.ts
|
||||
|
||||
# Build version file
|
||||
QMAKE_EXTRA_TARGETS += revtarget
|
||||
PRE_TARGETDEPS += version.txt
|
||||
revtarget.target = version.txt
|
||||
revtarget.commands = git describe --tags --always --dirty > $$revtarget.target
|
||||
revtarget.depends = $$SOURCES $$HEADERS $$FORMS
|
||||
|
||||
# This makes qmake generate translations
|
||||
win32:# Windows doesn't seem to have *-qt4 symlinks
|
||||
isEmpty(QMAKE_LRELEASE):QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
|
||||
|
|
|
@ -1614,7 +1614,16 @@ void MainWindow::showAbout()
|
|||
|
||||
ui.setupUi( &about );
|
||||
|
||||
ui.version->setText( PROGRAM_VERSION );
|
||||
QFile versionFile( ":/version.txt" );
|
||||
|
||||
QString version;
|
||||
|
||||
if ( !versionFile.open( QFile::ReadOnly ) )
|
||||
version = tr( "[Unknown]" );
|
||||
else
|
||||
version = QString::fromAscii( versionFile.readAll() ).trimmed();
|
||||
|
||||
ui.version->setText( version );
|
||||
|
||||
about.show();
|
||||
about.exec();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>version.txt</file>
|
||||
<file>icons/print.png</file>
|
||||
<file>icons/arrow.png</file>
|
||||
<file>icons/prefix.png</file>
|
||||
|
|
Loading…
Reference in a new issue