diff options
author | Tasuku Suzuki <tasuku.suzuki@qt.io> | 2016-12-20 21:32:30 +0900 |
---|---|---|
committer | Tasuku Suzuki <tasuku.suzuki@qt.io> | 2016-12-20 21:32:30 +0900 |
commit | 45c0a4fa723ef93246a0d3530a135bf3d8ed4f9b (patch) | |
tree | 94f0c57d42236ff4c868b1e7f768ce06cb9ce8da /app/main.cpp | |
parent | c70f97efea9b58490362692833104a6a5f23da89 (diff) |
Add Version Info
Change-Id: I9c8d36e9c4d9068e7c7bcb8834d84dd2cf810874
Signed-off-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Diffstat (limited to 'app/main.cpp')
-rw-r--r-- | app/main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/main.cpp b/app/main.cpp index 9c01cac..fd8201e 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -17,6 +17,7 @@ #include <QtCore/QDebug> #include <QtCore/QCommandLineParser> #include <QtCore/QUrlQuery> +#include <QtCore/QFile> #include <QtDBus/QDBusInterface> #include <QtDBus/QDBusReply> #include <QtGui/QGuiApplication> @@ -89,6 +90,14 @@ int main(int argc, char *argv[]) context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress); } + QFile version("/proc/version"); + if (version.open(QFile::ReadOnly)) { + QStringList data = QString::fromLocal8Bit(version.readAll()).split(QLatin1Char(' ')); + engine.rootContext()->setContextProperty("kernel", data.at(2)); + version.close(); + } else { + qWarning() << version.errorString(); + } DBus dbus; engine.rootContext()->setContextProperty("dbus", &dbus); engine.load(QUrl(QStringLiteral("qrc:/Settings.qml"))); |