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 | ||||
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 | height: Kirigami.Units.gridUnit * 50 | ||
| 35 | height: Math.round(width / 3 * 2) | 33 | width: Kirigami.Units.gridUnit * 50 | ||
filipf: you can just do `width: height` | |||||
| 36 | 34 | | |||
| 37 | property int iconSize: units.iconSizes.large | 35 | property int iconSize: units.iconSizes.large | ||
| 38 | property bool hoveredHighlight: false | | |||
| 39 | property bool darkScheme: false | 36 | property bool darkScheme: false | ||
davidre: Why not Kirigami units here? | |||||
| 40 | property bool usesPlasmaTheme: true | 37 | property bool usesPlasmaTheme: true | ||
| 41 | 38 | | |||
| 42 | function indexToSize(ix) { | 39 | function indexToSize(ix) { | ||
| 43 | 40 | | |||
| 44 | var sizes = new Array(); | 41 | var sizes = new Array(); | ||
| 45 | sizes[0] = units.iconSizes.tiny; | 42 | sizes[0] = Kirigami.Units.iconSizes.tiny; | ||
| 46 | sizes[1] = units.iconSizes.small; | 43 | sizes[1] = Kirigami.Units.iconSizes.small; | ||
| 47 | sizes[2] = units.iconSizes.smallMedium; | 44 | sizes[2] = Kirigami.Units.iconSizes.smallMedium; | ||
| 48 | sizes[3] = units.iconSizes.medium; | 45 | sizes[3] = Kirigami.Units.iconSizes.medium; | ||
| 49 | sizes[4] = units.iconSizes.large; | 46 | sizes[4] = Kirigami.Units.iconSizes.large; | ||
| 50 | sizes[5] = units.iconSizes.huge; | 47 | sizes[5] = Kirigami.Units.iconSizes.huge; | ||
| 51 | sizes[6] = units.iconSizes.enormous; | 48 | sizes[6] = Kirigami.Units.iconSizes.enormous; | ||
| 52 | 49 | | |||
| 53 | return sizes[ix]; | 50 | return sizes[ix]; | ||
| 54 | } | 51 | } | ||
| 55 | 52 | | |||
| 56 | PlasmaCore.ColorScope { | | |||
| 57 | anchors.fill: parent | | |||
| 58 | colorGroup: darkScheme ? PlasmaCore.Theme.ComplementaryColorGroup : PlasmaCore.Theme.NormalColorGroup | | |||
| 59 | Rectangle { | 53 | Rectangle { | ||
| 60 | color: PlasmaCore.ColorScope.backgroundColor | 54 | color: Kirigami.Theme.backgroundColor | ||
| 61 | anchors.fill: parent | 55 | anchors.fill: parent | ||
| 62 | } | 56 | } | ||
| 57 | Rectangle { | ||||
| 58 | Kirigami.Theme.colorSet: Kirigami.Theme.View | ||||
| 59 | color: Kirigami.Theme.backgroundColor | ||||
| 60 | x: grid.x | ||||
| 61 | y: grid.y | ||||
| 62 | width: grid.width | ||||
| 63 | height: grid.height | ||||
| 64 | } | ||||
| 63 | 65 | | |||
| 64 | GridLayout { | 66 | ColumnLayout { | ||
| 65 | columns: 2 | | |||
| 66 | anchors.fill: parent | 67 | anchors.fill: parent | ||
| 67 | rowSpacing: - Math.round(units.gridUnit / 20) | 68 | spacing: 0 | ||
| 68 | 69 | | |||
| 69 | Tools { | 70 | Tools { | ||
| 70 | Layout.columnSpan: 2 | | |||
| 71 | Layout.fillWidth: true | 71 | Layout.fillWidth: true | ||
| 72 | Layout.preferredHeight: units.gridUnit * 2 | 72 | Layout.preferredHeight: Kirigami.Units.gridUnit * 2 | ||
| 73 | } | 73 | } | ||
| 74 | 74 | | |||
| 75 | PlasmaExtras.ScrollArea { | 75 | ScrollView { | ||
| 76 | id: grid | ||||
| 76 | Layout.fillWidth: true | 77 | Layout.fillWidth: true | ||
| 77 | Layout.fillHeight: true | 78 | Layout.fillHeight: true | ||
| 79 | ScrollBar.horizontal.policy: ScrollBar.AlwaysOff | ||||
| 78 | IconGrid { | 80 | IconGrid { | ||
| 79 | id: iconGrid | 81 | id: iconGrid | ||
| 80 | anchors.fill: parent | 82 | anchors.fill: parent | ||
| 83 | anchors.margins: Kirigami.Units.largeSpacing | ||||
| 81 | 84 | | |||
| 82 | footer: SvgGrid { | 85 | footer: SvgGrid { | ||
| 83 | id: svgGrid | 86 | id: svgGrid | ||
| 84 | interactive: false | 87 | interactive: false | ||
| 85 | } | 88 | } | ||
| 86 | } | 89 | } | ||
| 87 | } | 90 | } | ||
| 88 | Preview { | 91 | Preview { | ||
| 89 | id: preview | 92 | Layout.fillWidth: true | ||
| 90 | Layout.preferredWidth: Math.max(parent.width / 4, units.gridUnit * 12) | 93 | Layout.preferredHeight: Kirigami.Units.gridUnit * 15 | ||
| 91 | Layout.fillHeight: true | | |||
| 92 | } | 94 | } | ||
| 93 | } | 95 | } | ||
| 96 | Item { | ||||
| 97 | id: preview | ||||
| 98 | property string iconName: "plasma" | ||||
| 99 | property string fullPath: "" | ||||
| 100 | property string category: "" | ||||
| 101 | property string fileName: "" | ||||
| 102 | property string type: "" | ||||
| 103 | property string iconTheme: "" | ||||
| 104 | property variant sizes: [] | ||||
| 105 | property bool scalable: true | ||||
| 94 | } | 106 | } | ||
| 95 | 107 | | |||
| 96 | Shortcut { | 108 | Shortcut { | ||
| 97 | sequence: StandardKey.Quit | 109 | sequence: StandardKey.Quit | ||
| 98 | onActivated: Qt.quit() | 110 | onActivated: Qt.quit() | ||
| 99 | } | 111 | } | ||
| 100 | } | 112 | } | ||
ditto