2 * Copyright (C) 2016 The Qt Company Ltd.
3 * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
4 * Copyright (c) 2018,2019 TOYOTA MOTOR CORPORATION
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 import QtQuick.Layouts 1.1
20 import QtQuick.Controls 2.0
24 width: container.width * container.scale
25 height: container.height * container.scale
31 anchors.centerIn: parent
34 // scale: screenInfo.scale_factor()
42 source: './images/top_three_shortcut_background.png'
54 source: './images/meterdisplay.png'
58 anchors.left: meterDisplay.right
59 anchors.top: meterDisplay.top
62 source: './images/hud.png'
66 anchors.left: hud.right
70 source: './images/rse.png'
74 anchors.left: rse.right
78 source: './images/uninstall.png'
83 source: './images/background.png'
89 topMargin: 60 + 218; bottomMargin: 0
90 leftMargin: 60; rightMargin: 60
94 flickableDirection: Flickable.AutoFlickDirection
95 snapMode: GridView.SnapOneRow
101 model: ApplicationModel { id: applicationModel }
103 width: grid.cellWidth
104 height: grid.cellHeight
108 target: homescreenHandler
110 console.warn("applist update in Launcher.qml")
111 applicationModel.updateApplist(info);
115 target: homescreenHandler
117 console.warn("applist init in Launcher.qml")
118 applicationModel.initAppList(data);
125 property string currentId: ''
126 property string currentName: ''
127 property int oldIndex: -1
128 property int newIndex: -1
129 property int index: grid.indexAt(loc.mouseX, loc.mouseY)
135 currentId = applicationModel.id(newIndex = index)
136 currentName = applicationModel.name(loc.index)
137 homescreenHandler.hideWindow("homescreen")
140 if (currentId === '' && loc.index >= 0 ) {
141 // Not long press, exec application and tapshortcut
142 pid = launcher.launch(applicationModel.id(loc.index))
144 homescreenHandler.tapShortcut(applicationModel.appid(loc.index))
147 console.warn("app cannot be launched!")
149 } else if (loc.mouseY <= 0) {
150 if (loc.mouseX >= 197 && loc.mouseX < 393) {
151 // shortcutAppModel.changeShortcut(currentId, currentName, "0");
152 homescreenHandler.registerShortcut(currentId, currentName, "0");
153 } else if (loc.mouseX >= 393 && loc.mouseX < 589) {
154 // shortcutAppModel.changeShortcut(currentId, currentName, "1");
155 homescreenHandler.registerShortcut(currentId, currentName, "1");
156 } else if (loc.mouseX >= 589 && loc.mouseX < 785) {
157 // shortcutAppModel.changeShortcut(currentId, currentName, "2");
158 homescreenHandler.registerShortcut(currentId, currentName, "2");
160 if (oldIndex != newIndex){
161 applicationModel.move(newIndex, newIndex = oldIndex)
163 } else if (loc.mouseY >= 1488) {
164 if (loc.mouseX < 270 ) {
165 console.log("sendAppToMeter", currentId)
166 homescreenHandler.sendAppToMeter(currentId)
167 } else if (loc.mouseX >= 270 && loc.mouseX < 540 ) {
169 } else if (loc.mouseX >= 540 && loc.mouseX < 810 ) {
171 } else if (loc.mouseX >= 810) {
172 uninstallDialog.contents = 'Do you want to uninstall ' + currentName.toUpperCase() + '?'
173 uninstallDialog.uninstallApp = currentId
174 uninstallDialog.visible = true
180 homescreenHandler.tapShortcut("homescreen")
183 if (loc.currentId === '') return
184 if (index < 0) return
185 if (index === newIndex) return
186 applicationModel.move(newIndex, newIndex = index)