X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=homescreen%2Fqml%2FHome.qml;h=aa3a129beff917639c924fd7bdea092800d5a8e7;hb=42ff0b116ebe137c566f06389477cb2ca7bcb2df;hp=a312670341b2033307e7e9a95e38d54781d61d7f;hpb=e412b716601f96466ca786784facb558e28e92e4;p=apps%2Fhomescreen.git diff --git a/homescreen/qml/Home.qml b/homescreen/qml/Home.qml index a312670..aa3a129 100644 --- a/homescreen/qml/Home.qml +++ b/homescreen/qml/Home.qml @@ -31,7 +31,6 @@ Item { property int pid: -1 GridView { - id: grid anchors.centerIn: parent width: cellHeight * 3 height: cellHeight * 3 @@ -39,41 +38,27 @@ Item { cellHeight: 320 interactive: false - model: ApplicationModel { id: applicationModel } - delegate: IconItem { - width: grid.cellWidth - height: grid.cellHeight - } - - MouseArea { - id: loc - anchors.fill: parent - property string currentId: '' - property int newIndex: -1 - property int index: grid.indexAt(loc.mouseX, loc.mouseY) - onPressAndHold: currentId = applicationModel.id(newIndex = index) - onReleased: { - if (currentId === '') { - pid = launcher.launch(applicationModel.id(loc.index)) - if (1 < pid) { - layoutHandler.makeMeVisible(pid) + model: ApplicationModel {} + delegate: MouseArea { + width: 320 + height: 320 + Image { + anchors.fill: parent + source: './images/HMI_AppLauncher_%1_%2-01.png'.arg(model.icon).arg(pressed ? 'Active' : 'Inactive') + } + onClicked: { + console.log("app is ", model.id) + pid = launcher.launch(model.id) + if (1 < pid) { + layoutHandler.makeMeVisible(pid) - applicationArea.visible = true - appLauncherAreaLauncher.visible = false - layoutHandler.showAppLayer(pid) - } - else { - console.warn("app cannot be launched!") - } - } else { - currentId = '' + applicationArea.visible = true + appLauncherAreaLauncher.visible = false + layoutHandler.showAppLayer(pid) + } + else { + console.warn("app cannot be launched!") } - } - onPositionChanged: { - if (loc.currentId === '') return - if (index < 0) return - if (index === newIndex) return - applicationModel.move(newIndex, newIndex = index) } } }