2 * Copyright (C) 2018 The Qt Company Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 import QtQuick.Layouts 1.1
19 import QtQuick.Controls 2.0
23 property alias model: listView.model
25 property int appSize: 0
26 property int pageSize: 0
27 property int currentPageIndex: 0
29 property int nPullHeight: 100
33 anchors.horizontalCenter: parent.horizontalCenter
43 anchors.margins: root.width * 0.075
48 //anchors.fill: parent
49 //anchors.margins: root.width * 0.075
61 Layout.preferredWidth: 100
62 Layout.preferredHeight: 100
68 stack.push("qrc:/pages/DetailPage.qml", {stack: stack, model: model}, StackView.Immediate)
78 Layout.fillWidth: true
79 text: model.name.toUpperCase()
83 text: 'Version: ' + model.version
88 text: 'Description: ' + model.description
91 elide: Text.ElideRight
92 Layout.preferredWidth: 400
93 Layout.preferredHeight: 40
98 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
102 text: model.statetext
104 if (model.statetext === 'Install' || model.statetext === 'Update') {
105 listView.model.install(model.index)
106 } else if (model.statetext === 'Launch') {
107 if (listView.model.launch(model.id) > 1) {
108 homescreenHandler.tapShortcut(model.name)
110 console.warn('app cannot be launched')
116 //Layout.rightMargin: 5
123 progress: model.progress
126 source: 'qrc:/images/DividingLine.svg'
127 anchors.horizontalCenter: parent.horizontalCenter
128 anchors.top: parent.top
129 visible: model.index > 0
137 name: "prevPageState"; when: listView.contentY < -nPullHeight
139 name: "prevPageScript"
140 script: getPrevPage()
146 function getPrevPage() {
147 listView.y = nPullHeight;
149 currentPageIndex = currentPageIndex > 0 ? currentPageIndex-1 : 0;
150 prevBusyIndicator.running = true
151 prevPageTimer.start();
160 listView.model.getPrevPage(currentPageIndex)
161 prevPageAnimation.start();
166 id: prevPageAnimation
173 prevBusyIndicator.running = false
179 target: listView.model
180 onRequestCompleted: {
183 console.log("request completed!", appSize, pageSize)