Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/DualMontage.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.2 | ||||
| 23 | import QtQuick.Controls 2.5 as QQC2 | ||||
| 24 | import QtQuick.Layouts 1.0 | ||||
| 25 | import QtQuick.Dialogs 1.3 | ||||
| 26 | | ||||
| 27 | import org.kde.kirigami 2.8 as Kirigami | ||||
| 28 | | ||||
| 29 | Item { | ||||
| 30 | id: dualMontage | ||||
| 31 | visible: false | ||||
| 32 | height: 512 | ||||
| 33 | width: 512 | ||||
| 34 | Kirigami.Theme.inherit: false | ||||
| 35 | function shot() { | ||||
| 36 | ssPicker.open() | ||||
| 37 | } | ||||
| 38 | FileDialog { | ||||
| 39 | id: ssPicker | ||||
| 40 | selectExisting: false | ||||
| 41 | selectMultiple: false | ||||
| 42 | selectFolder: false | ||||
| 43 | onAccepted: { | ||||
| 44 | dualMontage.grabToImage(function(result) { | ||||
| 45 | res = result.saveToFile(ssPicker.fileUrl.toString().slice(7)) | ||||
| 46 | }); | ||||
| 47 | } | ||||
| 48 | nameFilters: [ "PNG screenshot files (*.png)" ] | ||||
| 49 | } | ||||
| 50 | Column { | ||||
| 51 | Rectangle { | ||||
| 52 | height: 256 | ||||
| 53 | width: 512 | ||||
| 54 | color: Kirigami.Theme.backgroundColor | ||||
| 55 | Kirigami.Theme.inherit: false | ||||
| 56 | Kirigami.Theme.textColor: "#232629" | ||||
| 57 | Kirigami.Theme.backgroundColor: "#eff0f1" | ||||
| 58 | Kirigami.Theme.highlightColor: "#3daee9" | ||||
| 59 | Kirigami.Theme.highlightedTextColor: "#eff0f1" | ||||
| 60 | Kirigami.Theme.positiveTextColor: "#27ae60" | ||||
| 61 | Kirigami.Theme.neutralTextColor: "#f67400" | ||||
| 62 | Kirigami.Theme.negativeTextColor: "#da4453" | ||||
| 63 | | ||||
| 64 | GridLayout { | ||||
| 65 | id: previewGrid | ||||
| 66 | anchors.centerIn: parent | ||||
| 67 | columns: sizes.length | ||||
| 68 | rows: 2 | ||||
| 69 | property var sizes: [8, 16, 22, 32, 48, 64, 128] | ||||
| 70 | Repeater { | ||||
| 71 | model: previewGrid.sizes.length | ||||
| 72 | delegate: Kirigami.Icon { | ||||
| 73 | Layout.alignment: Qt.AlignBottom | ||||
| 74 | source: preview.iconName | ||||
| 75 | width: previewGrid.sizes[index] | ||||
| 76 | height: previewGrid.sizes[index] | ||||
| 77 | } | ||||
| 78 | } | ||||
| 79 | Repeater { | ||||
| 80 | model: previewGrid.sizes.length | ||||
| 81 | delegate: QQC2.Label { | ||||
| 82 | Layout.alignment: Qt.AlignTop | Qt.AlignHCenter | ||||
| 83 | text: previewGrid.sizes[index] | ||||
| 84 | } | ||||
| 85 | } | ||||
| 86 | } | ||||
| 87 | Row { | ||||
| 88 | anchors.top: parent.top | ||||
| 89 | anchors.left: parent.left | ||||
| 90 | anchors.margins: Kirigami.Units.smallSpacing | ||||
| 91 | Kirigami.Icon { | ||||
| 92 | height: 32 | ||||
| 93 | width: 32 | ||||
| 94 | source: "cuttlefish" | ||||
| 95 | } | ||||
| 96 | QQC2.Label { | ||||
| 97 | anchors.verticalCenter: parent.verticalCenter | ||||
| 98 | text: "Montage made with Cuttlefish" | ||||
| 99 | } | ||||
| 100 | } | ||||
| 101 | } | ||||
| 102 | Rectangle { | ||||
| 103 | height: 256 | ||||
| 104 | width: 512 | ||||
| 105 | color: Kirigami.Theme.backgroundColor | ||||
| 106 | Kirigami.Theme.inherit: false | ||||
| 107 | Kirigami.Theme.textColor: "#eff0f1" | ||||
| 108 | Kirigami.Theme.backgroundColor: "#31363b" | ||||
| 109 | Kirigami.Theme.highlightColor: "#3daee9" | ||||
| 110 | Kirigami.Theme.highlightedTextColor: "#eff0f1" | ||||
| 111 | Kirigami.Theme.positiveTextColor: "#27ae60" | ||||
| 112 | Kirigami.Theme.neutralTextColor: "#f67400" | ||||
| 113 | Kirigami.Theme.negativeTextColor: "#da4453" | ||||
| 114 | | ||||
| 115 | GridLayout { | ||||
| 116 | anchors.centerIn: parent | ||||
| 117 | columns: sizes.length | ||||
| 118 | rows: 2 | ||||
| 119 | property var sizes: [8, 16, 22, 32, 48, 64, 128] | ||||
| 120 | Repeater { | ||||
| 121 | model: previewGrid.sizes.length | ||||
| 122 | delegate: Kirigami.Icon { | ||||
| 123 | Layout.alignment: Qt.AlignBottom | ||||
| 124 | source: preview.iconName | ||||
| 125 | width: previewGrid.sizes[index] | ||||
| 126 | height: previewGrid.sizes[index] | ||||
| 127 | } | ||||
| 128 | } | ||||
| 129 | Repeater { | ||||
| 130 | model: previewGrid.sizes.length | ||||
| 131 | delegate: QQC2.Label { | ||||
| 132 | Layout.alignment: Qt.AlignTop | Qt.AlignHCenter | ||||
| 133 | text: previewGrid.sizes[index] | ||||
| 134 | } | ||||
| 135 | } | ||||
| 136 | } | ||||
| 137 | } | ||||
| 138 | } | ||||
| 139 | } | ||||
| 140 | No newline at end of file | ||||