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 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 \ SOURCES += src/harbour-seaprint.cpp \
src/ippdiscovery.cpp \ src/ippdiscovery.cpp \
src/bytestream.cpp \ src/bytestream.cpp \

View file

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

View file

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

View file

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

View file

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

View file

@ -1,11 +1,16 @@
#include <QtQuick> #include <QtQuick>
#include <sailfishapp.h> #include <sailfishapp.h>
#include <seaprint_version.h>
#include <src/ippdiscovery.h> #include <src/ippdiscovery.h>
#include <src/ippprinter.h> #include <src/ippprinter.h>
int main(int argc, char *argv[]) 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<IppDiscovery>("seaprint.ippdiscovery", 1, 0, "IppDiscovery");
qmlRegisterType<IppPrinter>("seaprint.ippprinter", 1, 0, "IppPrinter"); qmlRegisterType<IppPrinter>("seaprint.ippprinter", 1, 0, "IppPrinter");