From 45c0a4fa723ef93246a0d3530a135bf3d8ed4f9b Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Tue, 20 Dec 2016 21:32:30 +0900 Subject: Add Version Info Change-Id: I9c8d36e9c4d9068e7c7bcb8834d84dd2cf810874 Signed-off-by: Tasuku Suzuki --- app/Settings.qml | 5 +- app/SettingsLauncher.qml | 4 +- app/app.pro | 3 +- app/main.cpp | 9 ++ app/version/Version.qml | 78 ++++++++++++++++ app/version/images/agl_slide_0.png | Bin 0 -> 1926938 bytes app/version/images/icon.svg | 182 +++++++++++++++++++++++++++++++++++++ app/version/version.qrc | 7 ++ 8 files changed, 284 insertions(+), 4 deletions(-) create mode 100644 app/version/Version.qml create mode 100644 app/version/images/agl_slide_0.png create mode 100644 app/version/images/icon.svg create mode 100644 app/version/version.qrc (limited to 'app') diff --git a/app/Settings.qml b/app/Settings.qml index 4fcda79..b3a622a 100644 --- a/app/Settings.qml +++ b/app/Settings.qml @@ -22,6 +22,7 @@ import 'datetime' import 'bluetooth' import 'wifi' import 'example' +import 'version' ApplicationWindow { id: root @@ -60,6 +61,8 @@ ApplicationWindow { Wifi {} - Example {} +// Example {} + + Version {} } } diff --git a/app/SettingsLauncher.qml b/app/SettingsLauncher.qml index c627324..4591cb4 100644 --- a/app/SettingsLauncher.qml +++ b/app/SettingsLauncher.qml @@ -40,14 +40,14 @@ Page { Layout.preferredWidth: 100 Layout.preferredHeight: 100 Image { - anchors.centerIn: parent + anchors.fill: parent source: model.icon } } Label { Layout.fillWidth: true text: model.title.toUpperCase() - color: '#59FF7F' + color: '#66FF99' } Switch { id: checkedSwitch diff --git a/app/app.pro b/app/app.pro index fcfa050..d05b9ca 100644 --- a/app/app.pro +++ b/app/app.pro @@ -9,7 +9,8 @@ RESOURCES += \ datetime/datetime.qrc \ wifi/wifi.qrc \ bluetooth/bluetooth.qrc \ - example/example.qrc + example/example.qrc \ + version/version.qrc include(app.pri) 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 #include #include +#include #include #include #include @@ -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"))); diff --git a/app/version/Version.qml b/app/version/Version.qml new file mode 100644 index 0000000..b4d55c8 --- /dev/null +++ b/app/version/Version.qml @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import QtQuick.Window 2.2 +import AGL.Demo.Controls 1.0 +import '..' + +SettingPage { + id: root + icon: '/version/images/icon.svg' + title: 'Version Info' + + ColumnLayout { + id: container + anchors.fill: parent + anchors.margins: 100 + Label { + Layout.fillWidth: true + Layout.preferredHeight: 500 + text: 'Automotive\nGrade Linux' + font.pixelSize: 128 + horizontalAlignment: Label.AlignHCenter + verticalAlignment: Label.AlignVCenter + clip: true + Image { + anchors.centerIn: parent + source: './images/agl_slide_0.png' + z: -1 + opacity: 0.5 + } + } + + GridLayout { + columns: 2 + rowSpacing: 20 + columnSpacing: 20 + Label { + text: 'AGL:' + font.pixelSize: 48 + } + Label { + text: '3.0 (Charming Chinook)' + font.pixelSize: 48 + Layout.fillWidth: true + } + Label { + text: 'Kernel:' + font.pixelSize: 48 + } + Label { + text: kernel + font.pixelSize: 48 + Layout.fillWidth: true + } + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + } +} diff --git a/app/version/images/agl_slide_0.png b/app/version/images/agl_slide_0.png new file mode 100644 index 0000000..755e620 Binary files /dev/null and b/app/version/images/agl_slide_0.png differ diff --git a/app/version/images/icon.svg b/app/version/images/icon.svg new file mode 100644 index 0000000..97758e9 --- /dev/null +++ b/app/version/images/icon.svg @@ -0,0 +1,182 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/version/version.qrc b/app/version/version.qrc new file mode 100644 index 0000000..0453cc0 --- /dev/null +++ b/app/version/version.qrc @@ -0,0 +1,7 @@ + + + Version.qml + images/icon.svg + images/agl_slide_0.png + + -- cgit 1.2.3-korg