Improve version information for AGL UCB. 49/13549/1
authorHarunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
Mon, 5 Mar 2018 06:29:11 +0000 (15:29 +0900)
committerHarunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
Mon, 5 Mar 2018 06:32:57 +0000 (15:32 +0900)
Version information is hardcoded. This commit support
AGL UCB version automatically from /etc/os-release

Bug-AGL: SPEC-656

Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
app/main.cpp
app/version/Version.qml

index d496ef6..3b0d1e9 100644 (file)
@@ -133,6 +133,17 @@ int main(int argc, char *argv[])
     } else {
         qWarning() << version.errorString();
     }
+
+    QFile aglversion("/etc/os-release");
+    if (aglversion.open(QFile::ReadOnly)) {
+        QStringList data = QString::fromLocal8Bit(aglversion.readAll()).split(QLatin1Char('\n'));
+        QStringList data2 = data.at(2).split(QLatin1Char('"'));
+        engine.rootContext()->setContextProperty("ucb", data2.at(1));
+        aglversion.close();
+    } else {
+        qWarning() << aglversion.errorString();
+    }
+
     DBus dbus;
     engine.rootContext()->setContextProperty("dbus", &dbus);
     engine.load(QUrl(QStringLiteral("qrc:/Settings.qml")));
index 228481f..8d47ad5 100644 (file)
@@ -55,7 +55,7 @@ SettingPage {
                 font.pixelSize: 48
             }
             Label {
-                text: '5.0.0rc2 (Electric Eel)'
+                text: ucb
                 font.pixelSize: 48
                 Layout.fillWidth: true
             }