Commit d41995eb authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Extract app version from YAML in QMake, and TDLIB version from JSON API

parent 75cfcfae
......@@ -14,6 +14,16 @@ RCC_DIR = _rcc
CONFIG += link_pkgconfig
YAML_LINES = $$cat($$PWD/rpm/harbour-telegrame.yaml, lines)
for(LINE, YAML_LINES) {
YAML_KEY = $$section(LINE, ": ", 0, 0)
equals(YAML_KEY, "Version") {
YAML_VALUE = $$section(LINE, ": ", 1, 1)
message ("Extracted app version from YAML '" $$YAML_VALUE "' : OK !")
DEFINES += YAML_VERSION=$$YAML_VALUE
}
}
QMAKE_CXXFLAGS -= -g
QMAKE_CXXFLAGS_DEBUG -= -g
QMAKE_CXXFLAGS_RELEASE -= -g
......
......@@ -29,7 +29,7 @@ Page {
anchors.horizontalCenter: parent.horizontalCenter;
}
LabelFixed {
text: "Telegra'me v21";
text: "Telegra'me v%1".arg (Qt.application.version);
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.family: Theme.fontFamilyHeading;
font.pixelSize: Theme.fontSizeExtraLarge;
......@@ -37,7 +37,7 @@ Page {
ExtraAnchors.horizontalFill: parent;
}
LabelFixed {
text: "using TDLIB v1.4";
text: "using TDLIB v%1".arg (TD_Global.tdlibVersion);
opacity: 0.65;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
font.family: Theme.fontFamilyHeading;
......
......@@ -13,7 +13,7 @@ Name: harbour-telegrame
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: A native Telegram client for Sailfish OS
Version: 21
Version: 22
Release: 1
Group: Qt/Qt
License: WTFPL
......
Name: harbour-telegrame
Summary: A native Telegram client for Sailfish OS
Version: 21
Version: 22
Release: 1
Group: Qt/Qt
......
......@@ -137,6 +137,7 @@ QtTdLibObjectType::Type QtTdLibEnums::objectTypeEnumFromString (const QString &
{ "updateNewChat", QtTdLibObjectType::UPDATE_NEW_CHAT },
{ "updateNewMessage", QtTdLibObjectType::UPDATE_NEW_MESSAGE },
{ "updateNotificationSettings", QtTdLibObjectType::UPDATE_NOTIFICATION_SETTINGS },
{ "updateOption", QtTdLibObjectType::UPDATE_OPTION },
{ "updateSupergroup", QtTdLibObjectType::UPDATE_SUPERGROUP },
{ "updateSupergroupFullInfo", QtTdLibObjectType::UPDATE_SUPERGROUP_FULL_INFO },
{ "updateChatPinnedMessage", QtTdLibObjectType::UPDATE_CHAT_PINNED_MESSAGE },
......
......@@ -141,6 +141,7 @@ QML_ENUM_CLASS (QtTdLibObjectType,
UPDATE_NEW_CHAT,
UPDATE_NEW_MESSAGE,
UPDATE_NOTIFICATION_SETTINGS,
UPDATE_OPTION,
UPDATE_SUPERGROUP,
UPDATE_SUPERGROUP_FULL_INFO,
UPDATE_UNREAD_MESSAGE_COUNT,
......
......@@ -924,7 +924,7 @@ void QtTdLibGlobal::onFrame (const QJsonObject & json) {
{ "system_language_code", "en" },
{ "device_model", "Jolla Sailfish OS" },
{ "system_version", "3.x" },
{ "application_version", "0.9.xx" },
{ "application_version", "21" },
{ "enable_storage_optimizer", true },
{ "database_directory", QString (QDir::homePath () % "/.telegrame") },
{ "files_directory", QString (QDir::homePath () % "/.telegrame") },
......@@ -966,6 +966,14 @@ void QtTdLibGlobal::onFrame (const QJsonObject & json) {
}
break;
}
case QtTdLibObjectType::UPDATE_OPTION: {
static const QString VERSION { QStringLiteral ("version") };
if (json ["name"].toString () == VERSION) {
set_tdlibVersion (json ["value"].toObject () ["value"].toString ());
}
else { }
break;
}
case QtTdLibObjectType::UPDATE_CONNECTION_STATE: {
set_connectionState_withJSON (json ["state"], &QtTdLibConnectionState::createAbstract);
break;
......
......@@ -48,6 +48,7 @@ class QtTdLibGlobal : public QObject {
QML_WRITABLE_VAR_PROPERTY (sendTextOnEnterKey, bool)
QML_WRITABLE_CSTREF_PROPERTY (replyingToMessageId, QString)
QML_WRITABLE_CSTREF_PROPERTY (editingMessageId, QString)
QML_READONLY_CSTREF_PROPERTY (tdlibVersion, QString)
public:
explicit QtTdLibGlobal (QObject * parent = Q_NULLPTR);
......
......@@ -25,7 +25,8 @@
int main (int argc, char * argv []) {
SailfishApp::application (argc, argv);
QGuiApplication::setApplicationName (QStringLiteral ("harbour-telegrame"));
QGuiApplication::setApplicationName (QStringLiteral ("harbour-telegrame"));
QGuiApplication::setApplicationVersion (QString::number (int (YAML_VERSION)));
QtQmlTricks::registerComponents ();
qmlRegisterType<TextFormatter> ("harbour.Telegrame", 1, 0, "TextFormatter");
qmlRegisterType<CountryCodes> ("harbour.Telegrame", 1, 0, "CountryCodes");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment