2 * Copyright (C) 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 signal clicked(int index, var result, var itemModel)
23 signal pressAndHold(int index)
25 property var cardTool: null
26 property real scopeHeight: 0
27 property real scopeWidth: 0
28 property real appliedScale: 1
29 property int currentIndex: -1
30 property var currentItem: currentIndex < repeater.count ? repeater.itemAt(currentIndex) : null
32 property alias model: repeater.model
35 contentWidth: repeater.count * root.scopeWidth + units.gu(2) / appliedScale * (repeater.count - 1)
38 var indexX = currentIndex * scopeWidth + units.gu(2) / appliedScale * currentIndex;
39 var newContentX = indexX - (width - scopeWidth) / 2;
40 newContentX = Math.min(Math.max(newContentX, 0), contentWidth - width);
46 objectName: "scopesOverviewFavoritesRepeater"
51 x: index * root.scopeWidth + units.gu(2) / appliedScale * index
54 sourceComponent: cardTool.cardComponent
56 item.fixedArtShapeSize = Qt.binding(function() { return Qt.size(root.scopeWidth, root.scopeHeight); });
57 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; });
58 item.fontScale = Qt.binding(function() { return 1 / appliedScale; });
59 item.height = Qt.binding(function() { return root.scopeHeight; });
60 item.width = Qt.binding(function() { return root.scopeWidth; });
61 item.cardData = Qt.binding(function() { return model; });
62 item.template = Qt.binding(function() { return cardTool.template; });
63 item.components = Qt.binding(function() { return cardTool.components; });
64 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
69 onClicked: root.clicked(index, result, model)