18
import Ubuntu.Components 1.1
18
import Ubuntu.Components 1.2
19
19
import Ubuntu.Components.ListItems 1.0 as ListItems
20
20
import Unity.Launcher 0.1
21
21
import Ubuntu.Components.Popups 0.1
109
110
preferredHighlightBegin: (height - itemHeight) / 2
110
111
preferredHighlightEnd: (height + itemHeight) / 2
113
// for the single peeking icon, when alert-state is set on delegate
114
property int peekingIndex: -1
112
116
// The size of the area the ListView is extended to make sure items are not
113
117
// destroyed when dragging them outside the list. This needs to be at least
114
118
// itemHeight to prevent folded items from disappearing and DragArea limits
159
163
to: launcherListView.contentHeight - launcherListView.height + launcherListView.originY - launcherListView.topMargin
166
UbuntuNumberAnimation {
168
target: launcherListView
170
function moveTo(contentY) {
171
from = launcherListView.contentY;
162
177
displaced: Transition {
163
178
NumberAnimation { properties: "x,y"; duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
180
195
progress: model.progress
181
196
itemFocused: model.focused
182
197
inverted: root.inverted
198
alerting: model.alerting
183
199
z: -Math.abs(offset)
185
201
property bool dragging: false
203
SequentialAnimation {
207
PropertyAction { target: root; property: "visible"; value: (launcher.visibleWidth === 0) ? 1 : 0 }
208
PropertyAction { target: launcherListViewItem; property: "clip"; value: 0 }
210
UbuntuNumberAnimation {
211
target: launcherDelegate
215
to: (units.gu(.5) + launcherListView.width * .5) * (root.inverted ? -1 : 1)
216
duration: UbuntuAnimation.BriskDuration
220
UbuntuNumberAnimation {
221
target: launcherDelegate
226
duration: UbuntuAnimation.BriskDuration
229
PropertyAction { target: launcherListViewItem; property: "clip"; value: 1 }
230
PropertyAction { target: root; property: "visible"; value: (launcher.visibleWidth === 0) ? 0 : 1 }
235
if (!dragging && (launcherListView.peekingIndex === -1 || launcher.visibleWidth > 0)) {
236
var itemPosition = index * launcherListView.itemHeight;
237
var height = launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin
238
var distanceToEnd = index == 0 || index == launcherListView.count - 1 ? 0 : launcherListView.itemHeight
239
if (itemPosition + launcherListView.itemHeight + distanceToEnd > launcherListView.contentY + launcherListView.topMargin + height) {
240
moveAnimation.moveTo(itemPosition + launcherListView.itemHeight - launcherListView.topMargin - height + distanceToEnd);
241
} else if (itemPosition - distanceToEnd < launcherListView.contentY + launcherListView.topMargin) {
242
moveAnimation.moveTo(itemPosition - distanceToEnd - launcherListView.topMargin);
244
if (!dragging && launcher.state !== "visible") {
245
peekingAnimation.start()
249
if (launcherListView.peekingIndex === -1) {
250
launcherListView.peekingIndex = index
253
if (launcherListView.peekingIndex === index) {
254
launcherListView.peekingIndex = -1
188
260
id: dropIndicator
189
261
objectName: "dropIndicator"
297
370
property int draggedIndex: -1
298
371
property var selectedItem
299
372
property bool preDragging: false
300
property bool dragging: selectedItem !== undefined && selectedItem !== null && selectedItem.dragging
373
property bool dragging: !!selectedItem && selectedItem.dragging
301
374
property bool postDragging: false
302
375
property int startX
303
376
property int startY
391
if (mouse.button & Qt.RightButton) { // context menu
393
quickList.item = clickedItem;
394
quickList.model = launcherListView.model.get(index).quickList;
395
quickList.appId = launcherListView.model.get(index).appId;
396
quickList.state = "open";
318
400
// First/last item do the scrolling at more than 12 degrees
319
401
if (index == 0 || index == launcherListView.count - 1) {
320
402
if (clickedItem.angle > 12) {
524
leftMargin: (quickList.item.width - units.gu(1)) / 2 - width / 2
606
rightMargin: -units.dp(4)
525
607
verticalCenter: parent.verticalCenter
526
verticalCenterOffset: (parent.height / 2 + units.dp(3)) * (quickList.offset > 0 ? 1 : -1) * (root.inverted ? 1 : -1)
608
verticalCenterOffset: -quickList.offset * (root.inverted ? -1 : 1)
528
610
height: units.gu(1)
529
611
width: units.gu(2)
530
612
source: "graphics/quicklist_tooltip.png"
531
rotation: (quickList.offset > 0 ? 0 : 180) + (root.inverted ? 0 : 180)
534
616
InverseMouseArea {
551
633
height: quickListColumn.height
552
634
visible: quickListShape.visible
554
left: root.inverted ? undefined : parent.left
555
right: root.inverted ? parent.right : undefined
636
left: root.inverted ? undefined : parent.right
637
right: root.inverted ? parent.left : undefined
556
638
margins: units.gu(1)
558
y: itemCenter + offset
640
y: itemCenter - (height / 2) + offset
559
641
rotation: root.rotation
561
643
property var model
566
648
property int itemCenter: item ? root.mapFromItem(quickList.item).y + (item.height / 2) : units.gu(1)
567
property int offset: itemCenter + (item.height/2) + height + units.gu(1) > parent.height ?
568
-(item.height/2) - height - units.gu(.5) :
569
(item.height/2) + units.gu(.5)
649
property int offset: itemCenter + (height/2) + units.gu(1) > parent.height ? -itemCenter - (height/2) - units.gu(1) + parent.height :
650
itemCenter - (height/2) < units.gu(1) ? (height/2) - itemCenter + units.gu(1) : 0
572
653
id: quickListColumn