1/* 2 SPDX-FileCopyrightText: 2019 Carson Black <uhhadd@gmail.com> 3 SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de> 4 SPDX-FileCopyrightText: 2020 Ismael Asensio <isma.af@gmail.com> 5 6 SPDX-License-Identifier: GPL-2.0-or-later 7*/ 8 9import QtQuick 2.2 10import QtQuick.Dialogs 1.3 11 12import org.kde.kirigami 2.8 as Kirigami 13 14 15Item { 16 id: screenshot 17 18 enum MontageType { 19 Active, 20 Normal, 21 Dark, 22 Dual 23 } 24 25 visible: false 26 27 signal finished 28 29 property int type: Screenshot.MontageType.Dual; 30 property Item selectedMontage: { 31 switch (type) { 32 case Screenshot.MontageType.Active: 33 return activeMontage 34 case Screenshot.MontageType.Normal: 35 return lightMontage 36 case Screenshot.MontageType.Dark: 37 return darkMontage 38 case Screenshot.MontageType.Dual: 39 return dualMontage 40 } 41 } 42 43 Kirigami.Theme.inherit: false 44 45 function shot(montageType) { 46 type = montageType 47 ssPicker.open() 48 } 49 50 FileDialog { 51 id: ssPicker 52 selectExisting: false 53 selectMultiple: false 54 selectFolder: false 55 onAccepted: { 56 selectedMontage.grabToImage(function(result) { 57 result.saveToFile(ssPicker.fileUrl.toString().slice(7)) 58 finished() 59 }); 60 } 61 onRejected: { 62 finished() 63 } 64 nameFilters: [ "PNG screenshot files (*.png)" ] 65 } 66 67 IconMontage { 68 id: activeMontage 69 showWatermark: true 70 71 width: 512 72 height: 256 73 74 Kirigami.Theme.inherit: true 75 } 76 Column { 77 id:dualMontage 78 79 IconMontage { 80 id: lightMontage 81 showWatermark: true 82 83 width: 512 84 height: 256 85 86 Kirigami.Theme.inherit: false 87 Kirigami.Theme.textColor: "#232629" 88 Kirigami.Theme.backgroundColor: "#eff0f1" 89 Kirigami.Theme.highlightColor: "#3daee9" 90 Kirigami.Theme.highlightedTextColor: "#eff0f1" 91 Kirigami.Theme.positiveTextColor: "#27ae60" 92 Kirigami.Theme.neutralTextColor: "#f67400" 93 Kirigami.Theme.negativeTextColor: "#da4453" 94 } 95 IconMontage { 96 id: darkMontage 97 showWatermark: screenshot.type == Screenshot.MontageType.Dark 98 99 width: 512 100 height: 256 101 102 Kirigami.Theme.inherit: false 103 Kirigami.Theme.textColor: "#eff0f1" 104 Kirigami.Theme.backgroundColor: "#31363b" 105 Kirigami.Theme.highlightColor: "#3daee9" 106 Kirigami.Theme.highlightedTextColor: "#eff0f1" 107 Kirigami.Theme.positiveTextColor: "#27ae60" 108 Kirigami.Theme.neutralTextColor: "#f67400" 109 Kirigami.Theme.negativeTextColor: "#da4453" 110 } 111 } 112} 113