Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/ResponsivePreview.qml
- This file was added.
| 1 | /*************************************************************************** | ||||
|---|---|---|---|---|---|
| 2 | * * | ||||
| 3 | * Copyright 2019 Carson Black <uhhadd@gmail.com> * | ||||
| 4 | * * | ||||
| 5 | * This program is free software; you can redistribute it and/or modify * | ||||
| 6 | * it under the terms of the GNU General Public License as published by * | ||||
| 7 | * the Free Software Foundation; either version 2 of the License, or * | ||||
| 8 | * (at your option) any later version. * | ||||
| 9 | * * | ||||
| 10 | * This program is distributed in the hope that it will be useful, * | ||||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||||
| 13 | * GNU General Public License for more details. * | ||||
| 14 | * * | ||||
| 15 | * You should have received a copy of the GNU General Public License * | ||||
| 16 | * along with this program; if not, write to the * | ||||
| 17 | * Free Software Foundation, Inc., * | ||||
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||||
| 19 | * * | ||||
| 20 | ***************************************************************************/ | ||||
| 21 | | ||||
| 22 | import QtQuick 2.5 | ||||
| 23 | import QtQuick.Controls 2.5 as QQC2 | ||||
| 24 | import QtQuick.Layouts 1.0 | ||||
| 25 | | ||||
| 26 | import org.kde.kirigami 2.8 as Kirigami | ||||
| 27 | | ||||
| 28 | Kirigami.GlobalDrawer { | ||||
| 29 | id: root | ||||
| 30 | edge: Qt.RightEdge | ||||
| 31 | | ||||
| 32 | handleOpenIcon.source: "dialog-close" | ||||
| 33 | handleClosedIcon.source: "view-preview" | ||||
| 34 | | ||||
| 35 | Kirigami.Theme.textColor: cuttlefish.textcolor | ||||
| 36 | Kirigami.Theme.backgroundColor: cuttlefish.bgcolor | ||||
| 37 | Kirigami.Theme.highlightColor: cuttlefish.highlightcolor | ||||
| 38 | Kirigami.Theme.highlightedTextColor: cuttlefish.highlightedtextcolor | ||||
| 39 | Kirigami.Theme.positiveTextColor: cuttlefish.positivetextcolor | ||||
| 40 | Kirigami.Theme.neutralTextColor: cuttlefish.neutraltextcolor | ||||
| 41 | Kirigami.Theme.negativeTextColor: cuttlefish.negativetextcolor | ||||
| 42 | | ||||
| 43 | focus: false | ||||
| 44 | | ||||
| 45 | function clipboard(text) { | ||||
| 46 | if (!pickerMode) { | ||||
| 47 | clipboardHelper.text = text; | ||||
| 48 | clipboardHelper.selectAll(); | ||||
| 49 | clipboardHelper.copy(); | ||||
| 50 | } else { | ||||
| 51 | iconModel.output(text); | ||||
| 52 | } | ||||
| 53 | } | ||||
| 54 | | ||||
| 55 | TextEdit { | ||||
| 56 | id: clipboardHelper | ||||
| 57 | visible: false | ||||
| 58 | } | ||||
| 59 | | ||||
| 60 | actions: [ | ||||
| 61 | Kirigami.Action { | ||||
| 62 | text: i18n("Open icon with external program") | ||||
| 63 | iconName: "document-open" | ||||
| 64 | onTriggered: Qt.openUrlExternally(preview.fullPath) | ||||
| 65 | }, | ||||
| 66 | Kirigami.Action { | ||||
| 67 | text: i18n("Copy icon name to clipboard") | ||||
| 68 | iconName: "edit-copy" | ||||
| 69 | onTriggered: { | ||||
| 70 | root.clipboard(preview.iconName) | ||||
| 71 | cuttlefish.showPassiveNotification(i18n("Icon name copied to clipboard"), "short") | ||||
| 72 | } | ||||
| 73 | }, | ||||
| 74 | Kirigami.Action { | ||||
| 75 | iconName: "camera-web-symbolic" | ||||
| 76 | text: i18n("Create screenshot of icon with...") | ||||
| 77 | Kirigami.Action { | ||||
| 78 | text: i18n("Breeze Colors") | ||||
| 79 | onTriggered: iconPreview.shot("normal") | ||||
| 80 | } | ||||
| 81 | Kirigami.Action { | ||||
| 82 | text: i18n("Breeze Dark Colors") | ||||
| 83 | onTriggered: iconPreview.shot("dark") | ||||
| 84 | } | ||||
| 85 | Kirigami.Action { | ||||
| 86 | onTriggered: dualMont.shot() | ||||
| 87 | text: i18n("Breeze (Normal) and Breeze Dark") | ||||
| 88 | } | ||||
| 89 | Kirigami.Action { | ||||
| 90 | onTriggered: iconPreview.shot("active") | ||||
| 91 | text: i18n("Active Color Scheme") | ||||
| 92 | } | ||||
| 93 | } | ||||
| 94 | ] | ||||
| 95 | Kirigami.Heading { | ||||
| 96 | level: 1 | ||||
| 97 | Layout.fillWidth: true | ||||
| 98 | wrapMode: Text.Wrap | ||||
| 99 | horizontalAlignment: Text.AlignHCenter | ||||
| 100 | elide: Text.ElideRight | ||||
| 101 | text: preview.iconName | ||||
| 102 | } | ||||
| 103 | Kirigami.FormLayout { | ||||
| 104 | Layout.fillWidth: true | ||||
| 105 | Layout.topMargin: Kirigami.Units.largeSpacing | ||||
| 106 | QQC2.Label { | ||||
| 107 | Layout.maximumWidth: Kirigami.Units.gridUnit * 10 | ||||
| 108 | Kirigami.FormData.label: i18n("File name:") | ||||
| 109 | elide: Text.ElideRight | ||||
| 110 | text: preview.fileName | ||||
| 111 | } | ||||
| 112 | QQC2.Label { | ||||
| 113 | Kirigami.FormData.label: i18n("Category:") | ||||
| 114 | font.capitalization: Font.Capitalize | ||||
| 115 | text: preview.category | ||||
| 116 | } | ||||
| 117 | QQC2.Label { | ||||
| 118 | Kirigami.FormData.label: i18n("Scalable:") | ||||
| 119 | text: preview.scalable ? i18n("yes") : i18n("no") | ||||
| 120 | font.capitalization: Font.Capitalize | ||||
| 121 | } | ||||
| 122 | } | ||||
| 123 | GridLayout { | ||||
| 124 | id: grid | ||||
| 125 | columns: 2 | ||||
| 126 | property var sizes: [8, 16, 22, 32, 48, 64] | ||||
| 127 | Layout.alignment: Qt.AlignHCenter | ||||
| 128 | Repeater { | ||||
| 129 | model: parent.sizes.length | ||||
| 130 | delegate: ColumnLayout { | ||||
| 131 | Kirigami.Icon { | ||||
| 132 | Layout.alignment: Qt.AlignBottom | ||||
| 133 | source: preview.iconName | ||||
| 134 | width: grid.sizes[index] | ||||
| 135 | height: grid.sizes[index] | ||||
| 136 | } | ||||
| 137 | QQC2.Label { | ||||
| 138 | Layout.alignment: Qt.AlignTop | Qt.AlignHCenter | ||||
| 139 | text: grid.sizes[index] | ||||
| 140 | Behavior on color { | ||||
| 141 | ColorAnimation { | ||||
| 142 | duration: Kirigami.Units.longDuration | ||||
| 143 | } | ||||
| 144 | } | ||||
| 145 | } | ||||
| 146 | } | ||||
| 147 | } | ||||
| 148 | } | ||||
| 149 | } | ||||
| 150 | No newline at end of file | ||||