aboutsummaryrefslogtreecommitdiffstats
path: root/homescreen
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2017-12-13 17:32:05 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2017-12-13 17:32:05 +0900
commit242e1fcf1e76dc8ad94c0391649fd3ab84e64803 (patch)
treed631e62c1398564dde103983320a57fdc179beea /homescreen
parent8b03da6d8c07a40c2d65b9cfb40a2fd50c276a2d (diff)
Display a blank icon with first letter when icon is not exist
Add a new feature, when icon is not exist in homescreen, display a blank icon with first letter. Change-Id: I928537bd61f655107393890166260b7446a16a97 Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
Diffstat (limited to 'homescreen')
-rw-r--r--homescreen/qml/IconItem.qml24
-rw-r--r--homescreen/qml/images/Home/HMI_AppLauncher_Blank_Active-01.pngbin0 -> 52032 bytes
-rw-r--r--homescreen/qml/images/Home/HMI_AppLauncher_Blank_Inactive-01.pngbin0 -> 44813 bytes
-rw-r--r--homescreen/qml/images/Home/home.qrc2
-rw-r--r--homescreen/src/applicationmodel.cpp6
5 files changed, 32 insertions, 0 deletions
diff --git a/homescreen/qml/IconItem.qml b/homescreen/qml/IconItem.qml
index 59131c0..32d37b4 100644
--- a/homescreen/qml/IconItem.qml
+++ b/homescreen/qml/IconItem.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQuick.Controls 2.0
Item {
id: main
@@ -6,6 +7,29 @@ Item {
id: item; parent: loc
x: main.x + 5; y: main.y + 5
width: main.width - 10; height: main.height - 10;
+
+ Label {
+ id: title
+ y: 60
+ font.pixelSize: 125
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#5CFE96"
+ text: model.icon == 'Blank' ? model.name.substring(0,1).toUpperCase() : ''
+ }
+
+ Label {
+ id: name
+ y: 245
+ width: main.width - 10
+ font.pixelSize: 25
+ font.letterSpacing: 5
+ wrapMode: Text.WordWrap
+ anchors.horizontalCenter: parent.horizontalCenter
+ horizontalAlignment: Text.AlignHCenter
+ color: "white"
+ text: model.icon == 'Blank' ? model.name.toUpperCase() : ''
+ }
+
source: './images/HMI_AppLauncher_%1_%2-01.png'.arg(model.icon).arg(loc.pressed && (loc.index === model.index || loc.currentId === model.id) ? 'Active' : 'Inactive')
antialiasing: item.state !== ''
Behavior on x { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
diff --git a/homescreen/qml/images/Home/HMI_AppLauncher_Blank_Active-01.png b/homescreen/qml/images/Home/HMI_AppLauncher_Blank_Active-01.png
new file mode 100644
index 0000000..32558b3
--- /dev/null
+++ b/homescreen/qml/images/Home/HMI_AppLauncher_Blank_Active-01.png
Binary files differ
diff --git a/homescreen/qml/images/Home/HMI_AppLauncher_Blank_Inactive-01.png b/homescreen/qml/images/Home/HMI_AppLauncher_Blank_Inactive-01.png
new file mode 100644
index 0000000..bd374c6
--- /dev/null
+++ b/homescreen/qml/images/Home/HMI_AppLauncher_Blank_Inactive-01.png
Binary files differ
diff --git a/homescreen/qml/images/Home/home.qrc b/homescreen/qml/images/Home/home.qrc
index 49d19d8..ecf9b77 100644
--- a/homescreen/qml/images/Home/home.qrc
+++ b/homescreen/qml/images/Home/home.qrc
@@ -21,5 +21,7 @@
<file>HMI_AppLauncher_Radio_Inactive-01.png</file>
<file>HMI_AppLauncher_Settings_Active-01.png</file>
<file>HMI_AppLauncher_Settings_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Blank_Active-01.png</file>
+ <file>HMI_AppLauncher_Blank_Inactive-01.png</file>
</qresource>
</RCC>
diff --git a/homescreen/src/applicationmodel.cpp b/homescreen/src/applicationmodel.cpp
index f01df06..8837ba9 100644
--- a/homescreen/src/applicationmodel.cpp
+++ b/homescreen/src/applicationmodel.cpp
@@ -48,6 +48,12 @@ namespace {
} else {
icon[0] = icon[0].toUpper();
}
+
+ if ( !QFile::exists(QString(":/images/HMI_AppLauncher_%1_Active-01.png").arg(icon)) ||
+ !QFile::exists(QString(":/images/HMI_AppLauncher_%1_Inactive-01.png").arg(icon)) )
+ {
+ icon = "Blank";
+ }
return icon;
}
}