Make read out SeaPrint version automatic from .yaml file.

This commit is contained in:
Rudi Timmermans 2019-12-19 22:59:56 +01:00
parent 2f6985af39
commit 5e29be1dc9
6 changed files with 18 additions and 7 deletions

View file

@ -14,6 +14,13 @@ TARGET = harbour-seaprint
CONFIG += sailfishapp
# Write version file
VERSION_H = \
"$${LITERAL_HASH}ifndef SEAPRINT_VERSION" \
"$${LITERAL_HASH} define SEAPRINT_VERSION \"$$VERSION\"" \
"$${LITERAL_HASH}endif"
write_file($$$$OUT_PWD/seaprint_version.h, VERSION_H)
SOURCES += src/harbour-seaprint.cpp \
src/ippdiscovery.cpp \
src/bytestream.cpp \

View file

@ -10,11 +10,6 @@ ApplicationWindow
cover: Qt.resolvedUrl("cover/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
id: appWin
property string appName: "SeaPrint"
property string version: "0.3.1-1"
Item {
id: db
property var db_conn

View file

@ -54,7 +54,7 @@ Page {
AboutLabel {
font.pixelSize: Theme.fontSizeLarge
color: Theme.highlightColor
text: appWin.appName + " v" + appWin.version
text: "SeaPrint v" + Qt.application.version
}
AboutLabel {
font.pixelSize: Theme.fontSizeSmall

View file

@ -37,7 +37,8 @@ Short description of my Sailfish OS Application
# >> build pre
# << build pre
%qmake5
%qmake5 \
VERSION=%{version}
make %{?_smp_mflags}

View file

@ -16,6 +16,9 @@ Description: |
Configure: none
Builder: qmake5
QMakeOptions:
- VERSION=%{version}
# This section specifies build dependencies that are resolved using pkgconfig.
# This is the preferred way of specifying build dependencies for your package.
PkgConfigBR:

View file

@ -1,11 +1,16 @@
#include <QtQuick>
#include <sailfishapp.h>
#include <seaprint_version.h>
#include <src/ippdiscovery.h>
#include <src/ippprinter.h>
int main(int argc, char *argv[])
{
QGuiApplication* app = SailfishApp::application(argc, argv);
app->setApplicationVersion(QStringLiteral(SEAPRINT_VERSION));
qmlRegisterType<IppDiscovery>("seaprint.ippdiscovery", 1, 0, "IppDiscovery");
qmlRegisterType<IppPrinter>("seaprint.ippprinter", 1, 0, "IppPrinter");