change launcher style sandbox/zheng_wenlong/ces2019_horizontal
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>
Tue, 20 Nov 2018 09:29:03 +0000 (18:29 +0900)
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>
Tue, 20 Nov 2018 09:29:03 +0000 (18:29 +0900)
launcher/qml/IconItem.qml
launcher/qml/Launcher.qml
launcher/src/applicationmodel.cpp

index 4faa3ea..59c2180 100644 (file)
@@ -22,7 +22,7 @@ import "ChangeItemPosition.js" as Cip
 Item {
     id: main
     width: 300
-    height: 485
+    height: 300
     property string icon: model.icon
     property int pid: -1
     property bool isBlank: false
@@ -88,11 +88,7 @@ Item {
 
         Image {
             id: item
-            anchors.top: parent.top
-            anchors.topMargin: 230
-            anchors.horizontalCenter: parent.horizontalCenter
-            width: 300
-            height: 300
+            anchors.fill: parent
             source: './images/%1_active.png'.arg(model.icon)
             property string initial: model.name.substring(0,1).toUpperCase()
             property bool hasIcon: model.icon !== 'blank'
index 31a9848..522e1ce 100644 (file)
@@ -23,6 +23,8 @@ import "ChangeItemPosition.js" as Cip
 
 ApplicationWindow {
     id: root
+    width: 1920
+    height: 720
 
     property int pid: -1
     property int firstPox: -1
@@ -50,7 +52,8 @@ ApplicationWindow {
             property int currentState: 1
 
             width: 300
-            height: 590
+            height: 300
+            anchors.topMargin: 230
 
             smooth: true
 
@@ -67,8 +70,8 @@ ApplicationWindow {
                 Rotation {
                     id: rotate
                     angle: 0
-                    origin.y: 243
-                    origin.x: 160
+                    origin.y: 150
+                    origin.x: 150
                     axis { x: 0; y: 1; z: 0 }
                     Behavior on angle {
                         NumberAnimation { easing.overshoot: 1; easing.type: Easing.OutBack; duration: 600 }
@@ -87,8 +90,8 @@ ApplicationWindow {
                 },
                 Scale {
                     id: scale
-                    origin.x: 160
-                    origin.y: 243
+                    origin.x: 150
+                    origin.y: 150
                     xScale: 1
                     yScale: 1
                     Behavior on xScale {
@@ -418,7 +421,7 @@ ApplicationWindow {
                     PropertyChanges {
                         target: trans
                         x: 0
-                        y: -50
+                        y: 0
                     }
                     PropertyChanges {
                         target: rect1
index dd6ae5f..d57d643 100644 (file)
@@ -32,6 +32,7 @@ class ApplicationModel::Private
 {
 public:
     Private();
+    int loadAppInfo();
 
     QList<AppInfo> data;
 };
@@ -51,9 +52,20 @@ namespace {
 }
 
 ApplicationModel::Private::Private()
+{
+    int appCount = 0;
+    while(appCount <= 22)
+    {
+        appCount += loadAppInfo();
+        HMI_DEBUG("launcher", "appCount = %d", appCount);
+    }
+}
+
+int ApplicationModel::Private::loadAppInfo()
 {
     QString apps = afm_user_daemon_proxy->runnables(QStringLiteral(""));
     QJsonDocument japps = QJsonDocument::fromJson(apps.toUtf8());
+    int appCount = 0;
     for (auto const &app : japps.array()) {
         QJsonObject const &jso = app.toObject();
         auto const name = jso["name"].toString();
@@ -67,25 +79,11 @@ ApplicationModel::Private::Private()
             !name.contains("OnScreen", Qt::CaseInsensitive)) {
             this->data.append(AppInfo(icon, name, id));
         }
+        appCount++;
 
         HMI_DEBUG("launcher","name: %s icon: %s id: %s.", name.toStdString().c_str(), icon.toStdString().c_str(), id.toStdString().c_str());
     }
-    for (auto const &app : japps.array()) {
-        QJsonObject const &jso = app.toObject();
-        auto const name = jso["name"].toString();
-        auto const id = jso["id"].toString();
-        auto const icon = get_icon_name(jso);
-
-        // Hide HomeScreen icon itself
-        if (name != "launcher" &&
-            name != "homescreen" &&
-            name != "HomeScreen" &&
-            !name.contains("OnScreen", Qt::CaseInsensitive)) {
-            this->data.append(AppInfo(icon, name, id));
-        }
-
-        HMI_DEBUG("launcher","name: %s icon: %s id: %s.", name.toStdString().c_str(), icon.toStdString().c_str(), id.toStdString().c_str());
-    }
+    return appCount;
 }
 
 ApplicationModel::ApplicationModel(QObject *parent)