Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/IconGridDelegate.qml
Show All 18 Lines | |||||
19 | * * | 19 | * * | ||
20 | ***************************************************************************/ | 20 | ***************************************************************************/ | ||
21 | 21 | | |||
22 | import QtQuick 2.5 | 22 | import QtQuick 2.5 | ||
23 | import QtQuick.Controls 2.5 as QQC2 | 23 | import QtQuick.Controls 2.5 as QQC2 | ||
24 | import QtQuick.Layouts 1.0 | 24 | import QtQuick.Layouts 1.0 | ||
25 | 25 | | |||
26 | import org.kde.kirigami 2.8 as Kirigami | 26 | import org.kde.kirigami 2.8 as Kirigami | ||
27 | // for smallestFont | ||||
28 | import org.kde.plasma.core 2.0 as PlasmaCore | ||||
29 | | ||||
27 | 30 | | |||
28 | MouseArea { | 31 | MouseArea { | ||
29 | id: delegateRoot | 32 | id: delegateRoot | ||
30 | width: iconSize + Kirigami.Units.gridUnit | 33 | width: iconSize + Kirigami.Units.gridUnit | ||
31 | height: cellWidth + Math.round(Kirigami.Units.gridUnit * 2) | 34 | height: cellWidth + Math.round(Kirigami.Units.gridUnit * 2) | ||
32 | acceptedButtons: Qt.LeftButton | Qt.RightButton | 35 | acceptedButtons: Qt.LeftButton | Qt.RightButton | ||
33 | 36 | | |||
34 | function setAsPreview() { | 37 | function setAsPreview() { | ||
35 | preview.fullPath = fullPath | 38 | preview.fullPath = fullPath | ||
36 | preview.iconName = iconName | 39 | preview.iconName = iconName | ||
37 | preview.fileName = fileName | 40 | preview.fileName = fileName | ||
38 | preview.category = category | 41 | preview.category = category | ||
39 | preview.type = type | 42 | preview.type = type | ||
40 | preview.iconTheme = iconTheme | 43 | preview.iconTheme = iconTheme | ||
41 | preview.sizes = sizes | 44 | preview.sizes = sizes | ||
42 | preview.scalable = scalable; | 45 | preview.scalable = scalable; | ||
43 | } | 46 | } | ||
44 | 47 | | |||
45 | Rectangle { | 48 | Rectangle { | ||
46 | color: Kirigami.Theme.highlightColor | 49 | color: Kirigami.Theme.highlightColor | ||
47 | opacity: iconGrid.currentIndex == index ? 0.5 : 0.0 | 50 | opacity: iconGrid.currentIndex == index ? 0.5 : 0.0 | ||
48 | visible: opacity != 0.0 | 51 | visible: opacity != 0.0 | ||
49 | Behavior on opacity { NumberAnimation { duration: units.shortDuration } } | 52 | Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } | ||
50 | anchors { | 53 | anchors { | ||
51 | fill: parent | 54 | fill: parent | ||
52 | } | 55 | } | ||
53 | Kirigami.Theme.textColor: cuttlefish.textcolor | 56 | Kirigami.Theme.textColor: cuttlefish.textcolor | ||
54 | Kirigami.Theme.backgroundColor: cuttlefish.bgcolor | 57 | Kirigami.Theme.backgroundColor: cuttlefish.bgcolor | ||
55 | Kirigami.Theme.highlightColor: cuttlefish.highlightcolor | 58 | Kirigami.Theme.highlightColor: cuttlefish.highlightcolor | ||
56 | Kirigami.Theme.highlightedTextColor: cuttlefish.highlightedtextcolor | 59 | Kirigami.Theme.highlightedTextColor: cuttlefish.highlightedtextcolor | ||
57 | Kirigami.Theme.positiveTextColor: cuttlefish.positivetextcolor | 60 | Kirigami.Theme.positiveTextColor: cuttlefish.positivetextcolor | ||
Show All 22 Lines | |||||
80 | QQC2.Label { | 83 | QQC2.Label { | ||
81 | Kirigami.Theme.textColor: cuttlefish.textcolor | 84 | Kirigami.Theme.textColor: cuttlefish.textcolor | ||
82 | Kirigami.Theme.backgroundColor: cuttlefish.bgcolor | 85 | Kirigami.Theme.backgroundColor: cuttlefish.bgcolor | ||
83 | Kirigami.Theme.highlightColor: cuttlefish.highlightcolor | 86 | Kirigami.Theme.highlightColor: cuttlefish.highlightcolor | ||
84 | Kirigami.Theme.highlightedTextColor: cuttlefish.highlightedtextcolor | 87 | Kirigami.Theme.highlightedTextColor: cuttlefish.highlightedtextcolor | ||
85 | Kirigami.Theme.positiveTextColor: cuttlefish.positivetextcolor | 88 | Kirigami.Theme.positiveTextColor: cuttlefish.positivetextcolor | ||
86 | Kirigami.Theme.neutralTextColor: cuttlefish.neutraltextcolor | 89 | Kirigami.Theme.neutralTextColor: cuttlefish.neutraltextcolor | ||
87 | Kirigami.Theme.negativeTextColor: cuttlefish.negativetextcolor | 90 | Kirigami.Theme.negativeTextColor: cuttlefish.negativetextcolor | ||
88 | font.pointSize: iconSize > 96 ? theme.defaultFont.pointSize : theme.smallestFont.pointSize | 91 | font.pointSize: iconSize > 96 ? Kirigami.Theme.defaultFont.pointSize : theme.smallestFont.pointSize | ||
89 | text: iconName | 92 | text: iconName | ||
90 | wrapMode: Text.Wrap | 93 | wrapMode: Text.Wrap | ||
91 | maximumLineCount: 3 | 94 | maximumLineCount: 3 | ||
92 | horizontalAlignment: Text.AlignHCenter | 95 | horizontalAlignment: Text.AlignHCenter | ||
93 | opacity: iconGrid.currentIndex == index ? 1.0 : 0.7 | 96 | opacity: iconGrid.currentIndex == index ? 1.0 : 0.7 | ||
94 | anchors { | 97 | anchors { | ||
95 | left: parent.left | 98 | left: parent.left | ||
96 | right: parent.right | 99 | right: parent.right | ||
97 | top: delegateIcon.bottom | 100 | top: delegateIcon.bottom | ||
98 | topMargin: 0 | 101 | topMargin: 0 | ||
99 | margins: Math.round(-units.gridUnit / 4) | 102 | margins: Math.round(-Kirigami.Units.gridUnit / 4) | ||
100 | } | 103 | } | ||
101 | } | 104 | } | ||
102 | 105 | | |||
103 | Connections { | 106 | Connections { | ||
104 | target: iconGrid | 107 | target: iconGrid | ||
105 | onCurrentIndexChanged: { | 108 | onCurrentIndexChanged: { | ||
106 | if (delegateRoot.GridView.isCurrentItem) { | 109 | if (delegateRoot.GridView.isCurrentItem) { | ||
107 | delegateRoot.setAsPreview(); | 110 | delegateRoot.setAsPreview(); | ||
Show All 11 Lines |