Changeset View
Changeset View
Standalone View
Standalone View
src/creator/qml/PageMetaInfo.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2018 Wolthera van Hövell tot Westerflier<griffinvalley@gmail.com> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | * later version accepted by the membership of KDE e.V. (or its | ||||
9 | * successor approved by the membership of KDE e.V.), which shall | ||||
10 | * act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | * | ||||
12 | * This library is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | * Lesser General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU Lesser General Public | ||||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | * | ||||
20 | */ | ||||
21 | | ||||
22 | import QtQuick 2.2 | ||||
23 | import QtQuick.Controls 2.2 as QtControls | ||||
24 | | ||||
25 | import org.kde.kirigami 2.1 as Kirigami | ||||
26 | /** | ||||
27 | * Page that holds an image to edit the frames on. | ||||
28 | */ | ||||
29 | import QtQuick 2.0 | ||||
30 | | ||||
31 | Kirigami.ScrollablePage { | ||||
32 | id: root; | ||||
33 | title: i18nc("title text for the page meta information editor sheet", "Edit Page Information"); | ||||
34 | property QtObject page; | ||||
35 | property string colorname: "#ffffff"; | ||||
36 | signal save(); | ||||
37 | | ||||
38 | actions { | ||||
39 | main: saveAndCloseAction; | ||||
40 | } | ||||
41 | Kirigami.Action { | ||||
42 | id: saveAndCloseAction; | ||||
43 | text: i18nc("Saves the remaining unsaved edited fields and closes the metainfo editor", "Close Editor"); | ||||
44 | iconName: "dialog-ok"; | ||||
45 | shortcut: "Esc"; | ||||
46 | onTriggered: { | ||||
47 | root.page.setTitle(defaultTitle.text, "") | ||||
48 | root.page.bgcolor = pageBackgroundColor.text; | ||||
49 | root.save(); | ||||
50 | pageStack.pop(); | ||||
51 | } | ||||
52 | } | ||||
53 | | ||||
54 | Column { | ||||
55 | id: contentColumn; | ||||
56 | width: root.width - (root.leftPadding + root.rightPadding); | ||||
57 | height: childrenRect.height; | ||||
58 | spacing: Kirigami.Units.smallSpacing; | ||||
59 | Kirigami.Heading { | ||||
60 | width: parent.width; | ||||
61 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
62 | text: i18nc("label text for the edit field for the page title", "Title"); | ||||
63 | } | ||||
64 | | ||||
65 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
66 | QtControls.TextField { | ||||
67 | id: defaultTitle; | ||||
68 | width: parent.width; | ||||
69 | placeholderText: i18nc("placeholder text for default page text-input", "Write to add default title"); | ||||
70 | text: root.page.title(""); | ||||
71 | onEditingFinished: root.page.setTitle(text, ""); | ||||
72 | } | ||||
73 | Kirigami.Heading { | ||||
74 | width: parent.width; | ||||
75 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
76 | text: i18nc("label text for the edit field for the page transition type", "Transition"); | ||||
77 | } | ||||
78 | | ||||
79 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
80 | QtControls.ComboBox { | ||||
81 | id: transition; | ||||
82 | width: parent.width; | ||||
83 | model: root.page.availableTransitions(); | ||||
84 | currentIndex: root.page.transition!==""? | ||||
85 | root.page.availableTransitions().indexOf(root.page.transition): | ||||
86 | root.page.availableTransitions().indexOf("none"); | ||||
87 | onActivated: root.page.transition = currentText; | ||||
88 | } | ||||
89 | Kirigami.Heading { | ||||
90 | width: parent.width; | ||||
91 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
92 | text: i18nc("label text for the edit field for the page background color", "Background Color"); | ||||
93 | } | ||||
94 | | ||||
95 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
96 | QtControls.TextField { | ||||
97 | id: pageBackgroundColor; | ||||
98 | width: parent.width; | ||||
99 | placeholderText: root.colorname; | ||||
100 | text: root.page.bgcolor; | ||||
101 | onEditingFinished: root.page.bgcolor = text; | ||||
102 | } | ||||
103 | | ||||
104 | Kirigami.Heading { | ||||
105 | width: parent.width; | ||||
106 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
107 | text: i18nc("label text for the edit field for the page frames", "Frames"); | ||||
108 | } | ||||
109 | ListView { | ||||
110 | width: parent.width; | ||||
111 | height: childrenRect.height; | ||||
112 | model: page.frameCount | ||||
113 | delegate: Kirigami.SwipeListItem { | ||||
114 | id: frameItem; | ||||
115 | height: Kirigami.Units.iconSizes.huge + Kirigami.Units.smallSpacing * 2; | ||||
116 | width: parent.width; | ||||
117 | supportsMouseEvents: true; | ||||
118 | actions: [ | ||||
119 | Kirigami.Action { | ||||
120 | text: i18nc("swap the position of this frame with the previous one", "Move Up"); | ||||
121 | iconName: "go-up" | ||||
122 | onTriggered: { page.swapFrames(index, index - 1); } | ||||
123 | enabled: index > 0; | ||||
124 | visible: false; //hidden because the listview doesn't update. | ||||
125 | }, | ||||
126 | Kirigami.Action { | ||||
127 | text: i18nc("swap the position of this frame with the next one", "Move Down"); | ||||
128 | iconName: "go-down" | ||||
129 | onTriggered: { page.swapFrames(index, index + 1); } | ||||
130 | enabled: index < page.frameCount - 1; | ||||
131 | visible: false; //hidden because the listview doesn't update. | ||||
132 | }, | ||||
133 | Kirigami.Action { | ||||
134 | text: i18nc("remove the frame from the page", "Delete Frame"); | ||||
135 | iconName: "list-remove" | ||||
136 | onTriggered: page.removeFrame(index); | ||||
137 | } | ||||
138 | ] | ||||
139 | Item { | ||||
140 | anchors.fill: parent; | ||||
141 | QtControls.Label { | ||||
142 | id: frameLabel; | ||||
143 | text: i18nc("Comic book panel frame name.", "Frame %1", index+1); | ||||
144 | } | ||||
145 | QtControls.Label { | ||||
146 | id: frameBgcolorLabel; | ||||
147 | anchors { | ||||
148 | top: frameLabel.bottom; | ||||
149 | topMargin: Kirigami.Units.smallSpacing; | ||||
150 | } | ||||
151 | height: frameBgcolor.height; | ||||
152 | text: i18nc("Label from frame background color.", "Background Color:"); | ||||
153 | } | ||||
154 | | ||||
155 | QtControls.TextField { | ||||
156 | anchors { | ||||
157 | top: frameLabel.bottom; | ||||
158 | topMargin: Kirigami.Units.smallSpacing; | ||||
159 | left: frameBgcolorLabel.right; | ||||
160 | leftMargin: Kirigami.Units.smallSpacing; | ||||
161 | } | ||||
162 | id: frameBgcolor; | ||||
163 | text: page.frame(index).bgcolor; | ||||
164 | onEditingFinished: page.frame(index).bgcolor = text; | ||||
165 | placeholderText: pageBackgroundColor.text !== ""? pageBackgroundColor.text : root.colorname; | ||||
166 | } | ||||
167 | } | ||||
168 | } | ||||
169 | } | ||||
170 | Kirigami.Heading { | ||||
171 | width: parent.width; | ||||
172 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
173 | text: i18nc("label text for the edit field for the page textareas", "Text Areas"); | ||||
174 | } | ||||
175 | QtControls.Label { | ||||
176 | id: textLayerBgcolorLabel; | ||||
177 | height: textLayerBgColor.height; | ||||
178 | text: i18nc("Label from textlayer background color.", "Background Color:"); | ||||
179 | } | ||||
180 | | ||||
181 | QtControls.TextField { | ||||
182 | anchors { | ||||
183 | left: textLayerBgcolorLabel.right; | ||||
184 | leftMargin: Kirigami.Units.smallSpacing; | ||||
185 | } | ||||
186 | id: textLayerBgColor; | ||||
187 | text: page.textLayer("").bgcolor; | ||||
188 | onEditingFinished: page.textLayer("").bgcolor = text; | ||||
189 | placeholderText: pageBackgroundColor.text !== ""? pageBackgroundColor.text : root.colorname; | ||||
190 | } | ||||
191 | ListView { | ||||
192 | model: page.textLayer("").textareaCount; | ||||
193 | width: parent.width; | ||||
194 | height: childrenRect.height; | ||||
195 | delegate: Kirigami.SwipeListItem { | ||||
196 | id: textAreaItem; | ||||
197 | height: Kirigami.Units.iconSizes.huge + Kirigami.Units.smallSpacing * 2; | ||||
198 | supportsMouseEvents: true; | ||||
199 | actions: [ | ||||
200 | Kirigami.Action { | ||||
201 | text: i18nc("swap the position of this text area with the previous one", "Move Up"); | ||||
202 | iconName: "go-up" | ||||
203 | onTriggered: { page.textLayer("").swapTextareas(index, index - 1); } | ||||
204 | enabled: index > 0; | ||||
205 | visible: false; | ||||
206 | }, | ||||
207 | Kirigami.Action { | ||||
208 | text: i18nc("swap the position of this text area with the next one", "Move Down"); | ||||
209 | iconName: "go-down" | ||||
210 | onTriggered: { page.textLayer("").swapTextareas(index, index + 1); } | ||||
211 | enabled: index < page.textLayer("").textareaCount - 1; | ||||
212 | visible: false; | ||||
213 | }, | ||||
214 | Kirigami.Action { | ||||
215 | text: i18nc("remove the text area from the page", "Delete Text Area"); | ||||
216 | iconName: "list-remove" | ||||
217 | onTriggered: page.textLayer("").removeTextarea(index); | ||||
218 | } | ||||
219 | ] | ||||
220 | Item { | ||||
221 | anchors.fill:parent; | ||||
222 | QtControls.Label { | ||||
223 | id: textareaLabel; | ||||
224 | text: i18nc("Comic book panel textarea name.", "Text Area %1", index+1); | ||||
225 | } | ||||
226 | QtControls.TextArea { | ||||
227 | anchors { | ||||
228 | top: textareaLabel.bottom; | ||||
229 | topMargin: Kirigami.Units.smallSpacing; | ||||
230 | } | ||||
231 | width:parent.width-Kirigami.Units.iconSizes.huge; | ||||
232 | text: page.textLayer("").textarea(index).paragraphs.join("\n\n"); | ||||
233 | onEditingFinished: page.textLayer("").textarea(index).paragraphs = text.split("\n\n"); | ||||
234 | } | ||||
235 | } | ||||
236 | } | ||||
237 | } | ||||
238 | Kirigami.Heading { | ||||
239 | width: parent.width; | ||||
240 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
241 | text: i18nc("label text for the edit field for the page jumps", "Jumps"); | ||||
242 | } | ||||
243 | ListView { | ||||
244 | model: page.jumpCount | ||||
245 | width: parent.width; | ||||
246 | height: childrenRect.height; | ||||
247 | delegate: Kirigami.SwipeListItem { | ||||
248 | id: jumpItem; | ||||
249 | height: Kirigami.Units.iconSizes.huge + Kirigami.Units.smallSpacing * 2; | ||||
250 | supportsMouseEvents: true; | ||||
251 | actions: [ | ||||
252 | Kirigami.Action { | ||||
253 | text: i18nc("swap the position of this jump with the previous one", "Move Up"); | ||||
254 | iconName: "go-up" | ||||
255 | onTriggered: { page.swapJumps(index, index - 1); } | ||||
256 | enabled: index > 0; | ||||
257 | visible: false; | ||||
258 | }, | ||||
259 | Kirigami.Action { | ||||
260 | text: i18nc("swap the position of this jump with the next one", "Move Down"); | ||||
261 | iconName: "go-down" | ||||
262 | onTriggered: { page.swapJumps(index, index + 1); } | ||||
263 | enabled: index < page.jumpCount - 1; | ||||
264 | visible: false; | ||||
265 | }, | ||||
266 | Kirigami.Action { | ||||
267 | text: i18nc("remove the jump from the page", "Delete Jump"); | ||||
268 | iconName: "list-remove" | ||||
269 | onTriggered: page.removeJump(index); | ||||
270 | } | ||||
271 | ] | ||||
272 | Item { | ||||
273 | anchors.fill:parent; | ||||
274 | QtControls.Label { | ||||
275 | id: jumpLabel; | ||||
276 | text: i18nc("Comic book panel jump name.", "Jump %1", index+1); | ||||
277 | } | ||||
278 | QtControls.Label { | ||||
279 | id: pageIndexLabel; | ||||
280 | anchors { | ||||
281 | top: jumpLabel.bottom; | ||||
282 | topMargin: Kirigami.Units.smallSpacing; | ||||
283 | } | ||||
284 | height: jumpIndexSpin.height; | ||||
285 | text: i18nc("Label from jump page index.", "Page Index:"); | ||||
286 | } | ||||
287 | | ||||
288 | QtControls.SpinBox { | ||||
289 | anchors { | ||||
290 | top: jumpLabel.bottom; | ||||
291 | topMargin: Kirigami.Units.smallSpacing; | ||||
292 | left: pageIndexLabel.right; | ||||
293 | leftMargin: Kirigami.Units.smallSpacing; | ||||
294 | } | ||||
295 | from: 0; | ||||
296 | to: 99; | ||||
297 | id: jumpIndexSpin; | ||||
298 | value: page.jump(index).pageIndex; | ||||
299 | onValueChanged: { | ||||
300 | if (page.jump(index).pageIndex !== value) { | ||||
301 | page.jump(index).pageIndex = value; | ||||
302 | } | ||||
303 | } | ||||
304 | } | ||||
305 | } | ||||
306 | } | ||||
307 | } | ||||
308 | } | ||||
309 | } |