Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/cuttlefish.qml
Show All 15 Lines | |||||
16 | * along with this program; if not, write to the * | 16 | * along with this program; if not, write to the * | ||
17 | * Free Software Foundation, Inc., * | 17 | * Free Software Foundation, Inc., * | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
19 | * * | 19 | * * | ||
20 | ***************************************************************************/ | 20 | ***************************************************************************/ | ||
21 | 21 | | |||
22 | import QtQuick 2.5 | 22 | import QtQuick 2.5 | ||
23 | import QtQuick.Layouts 1.0 | 23 | import QtQuick.Layouts 1.0 | ||
24 | import QtQuick.Controls 2.5 as QQC2 | ||||
ngraham: ditto | |||||
ngraham: Not done | |||||
24 | 25 | | |||
25 | import org.kde.plasma.core 2.0 as PlasmaCore | 26 | import org.kde.kirigami 2.4 as Kirigami | ||
26 | import org.kde.plasma.components 2.0 as PlasmaComponents | | |||
27 | import org.kde.plasma.extras 2.0 as PlasmaExtras | | |||
28 | | ||||
29 | 27 | | |||
30 | Item { | 28 | Item { | ||
31 | id: cuttlefish | 29 | id: cuttlefish | ||
32 | objectName: "cuttlefish" | 30 | objectName: "cuttlefish" | ||
33 | 31 | | |||
34 | width: units.gridUnit * 60 | 32 | property int iconSize: Kirigami.Units.iconSizes.large | ||
filipf: you can just do `width: height` | |||||
davidre: Why not Kirigami units here? | |||||
35 | height: Math.round(width / 3 * 2) | | |||
36 | | ||||
37 | property int iconSize: units.iconSizes.large | | |||
38 | property bool hoveredHighlight: false | | |||
39 | property bool darkScheme: false | 33 | property bool darkScheme: false | ||
40 | property bool usesPlasmaTheme: true | 34 | property bool usesPlasmaTheme: true | ||
41 | 35 | | |||
42 | function indexToSize(ix) { | 36 | function indexToSize(ix) { | ||
43 | 37 | | |||
44 | var sizes = new Array(); | 38 | var sizes = new Array(); | ||
45 | sizes[0] = units.iconSizes.tiny; | 39 | sizes[0] = Kirigami.Units.iconSizes.tiny; | ||
46 | sizes[1] = units.iconSizes.small; | 40 | sizes[1] = Kirigami.Units.iconSizes.small; | ||
47 | sizes[2] = units.iconSizes.smallMedium; | 41 | sizes[2] = Kirigami.Units.iconSizes.smallMedium; | ||
48 | sizes[3] = units.iconSizes.medium; | 42 | sizes[3] = Kirigami.Units.iconSizes.medium; | ||
49 | sizes[4] = units.iconSizes.large; | 43 | sizes[4] = Kirigami.Units.iconSizes.large; | ||
50 | sizes[5] = units.iconSizes.huge; | 44 | sizes[5] = Kirigami.Units.iconSizes.huge; | ||
51 | sizes[6] = units.iconSizes.enormous; | 45 | sizes[6] = Kirigami.Units.iconSizes.enormous; | ||
52 | 46 | | |||
53 | return sizes[ix]; | 47 | return sizes[ix]; | ||
54 | } | 48 | } | ||
55 | 49 | | |||
56 | PlasmaCore.ColorScope { | | |||
57 | anchors.fill: parent | | |||
58 | colorGroup: darkScheme ? PlasmaCore.Theme.ComplementaryColorGroup : PlasmaCore.Theme.NormalColorGroup | | |||
59 | Rectangle { | 50 | Rectangle { | ||
60 | color: PlasmaCore.ColorScope.backgroundColor | 51 | color: Kirigami.Theme.backgroundColor | ||
61 | anchors.fill: parent | 52 | anchors.fill: parent | ||
62 | } | 53 | } | ||
54 | Rectangle { | ||||
55 | Kirigami.Theme.colorSet: Kirigami.Theme.View | ||||
56 | color: Kirigami.Theme.backgroundColor | ||||
57 | x: grid.x | ||||
58 | y: grid.y | ||||
59 | width: grid.width | ||||
60 | height: grid.height | ||||
61 | } | ||||
63 | 62 | | |||
64 | GridLayout { | 63 | ColumnLayout { | ||
65 | columns: 2 | | |||
66 | anchors.fill: parent | 64 | anchors.fill: parent | ||
67 | rowSpacing: - Math.round(units.gridUnit / 20) | 65 | spacing: 0 | ||
68 | 66 | | |||
69 | Tools { | 67 | Tools { | ||
70 | Layout.columnSpan: 2 | | |||
71 | Layout.fillWidth: true | 68 | Layout.fillWidth: true | ||
72 | Layout.preferredHeight: units.gridUnit * 2 | 69 | Layout.preferredHeight: (Kirigami.Units.gridUnit * 2) + Kirigami.Units.largeSpacing | ||
73 | } | 70 | } | ||
74 | 71 | | |||
75 | PlasmaExtras.ScrollArea { | 72 | QQC2.ScrollView { | ||
73 | id: grid | ||||
76 | Layout.fillWidth: true | 74 | Layout.fillWidth: true | ||
77 | Layout.fillHeight: true | 75 | Layout.fillHeight: true | ||
76 | QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff | ||||
78 | IconGrid { | 77 | IconGrid { | ||
79 | id: iconGrid | 78 | id: iconGrid | ||
80 | anchors.fill: parent | 79 | anchors.fill: parent | ||
81 | 80 | | |||
82 | footer: SvgGrid { | 81 | footer: SvgGrid { | ||
83 | id: svgGrid | 82 | id: svgGrid | ||
84 | interactive: false | 83 | interactive: false | ||
85 | } | 84 | } | ||
86 | } | 85 | } | ||
87 | } | 86 | } | ||
88 | Preview { | 87 | Preview { | ||
89 | id: preview | 88 | Layout.fillWidth: true | ||
90 | Layout.preferredWidth: Math.max(parent.width / 4, units.gridUnit * 12) | 89 | Layout.preferredHeight: Kirigami.Units.gridUnit * 15 | ||
91 | Layout.fillHeight: true | | |||
92 | } | 90 | } | ||
93 | } | 91 | } | ||
92 | Item { | ||||
93 | id: preview | ||||
94 | property string iconName: "plasma" | ||||
95 | property string fullPath: "" | ||||
96 | property string category: "" | ||||
97 | property string fileName: "" | ||||
98 | property string type: "" | ||||
99 | property string iconTheme: "" | ||||
100 | property variant sizes: [] | ||||
101 | property bool scalable: true | ||||
94 | } | 102 | } | ||
95 | 103 | | |||
96 | Shortcut { | 104 | Shortcut { | ||
97 | sequence: StandardKey.Quit | 105 | sequence: StandardKey.Quit | ||
98 | onActivated: Qt.quit() | 106 | onActivated: Qt.quit() | ||
99 | } | 107 | } | ||
100 | } | 108 | } |
ditto