Changeset View
Changeset View
Standalone View
Standalone View
src/creator/qml/BookMetainfoPage.qml
Context not available. | |||||
45 | text: i18nc("Saves the remaining unsaved edited fields and closes the metainfo editor", "Save and Close Editor"); | 45 | text: i18nc("Saves the remaining unsaved edited fields and closes the metainfo editor", "Save and Close Editor"); | ||
---|---|---|---|---|---|
46 | iconName: "dialog-ok"; | 46 | iconName: "dialog-ok"; | ||
47 | onTriggered: { | 47 | onTriggered: { | ||
48 | // Save the default title/annotation/keywords. | ||||
49 | root.model.acbfData.metaData.bookInfo.setTitle(defaultTitle.text, ""); | ||||
50 | root.model.acbfData.metaData.bookInfo.setAnnotation(defaultAnnotation.text.split("\n\n"), ""); | ||||
51 | var keywords = defaultKeywords.text.split(",") | ||||
52 | for (var i in keywords) { | ||||
53 | keywords[i] = keywords[i].trim(); | ||||
54 | } | ||||
55 | root.model.acbfData.metaData.bookInfo.setKeywords(keywords, ""); | ||||
56 | | ||||
48 | root.model.setDirty(); | 57 | root.model.setDirty(); | ||
49 | pageStack.pop(); | 58 | pageStack.pop(); | ||
50 | } | 59 | } | ||
Context not available. | |||||
55 | width: root.width - (root.leftPadding + root.rightPadding); | 64 | width: root.width - (root.leftPadding + root.rightPadding); | ||
56 | height: childrenRect.height; | 65 | height: childrenRect.height; | ||
57 | spacing: Kirigami.Units.smallSpacing; | 66 | spacing: Kirigami.Units.smallSpacing; | ||
67 | | ||||
58 | Kirigami.Heading { | 68 | Kirigami.Heading { | ||
59 | width: parent.width; | 69 | width: parent.width; | ||
60 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | 70 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||
61 | text: i18nc("label text for the edit field for the book title", "Titles"); | 71 | text: i18nc("label text for the edit field for the book title", "Title"); | ||
62 | } | 72 | } | ||
63 | Repeater { | 73 | | ||
64 | model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.titleLanguages : 0; | 74 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||
65 | delegate: LanguageTextEntryEditor { | 75 | QtControls.TextField { | ||
66 | width: contentColumn.width; | 76 | id: defaultTitle; | ||
67 | title: modelData === "" ? i18nc("label text for the the book title with no language (default)", "Default title") : modelData; | 77 | width: parent.width; | ||
68 | text: root.model.acbfData.metaData.bookInfo.title(modelData); | 78 | placeholderText: i18nc("placeholder text for default title text-input", "Write to add default title"); | ||
69 | onSaveRequested: { | 79 | text:root.model.acbfData ? root.model.acbfData.metaData.bookInfo.title("") : ""; | ||
70 | root.model.acbfData.metaData.bookInfo.setTitle(text, modelData); | | |||
71 | root.model.setDirty(); | | |||
72 | } | | |||
73 | onRemoveRequested: { | | |||
74 | root.model.acbfData.metaData.bookInfo.setTitle("", modelData); | | |||
75 | root.model.setDirty(); | | |||
76 | } | | |||
77 | removePossible: title === modelData; | | |||
78 | } | | |||
79 | } | 80 | } | ||
80 | QtControls.Button { | 81 | | ||
81 | anchors.right: parent.right; | 82 | Kirigami.Heading { | ||
82 | width: parent.with; | 83 | width: parent.width; | ||
83 | contentItem: Kirigami.Icon { | 84 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||
84 | source: "list-add"; | 85 | text: i18nc("label text for the edit field for the default annotation", "Annotation"); | ||
85 | } | 86 | } | ||
86 | text: i18nc("Text on the button for adding new titles", "Add a title in another language"); | 87 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||
88 | QtControls.TextArea { | ||||
89 | id: defaultAnnotation; | ||||
90 | width: parent.width; | ||||
91 | placeholderText: i18nc("placeholder text for default annotiation text-area", "Write to add default annotation"); | ||||
92 | text:root.model.acbfData ? root.model.acbfData.metaData.bookInfo.annotation("").join("\n\n") : ""; | ||||
93 | } | ||||
94 | Kirigami.Heading { | ||||
95 | width: parent.width; | ||||
96 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
97 | text: i18nc("label text for the edit field for the keyword list", "Keywords"); | ||||
98 | } | ||||
99 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
100 | QtControls.TextField { | ||||
101 | id: defaultKeywords; | ||||
102 | width: parent.width; | ||||
103 | placeholderText: i18nc("placeholder text for the add new keyword text entry", "Write a comma seperated list of keywords."); | ||||
104 | text:root.model.acbfData ? root.model.acbfData.metaData.bookInfo.keywords("").join(", ") : ""; | ||||
87 | } | 105 | } | ||
88 | 106 | | |||
89 | Kirigami.Heading { | 107 | Kirigami.Heading { | ||
Context not available. | |||||
125 | height: parent.height; | 143 | height: parent.height; | ||
126 | width: height; | 144 | width: height; | ||
127 | onClicked: { | 145 | onClicked: { | ||
128 | root.model.acbfData.metaData.bookInfo.removeAuthor(modelData); | 146 | // When removing, set the model dirty first, and then remove the entry to avoid reference errors. | ||
129 | root.model.setDirty(); | 147 | root.model.setDirty(); | ||
148 | root.model.acbfData.metaData.bookInfo.removeAuthor(index); | ||||
130 | } | 149 | } | ||
131 | } | 150 | } | ||
132 | } | 151 | } | ||
Context not available. | |||||
135 | QtControls.TextField { | 154 | QtControls.TextField { | ||
136 | width: parent.width - addAuthorButton.width - Kirigami.Units.smallSpacing; | 155 | width: parent.width - addAuthorButton.width - Kirigami.Units.smallSpacing; | ||
137 | placeholderText: i18nc("placeholder text for the add new author text entry", "Write to add new author (nickname)"); | 156 | placeholderText: i18nc("placeholder text for the add new author text entry", "Write to add new author (nickname)"); | ||
157 | Keys.onReturnPressed: addAuthor(); | ||||
158 | function addAuthor() { | ||||
159 | if(text !== "") { | ||||
160 | // Just add an author where only the nickname is defined | ||||
161 | root.model.acbfData.metaData.bookInfo.addAuthor("", "", "", "", "", text, [""], [""]); | ||||
162 | root.model.setDirty(); | ||||
163 | text = ""; | ||||
164 | } | ||||
165 | } | ||||
166 | | ||||
138 | QtControls.Button { | 167 | QtControls.Button { | ||
139 | id: addAuthorButton; | 168 | id: addAuthorButton; | ||
140 | anchors { | 169 | anchors { | ||
Context not available. | |||||
146 | } | 175 | } | ||
147 | height: parent.height; | 176 | height: parent.height; | ||
148 | width: height; | 177 | width: height; | ||
149 | onClicked: { | 178 | onClicked: parent.addAuthor(); | ||
150 | if(parent.text !== "") { | | |||
151 | // Just add an author where only the nickname is defined | | |||
152 | root.model.acbfData.metaData.bookInfo.addAuthor("", "", "", "", "", parent.text, [""], [""]); | | |||
153 | root.model.setDirty(); | | |||
154 | parent.text = ""; | | |||
155 | } | | |||
156 | } | | |||
157 | } | 179 | } | ||
158 | } | 180 | } | ||
159 | 181 | | |||
Context not available. | |||||
167 | delegate: Item { | 189 | delegate: Item { | ||
168 | width: parent.width; | 190 | width: parent.width; | ||
169 | height: childrenRect.height; | 191 | height: childrenRect.height; | ||
170 | QtControls.TextField { | 192 | QtControls.Label { | ||
171 | id: genreText; | 193 | id: genreText; | ||
172 | width: parent.width - removeGenreButton.width - Kirigami.Units.smallSpacing; | 194 | width: parent.width - removeGenreButton.width - Kirigami.Units.smallSpacing; | ||
173 | text: modelData; | 195 | text: modelData; | ||
Context not available. | |||||
183 | height: parent.height; | 205 | height: parent.height; | ||
184 | width: height; | 206 | width: height; | ||
185 | onClicked: { | 207 | onClicked: { | ||
186 | root.model.acbfData.metaData.bookInfo.removeGenre(modelData); | | |||
187 | root.model.setDirty(); | 208 | root.model.setDirty(); | ||
209 | root.model.acbfData.metaData.bookInfo.removeGenre(modelData); | ||||
188 | } | 210 | } | ||
189 | } | 211 | } | ||
190 | } | 212 | } | ||
Context not available. | |||||
208 | } | 230 | } | ||
209 | } | 231 | } | ||
210 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | 232 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||
211 | QtControls.TextField { | 233 | QtControls.ComboBox { | ||
212 | width: parent.width - addCharacterButton.width - Kirigami.Units.smallSpacing; | 234 | width: parent.width - addGenreButton.width - Kirigami.Units.smallSpacing; | ||
213 | placeholderText: i18nc("placeholder text for the add new genre text entry", "Write to add new genre"); | 235 | model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.availableGenres().filter(checkGenreInUse) : 0; | ||
236 | Keys.onReturnPressed: addGenre(); | ||||
237 | function addGenre() { | ||||
238 | root.model.acbfData.metaData.bookInfo.setGenre(currentText); | ||||
239 | root.model.setDirty(); | ||||
240 | currentIndex=0; | ||||
241 | } | ||||
242 | function checkGenreInUse (genre) { | ||||
243 | return root.model.acbfData.metaData.bookInfo.genres.indexOf(genre) === -1; | ||||
244 | } | ||||
245 | | ||||
214 | QtControls.Button { | 246 | QtControls.Button { | ||
215 | id: addGenreButton; | 247 | id: addGenreButton; | ||
216 | anchors { | 248 | anchors { | ||
Context not available. | |||||
222 | } | 254 | } | ||
223 | height: parent.height; | 255 | height: parent.height; | ||
224 | width: height; | 256 | width: height; | ||
225 | onClicked: { | 257 | onClicked: parent.addGenre(); | ||
226 | if(parent.text !== "") { | | |||
227 | root.model.acbfData.metaData.bookInfo.setGenre(parent.text); | | |||
228 | root.model.setDirty(); | | |||
229 | parent.text = ""; | | |||
230 | } | | |||
231 | } | | |||
232 | } | 258 | } | ||
233 | } | 259 | } | ||
234 | 260 | | |||
Context not available. | |||||
242 | delegate: QtControls.TextField { | 268 | delegate: QtControls.TextField { | ||
243 | width: parent.width - removeCharacterButton.width - Kirigami.Units.smallSpacing; | 269 | width: parent.width - removeCharacterButton.width - Kirigami.Units.smallSpacing; | ||
244 | text: modelData; | 270 | text: modelData; | ||
271 | onEditingFinished: root.model.acbfData.metaData.bookInfo.characters[index] = text; | ||||
245 | QtControls.Button { | 272 | QtControls.Button { | ||
246 | id: removeCharacterButton; | 273 | id: removeCharacterButton; | ||
247 | anchors { | 274 | anchors { | ||
Context not available. | |||||
254 | height: parent.height; | 281 | height: parent.height; | ||
255 | width: height; | 282 | width: height; | ||
256 | onClicked: { | 283 | onClicked: { | ||
257 | root.model.acbfData.metaData.bookInfo.removeCharacter(modelData); | | |||
258 | root.model.setDirty(); | 284 | root.model.setDirty(); | ||
285 | root.model.acbfData.metaData.bookInfo.removeCharacter(modelData); | ||||
259 | } | 286 | } | ||
260 | } | 287 | } | ||
261 | } | 288 | } | ||
Context not available. | |||||
264 | QtControls.TextField { | 291 | QtControls.TextField { | ||
265 | width: parent.width - addCharacterButton.width - Kirigami.Units.smallSpacing; | 292 | width: parent.width - addCharacterButton.width - Kirigami.Units.smallSpacing; | ||
266 | placeholderText: i18nc("placeholder text for the add new character text entry", "Write to add new character"); | 293 | placeholderText: i18nc("placeholder text for the add new character text entry", "Write to add new character"); | ||
294 | Keys.onReturnPressed: addCharacter(); | ||||
295 | function addCharacter() { | ||||
296 | if(text !== "") { | ||||
297 | root.model.acbfData.metaData.bookInfo.addCharacter(text); | ||||
298 | root.model.setDirty(); | ||||
299 | text = ""; | ||||
300 | } | ||||
301 | } | ||||
302 | | ||||
267 | QtControls.Button { | 303 | QtControls.Button { | ||
268 | id: addCharacterButton; | 304 | id: addCharacterButton; | ||
269 | anchors { | 305 | anchors { | ||
Context not available. | |||||
275 | } | 311 | } | ||
276 | height: parent.height; | 312 | height: parent.height; | ||
277 | width: height; | 313 | width: height; | ||
278 | onClicked: { | 314 | onClicked: parent.addCharacter(); | ||
279 | if(parent.text !== "") { | 315 | } | ||
280 | root.model.acbfData.metaData.bookInfo.addCharacter(parent.text); | 316 | } | ||
317 | | ||||
318 | Kirigami.Heading { | ||||
319 | width: parent.width; | ||||
320 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
321 | text: i18nc("label text for the edit field for the sequence list", "Sequence"); | ||||
322 | } | ||||
323 | Repeater { | ||||
324 | id: sequenceListRepeater; | ||||
325 | model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.sequenceCount : 0; | ||||
326 | delegate: Item { | ||||
327 | width: parent.width; | ||||
328 | height: childrenRect.height; | ||||
329 | | ||||
330 | function updateSeries() { | ||||
331 | root.model.acbfData.metaData.bookInfo.sequence(modelData).title = seriesTextField.text; | ||||
332 | if (numberField.value !== root.model.acbfData.metaData.bookInfo.sequence(modelData).number) { | ||||
333 | root.model.acbfData.metaData.bookInfo.sequence(modelData).number = numberField.value; | ||||
334 | } | ||||
335 | if (volumeField.value !== root.model.acbfData.metaData.bookInfo.sequence(modelData).volume) { | ||||
336 | root.model.acbfData.metaData.bookInfo.sequence(modelData).volume = volumeField.value; | ||||
337 | } | ||||
338 | root.model.setDirty(); | ||||
339 | } | ||||
340 | | ||||
341 | QtControls.TextField { | ||||
342 | id: seriesTextField; | ||||
343 | width: parent.width - removeSequenceButton.width - Kirigami.Units.smallSpacing; | ||||
344 | text: root.model.acbfData.metaData.bookInfo.sequence(modelData).title; | ||||
345 | onEditingFinished: parent.updateSeries(); | ||||
346 | } | ||||
347 | QtControls.SpinBox { | ||||
348 | anchors { | ||||
349 | top: seriesTextField.bottom; | ||||
350 | topMargin: Kirigami.Units.smallSpacing; | ||||
351 | } | ||||
352 | value : root.model.acbfData.metaData.bookInfo.sequence(modelData).number; | ||||
353 | width : (seriesTextField.width+Kirigami.Units.smallSpacing)/2; | ||||
354 | id: numberField; | ||||
355 | onValueChanged: parent.updateSeries(); | ||||
356 | } | ||||
357 | QtControls.SpinBox { | ||||
358 | anchors { | ||||
359 | left: numberField.right; | ||||
360 | leftMargin: Kirigami.Units.smallSpacing; | ||||
361 | top: seriesTextField.bottom; | ||||
362 | topMargin: Kirigami.Units.smallSpacing; | ||||
363 | } | ||||
364 | value : root.model.acbfData.metaData.bookInfo.sequence(modelData).volume; | ||||
365 | width : (seriesTextField.width/2)-(Kirigami.Units.smallSpacing*1.5); | ||||
366 | id: volumeField; | ||||
367 | onValueChanged: parent.updateSeries(); | ||||
368 | } | ||||
369 | QtControls.Button { | ||||
370 | id: removeSequenceButton; | ||||
371 | anchors { | ||||
372 | left: seriesTextField.right; | ||||
373 | leftMargin: Kirigami.Units.smallSpacing; | ||||
374 | } | ||||
375 | contentItem: Kirigami.Icon { | ||||
376 | source: "list-remove"; | ||||
377 | } | ||||
378 | height: seriesTextField.height; | ||||
379 | width: height; | ||||
380 | onClicked: { | ||||
381 | root.model.setDirty(); | ||||
382 | root.model.acbfData.metaData.bookInfo.removeSequence(index); | ||||
383 | } | ||||
384 | } | ||||
385 | } | ||||
386 | } | ||||
387 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
388 | QtControls.TextField { | ||||
389 | width: parent.width - addSequenceButton.width - Kirigami.Units.smallSpacing; | ||||
390 | placeholderText: i18nc("placeholder text for the add new series text entry", "Write to add new series"); | ||||
391 | Keys.onReturnPressed:addSequence(); | ||||
392 | function addSequence() { | ||||
393 | if(text !== "") { | ||||
394 | root.model.acbfData.metaData.bookInfo.addSequence(0, text); | ||||
395 | root.model.setDirty(); | ||||
396 | text = ""; | ||||
397 | } | ||||
398 | } | ||||
399 | | ||||
400 | QtControls.Button { | ||||
401 | id: addSequenceButton; | ||||
402 | anchors { | ||||
403 | left: parent.right; | ||||
404 | leftMargin: Kirigami.Units.smallSpacing; | ||||
405 | } | ||||
406 | contentItem: Kirigami.Icon { | ||||
407 | source: "list-add"; | ||||
408 | } | ||||
409 | height: parent.height; | ||||
410 | width: height; | ||||
411 | onClicked: parent.addSequence(); | ||||
412 | } | ||||
413 | } | ||||
414 | | ||||
415 | Kirigami.Heading { | ||||
416 | width: parent.width; | ||||
417 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
418 | text: i18nc("label text for the edit field for the database reference list", "Database References"); | ||||
419 | } | ||||
420 | Repeater { | ||||
421 | model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.databaseRefCount : 0; | ||||
422 | delegate: Item { | ||||
423 | width: parent.width; | ||||
424 | height: childrenRect.height; | ||||
425 | | ||||
426 | function updateDatabaseRef() { | ||||
427 | root.model.acbfData.metaData.bookInfo.databaseRef(modelData).reference = referenceTextField.text | ||||
428 | root.model.acbfData.metaData.bookInfo.databaseRef(modelData).dbname = databaseNameField.text | ||||
429 | root.model.acbfData.metaData.bookInfo.databaseRef(modelData).type = referenceTypeField.text | ||||
430 | root.model.setDirty(); | ||||
431 | } | ||||
432 | | ||||
433 | QtControls.TextField { | ||||
434 | id: referenceTextField; | ||||
435 | width: parent.width - removeReferenceButton.width - Kirigami.Units.smallSpacing; | ||||
436 | text: root.model.acbfData.metaData.bookInfo.databaseRef(modelData).reference; | ||||
437 | onEditingFinished: parent.updateDatabaseRef(); | ||||
438 | } | ||||
439 | QtControls.TextField { | ||||
440 | anchors { | ||||
441 | top: referenceTextField.bottom; | ||||
442 | topMargin: Kirigami.Units.smallSpacing; | ||||
443 | } | ||||
444 | width : (referenceTextField.width+Kirigami.Units.smallSpacing)/2; | ||||
445 | id: databaseNameField; | ||||
446 | text: root.model.acbfData.metaData.bookInfo.databaseRef(modelData).dbname; | ||||
447 | onEditingFinished: parent.updateDatabaseRef(); | ||||
448 | } | ||||
449 | QtControls.TextField { | ||||
450 | anchors { | ||||
451 | left: databaseNameField.right; | ||||
452 | leftMargin: Kirigami.Units.smallSpacing; | ||||
453 | top: referenceTextField.bottom; | ||||
454 | topMargin: Kirigami.Units.smallSpacing; | ||||
455 | } | ||||
456 | width : (referenceTextField.width/2)-(Kirigami.Units.smallSpacing*1.5); | ||||
457 | id: referenceTypeField; | ||||
458 | text: root.model.acbfData.metaData.bookInfo.databaseRef(modelData).type; | ||||
459 | placeholderText: i18nc("placeholder text for the add reference type text entry", "Write to add reference type"); | ||||
460 | onEditingFinished: parent.updateDatabaseRef(); | ||||
461 | } | ||||
462 | QtControls.Button { | ||||
463 | id: removeReferenceButton; | ||||
464 | anchors { | ||||
465 | left: referenceTextField.right; | ||||
466 | leftMargin: Kirigami.Units.smallSpacing; | ||||
467 | } | ||||
468 | contentItem: Kirigami.Icon { | ||||
469 | source: "list-remove"; | ||||
470 | } | ||||
471 | height: referenceTextField.height; | ||||
472 | width: height; | ||||
473 | onClicked: { | ||||
474 | root.model.setDirty(); | ||||
475 | root.model.acbfData.metaData.bookInfo.removeDatabaseRef(index); | ||||
476 | } | ||||
477 | } | ||||
478 | } | ||||
479 | } | ||||
480 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
481 | Item { | ||||
482 | width: parent.width; | ||||
483 | height: childrenRect.height; | ||||
484 | function addReference() { | ||||
485 | if(addReferenceField.text !== "" && addDatabaseNameField.text !== "") { | ||||
486 | root.model.acbfData.metaData.bookInfo.addDatabaseRef(addReferenceField.text, addDatabaseNameField.text); | ||||
487 | root.model.setDirty(); | ||||
488 | addReferenceField.text = ""; | ||||
489 | addDatabaseNameField.text = ""; | ||||
490 | } | ||||
491 | } | ||||
492 | | ||||
493 | QtControls.TextField { | ||||
494 | id: addReferenceField | ||||
495 | width: parent.width - addReferenceButton.width - Kirigami.Units.smallSpacing; | ||||
496 | placeholderText: i18nc("placeholder text for the add new reference text entry", "Write to add new reference"); | ||||
497 | Keys.onReturnPressed: parent.addReference(); | ||||
498 | } | ||||
499 | QtControls.TextField { | ||||
500 | id: addDatabaseNameField | ||||
501 | anchors { | ||||
502 | top: addReferenceField.bottom; | ||||
503 | topMargin: Kirigami.Units.smallSpacing; | ||||
504 | } | ||||
505 | width: parent.width - addReferenceButton.width - Kirigami.Units.smallSpacing; | ||||
506 | placeholderText: i18nc("placeholder text for the add databasename text entry", "Write to add database name for new reference."); | ||||
507 | Keys.onReturnPressed: parent.addReference(); | ||||
508 | } | ||||
509 | QtControls.Button { | ||||
510 | id: addReferenceButton; | ||||
511 | anchors { | ||||
512 | left: addReferenceField.right; | ||||
513 | leftMargin: Kirigami.Units.smallSpacing; | ||||
514 | } | ||||
515 | contentItem: Kirigami.Icon { | ||||
516 | source: "list-add"; | ||||
517 | } | ||||
518 | height: addReferenceField.height; | ||||
519 | width: height; | ||||
520 | onClicked: parent.addReference(); | ||||
521 | } | ||||
522 | } | ||||
523 | | ||||
524 | Kirigami.Heading { | ||||
525 | width: parent.width; | ||||
526 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
527 | text: i18nc("label text for the edit field for the content rating list", "Content Ratings"); | ||||
528 | } | ||||
529 | Repeater { | ||||
530 | model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.contentRatingCount : 0; | ||||
531 | delegate: Item { | ||||
532 | width: parent.width; | ||||
533 | height: childrenRect.height; | ||||
534 | | ||||
535 | function updateRating() { | ||||
536 | root.model.acbfData.metaData.bookInfo.contentRating(modelData).rating = ratingNameField.text | ||||
537 | root.model.acbfData.metaData.bookInfo.contentRating(modelData).type = systemNameField.text | ||||
538 | root.model.setDirty(); | ||||
539 | } | ||||
540 | | ||||
541 | QtControls.TextField { | ||||
542 | width : (parent.width-removeRatingButton.width+Kirigami.Units.smallSpacing)/2; | ||||
543 | id: ratingNameField; | ||||
544 | text: root.model.acbfData.metaData.bookInfo.contentRating(modelData).rating; | ||||
545 | onEditingFinished: parent.updateRating(); | ||||
546 | } | ||||
547 | QtControls.TextField { | ||||
548 | anchors { | ||||
549 | left: ratingNameField.right; | ||||
550 | leftMargin: Kirigami.Units.smallSpacing; | ||||
551 | } | ||||
552 | width : ((parent.width-removeRatingButton.width)/2)-(Kirigami.Units.smallSpacing*1.5); | ||||
553 | id: systemNameField; | ||||
554 | text: root.model.acbfData.metaData.bookInfo.contentRating(modelData).type; | ||||
555 | placeholderText: i18nc("placeholder text for the add reference type text entry", "Write to add reference type"); | ||||
556 | onEditingFinished: parent.updateRating(); | ||||
557 | } | ||||
558 | QtControls.Button { | ||||
559 | id: removeRatingButton; | ||||
560 | anchors { | ||||
561 | left: systemNameField.right; | ||||
562 | leftMargin: Kirigami.Units.smallSpacing; | ||||
563 | } | ||||
564 | contentItem: Kirigami.Icon { | ||||
565 | source: "list-remove"; | ||||
566 | } | ||||
567 | height: systemNameField.height; | ||||
568 | width: height; | ||||
569 | onClicked: { | ||||
570 | root.model.setDirty(); | ||||
571 | root.model.acbfData.metaData.bookInfo.removeContentRating(index); | ||||
572 | } | ||||
573 | } | ||||
574 | } | ||||
575 | } | ||||
576 | Item { | ||||
577 | width: parent.width; | ||||
578 | height: childrenRect.height; | ||||
579 | function addRating() { | ||||
580 | if(addRatingField.text !== "" && addSystemField.text !== "") { | ||||
581 | root.model.acbfData.metaData.bookInfo.addContentRating(addRatingField.text, addSystemField.text); | ||||
582 | root.model.setDirty(); | ||||
583 | addRatingField.text = ""; | ||||
584 | addSystemField.text = ""; | ||||
585 | } | ||||
586 | } | ||||
587 | QtControls.TextField { | ||||
588 | width : (parent.width-addRatingButton.width+Kirigami.Units.smallSpacing)/2; | ||||
589 | id: addRatingField; | ||||
590 | placeholderText: i18nc("placeholder text for the add content rating text entry", "Write to add rating label."); | ||||
591 | onEditingFinished: parent.addRating(); | ||||
592 | } | ||||
593 | QtControls.TextField { | ||||
594 | anchors { | ||||
595 | left: addRatingField.right; | ||||
596 | leftMargin: Kirigami.Units.smallSpacing; | ||||
597 | } | ||||
598 | width : ((parent.width-addRatingButton.width)/2)-(Kirigami.Units.smallSpacing*1.5); | ||||
599 | id: addSystemField; | ||||
600 | placeholderText: i18nc("placeholder text for the add content rating system text entry", "Write to add rating system."); | ||||
601 | onEditingFinished: parent.addRating(); | ||||
602 | } | ||||
603 | QtControls.Button { | ||||
604 | id: addRatingButton; | ||||
605 | anchors { | ||||
606 | left: addSystemField.right; | ||||
607 | leftMargin: Kirigami.Units.smallSpacing; | ||||
608 | } | ||||
609 | contentItem: Kirigami.Icon { | ||||
610 | source: "list-add"; | ||||
611 | } | ||||
612 | height: addSystemField.height; | ||||
613 | width: height; | ||||
614 | onClicked: parent.addRating(); | ||||
615 | } | ||||
616 | } | ||||
617 | Kirigami.Heading { | ||||
618 | width: parent.width; | ||||
619 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
620 | text: i18nc("label text for the form for the publishing info list", "Publisher Info"); | ||||
621 | } | ||||
622 | QtControls.Label { | ||||
623 | text: i18nc("Label for publisher", "Publisher:"); | ||||
624 | } | ||||
625 | QtControls.TextField { | ||||
626 | width : parent.width; | ||||
627 | id: publisher; | ||||
628 | placeholderText: i18nc("placeholder text for the publisher entry", "Write to add publisher"); | ||||
629 | text: root.model.acbfData? root.model.acbfData.metaData.publishInfo.publisher: ""; | ||||
630 | onEditingFinished: { | ||||
631 | if (root.model.acbfData && text !=="") { | ||||
632 | root.model.acbfData.metaData.publishInfo.publisher = text | ||||
633 | root.model.setDirty(); | ||||
634 | } | ||||
635 | } | ||||
636 | } | ||||
637 | QtControls.Label { | ||||
638 | text: i18nc("Label for publishing date", "Publishing Date:"); | ||||
639 | } | ||||
640 | Item { | ||||
641 | width : parent.width; | ||||
642 | id: publishingDate; | ||||
643 | height: childrenRect.height; | ||||
644 | property date publishingDate: root.model.acbfData.metaData.publishInfo.publishDate; | ||||
645 | function changePublishDate() { | ||||
646 | root.model.acbfData.metaData.publishInfo.setPublishDateFromInts(pdYear.value, (pdMonth.currentIndex+1), pdDate.value); | ||||
647 | root.model.setDirty(); | ||||
648 | } | ||||
649 | QtControls.SpinBox { | ||||
650 | id: pdYear | ||||
651 | width: (parent.width-(Kirigami.Units.smallSpacing*2))/3; | ||||
652 | value: parent.publishingDate.getFullYear(); | ||||
653 | onValueChanged: parent.changePublishDate(); | ||||
654 | editable: true; | ||||
655 | from: 0; | ||||
656 | to: 9999; | ||||
657 | } | ||||
658 | QtControls.ComboBox { | ||||
659 | id: pdMonth | ||||
660 | anchors { | ||||
661 | left: pdYear.right; | ||||
662 | margins: Kirigami.Units.smallSpacing; | ||||
663 | } | ||||
664 | model: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] | ||||
665 | width: (parent.width-(Kirigami.Units.smallSpacing*2))/3; | ||||
666 | currentIndex: parent.publishingDate.getMonth(); | ||||
667 | displayText: Qt.locale().monthName(currentText, Locale.LongFormat); | ||||
668 | onActivated: parent.changePublishDate(); | ||||
669 | delegate: QtControls.ItemDelegate { | ||||
670 | text:Qt.locale().monthName(modelData, Locale.LongFormat); | ||||
671 | } | ||||
672 | } | ||||
673 | QtControls.SpinBox { | ||||
674 | id: pdDate | ||||
675 | anchors { | ||||
676 | left: pdMonth.right; | ||||
677 | margins: Kirigami.Units.smallSpacing; | ||||
678 | } | ||||
679 | width: (parent.width-(Kirigami.Units.smallSpacing*2))/3; | ||||
680 | height: pdMonth.height; | ||||
681 | from: 1; | ||||
682 | to: 31; | ||||
683 | editable: true; | ||||
684 | value: parent.publishingDate.getDate(); | ||||
685 | onValueChanged: parent.changePublishDate(); | ||||
686 | } | ||||
687 | } | ||||
688 | QtControls.Label { | ||||
689 | text: i18nc("Label for city", "City:"); | ||||
690 | } | ||||
691 | QtControls.TextField { | ||||
692 | width : parent.width; | ||||
693 | id: city; | ||||
694 | placeholderText: i18nc("placeholder text for the publishing city entry", "Write to add city"); | ||||
695 | text: root.model.acbfData? root.model.acbfData.metaData.publishInfo.city: ""; | ||||
696 | onEditingFinished: { | ||||
697 | if (root.model.acbfData && text !=="") { | ||||
698 | root.model.acbfData.metaData.publishInfo.city = text ; | ||||
699 | root.model.setDirty(); | ||||
700 | } | ||||
701 | } | ||||
702 | } | ||||
703 | QtControls.Label { | ||||
704 | text: i18nc("Label for isbn", "ISBN:"); | ||||
705 | } | ||||
706 | | ||||
707 | QtControls.TextField { | ||||
708 | width : parent.width; | ||||
709 | id: isbn; | ||||
710 | placeholderText: i18nc("placeholder text for the publishing isbn entry", "Write to add isbn"); | ||||
711 | text: root.model.acbfData? root.model.acbfData.metaData.publishInfo.isbn: ""; | ||||
712 | onEditingFinished: { | ||||
713 | if (root.model.acbfData && text !=="") { | ||||
714 | root.model.acbfData.metaData.publishInfo.isbn = text | ||||
715 | root.model.setDirty(); | ||||
716 | } | ||||
717 | } | ||||
718 | } | ||||
719 | QtControls.Label { | ||||
720 | text: i18nc("Label for license", "License:"); | ||||
721 | } | ||||
722 | QtControls.TextField { | ||||
723 | width : parent.width; | ||||
724 | id: license; | ||||
725 | placeholderText: i18nc("placeholder text for the publishing license entry", "Write to add license"); | ||||
726 | text: root.model.acbfData? root.model.acbfData.metaData.publishInfo.license: ""; | ||||
727 | onEditingFinished: { | ||||
728 | if (root.model.acbfData && text !=="") { | ||||
729 | root.model.acbfData.metaData.publishInfo.license = text | ||||
730 | root.model.setDirty(); | ||||
731 | } | ||||
732 | } | ||||
733 | } | ||||
734 | Kirigami.Heading { | ||||
735 | width: parent.width; | ||||
736 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
737 | text: i18nc("label text for the form for the document info list", "Document Authors"); | ||||
738 | } | ||||
739 | | ||||
740 | Repeater { | ||||
741 | id: docAuthorRepeater; | ||||
742 | model: root.model.acbfData ? root.model.acbfData.metaData.documentInfo.authorNames : 0; | ||||
743 | delegate: QtControls.Label { | ||||
744 | width: parent.width - removeDocAuthorButton.width - Kirigami.Units.smallSpacing; | ||||
745 | text: modelData.length > 0 ? modelData : "(unnamed)"; | ||||
746 | QtControls.Button { | ||||
747 | id: editDocAuthorButton; | ||||
748 | anchors { | ||||
749 | right: removeDocAuthorButton.left; | ||||
750 | leftMargin: Kirigami.Units.smallSpacing; | ||||
751 | } | ||||
752 | contentItem: Kirigami.Icon { | ||||
753 | source: "document-edit"; | ||||
754 | } | ||||
755 | height: parent.height; | ||||
756 | width: height; | ||||
757 | onClicked: { | ||||
758 | docAuthorEditor.index = model.index; | ||||
759 | docAuthorEditor.open(); | ||||
760 | } | ||||
761 | } | ||||
762 | QtControls.Button { | ||||
763 | id: removeDocAuthorButton; | ||||
764 | anchors { | ||||
765 | left: parent.right; | ||||
766 | leftMargin: Kirigami.Units.smallSpacing; | ||||
767 | } | ||||
768 | contentItem: Kirigami.Icon { | ||||
769 | source: "list-remove"; | ||||
770 | } | ||||
771 | height: parent.height; | ||||
772 | width: height; | ||||
773 | onClicked: { | ||||
774 | // When removing, set the model dirty first, and then remove the entry to avoid reference errors. | ||||
281 | root.model.setDirty(); | 775 | root.model.setDirty(); | ||
282 | parent.text = ""; | 776 | root.model.acbfData.metaData.documentInfo.removeAuthor(index); | ||
283 | } | 777 | } | ||
284 | } | 778 | } | ||
285 | } | 779 | } | ||
286 | } | 780 | } | ||
781 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
782 | QtControls.TextField { | ||||
783 | width: parent.width - addDocAuthorButton.width - Kirigami.Units.smallSpacing; | ||||
784 | placeholderText: i18nc("placeholder text for the add new author text entry", "Write to add new author (nickname)"); | ||||
785 | Keys.onReturnPressed: addAuthor(); | ||||
786 | function addAuthor() { | ||||
787 | if(text !== "") { | ||||
788 | // Just add an author where only the nickname is defined | ||||
789 | root.model.acbfData.metaData.documentInfo.addAuthor("", "", "", "", "", text, [""], [""]); | ||||
790 | root.model.setDirty(); | ||||
791 | text = ""; | ||||
792 | } | ||||
793 | } | ||||
794 | | ||||
795 | QtControls.Button { | ||||
796 | id: addDocAuthorButton; | ||||
797 | anchors { | ||||
798 | left: parent.right; | ||||
799 | leftMargin: Kirigami.Units.smallSpacing; | ||||
800 | } | ||||
801 | contentItem: Kirigami.Icon { | ||||
802 | source: "list-add"; | ||||
803 | } | ||||
804 | height: parent.height; | ||||
805 | width: height; | ||||
806 | onClicked: parent.addAuthor(); | ||||
807 | } | ||||
808 | } | ||||
809 | | ||||
810 | Kirigami.Heading { | ||||
811 | width: parent.width; | ||||
812 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
813 | text: i18nc("label text for the form for the sources list", "Document Sources"); | ||||
814 | } | ||||
815 | | ||||
816 | Repeater { | ||||
817 | model: root.model.acbfData ? root.model.acbfData.metaData.documentInfo.source : 0; | ||||
818 | delegate: Item { | ||||
819 | width: parent.width; | ||||
820 | height: childrenRect.height; | ||||
821 | QtControls.TextField { | ||||
822 | id: sourceText; | ||||
823 | width: parent.width - removeSourceButton.width - Kirigami.Units.smallSpacing; | ||||
824 | text: modelData; | ||||
825 | onEditingFinished: root.model.acbfData.metaData.documentInfo.sources[index] = text; | ||||
826 | QtControls.Button { | ||||
827 | id: removeSourceButton; | ||||
828 | anchors { | ||||
829 | left: parent.right; | ||||
830 | leftMargin: Kirigami.Units.smallSpacing; | ||||
831 | } | ||||
832 | contentItem: Kirigami.Icon { | ||||
833 | source: "list-remove"; | ||||
834 | } | ||||
835 | height: parent.height; | ||||
836 | width: height; | ||||
837 | onClicked: { | ||||
838 | root.model.setDirty(); | ||||
839 | root.model.acbfData.metaData.documentInfo.removeSource(index); | ||||
840 | } | ||||
841 | } | ||||
842 | } | ||||
843 | } | ||||
844 | } | ||||
845 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
846 | QtControls.TextField { | ||||
847 | width: parent.width - addSourceButton.width - Kirigami.Units.smallSpacing; | ||||
848 | Keys.onReturnPressed: addEntry(); | ||||
849 | function addEntry() { | ||||
850 | if (text !== "") { | ||||
851 | root.model.acbfData.metaData.documentInfo.source.push(text); | ||||
852 | root.model.setDirty(); | ||||
853 | text = ""; | ||||
854 | } | ||||
855 | } | ||||
856 | | ||||
857 | QtControls.Button { | ||||
858 | id: addSourceButton; | ||||
859 | anchors { | ||||
860 | left: parent.right; | ||||
861 | leftMargin: Kirigami.Units.smallSpacing; | ||||
862 | } | ||||
863 | contentItem: Kirigami.Icon { | ||||
864 | source: "list-add"; | ||||
865 | } | ||||
866 | height: parent.height; | ||||
867 | width: height; | ||||
868 | onClicked: parent.addEntry(); | ||||
869 | } | ||||
870 | } | ||||
871 | | ||||
872 | Kirigami.Heading { | ||||
873 | width: parent.width; | ||||
874 | height: paintedHeight + Kirigami.Units.smallSpacing * 2; | ||||
875 | text: i18nc("label text for the form for the history list", "Document History"); | ||||
876 | } | ||||
877 | | ||||
878 | Repeater { | ||||
879 | model: root.model.acbfData ? root.model.acbfData.metaData.documentInfo.history : 0; | ||||
880 | delegate: Item { | ||||
881 | width: parent.width; | ||||
882 | height: childrenRect.height; | ||||
883 | QtControls.TextField { | ||||
884 | id: historyText; | ||||
885 | width: parent.width - removeHistoryButton.width - Kirigami.Units.smallSpacing; | ||||
886 | text: modelData; | ||||
887 | onEditingFinished: root.model.acbfData.metaData.documentInfo.history[index] = text; | ||||
888 | QtControls.Button { | ||||
889 | id: removeHistoryButton; | ||||
890 | anchors { | ||||
891 | left: parent.right; | ||||
892 | leftMargin: Kirigami.Units.smallSpacing; | ||||
893 | } | ||||
894 | contentItem: Kirigami.Icon { | ||||
895 | source: "list-remove"; | ||||
896 | } | ||||
897 | height: parent.height; | ||||
898 | width: height; | ||||
899 | onClicked: { | ||||
900 | root.model.setDirty(); | ||||
901 | root.model.acbfData.metaData.documentInfo.removeHistoryLine(index); | ||||
902 | } | ||||
903 | } | ||||
904 | } | ||||
905 | } | ||||
906 | } | ||||
907 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
908 | QtControls.TextField { | ||||
909 | width: parent.width - addHistoryButton.width - Kirigami.Units.smallSpacing; | ||||
910 | Keys.onReturnPressed: addEntry(); | ||||
911 | function addEntry() { | ||||
912 | if (text !== "") { | ||||
913 | root.model.acbfData.metaData.documentInfo.history.push(text); | ||||
914 | root.model.setDirty(); | ||||
915 | text = ""; | ||||
916 | } | ||||
917 | } | ||||
918 | | ||||
919 | QtControls.Button { | ||||
920 | id: addHistoryButton; | ||||
921 | anchors { | ||||
922 | left: parent.right; | ||||
923 | leftMargin: Kirigami.Units.smallSpacing; | ||||
924 | } | ||||
925 | contentItem: Kirigami.Icon { | ||||
926 | source: "list-add"; | ||||
927 | } | ||||
928 | height: parent.height; | ||||
929 | width: height; | ||||
930 | onClicked: parent.addEntry(); | ||||
931 | } | ||||
932 | } | ||||
933 | Item { width: parent.width; height: Kirigami.Units.smallSpacing; } | ||||
934 | Item { | ||||
935 | width: parent.width; | ||||
936 | height: childrenRect.height; | ||||
937 | QtControls.Label { | ||||
938 | id: versionLabel; | ||||
939 | height: versionSpinBox.height; | ||||
940 | text: i18nc("Label for the document version spinbox","Document Version:"); | ||||
941 | } | ||||
942 | QtControls.SpinBox { | ||||
943 | id: versionSpinBox; | ||||
944 | anchors { | ||||
945 | top: versionLabel.top; | ||||
946 | left: versionLabel.right; | ||||
947 | leftMargin: Kirigami.Units.smallSpacing; | ||||
948 | } | ||||
949 | | ||||
950 | width: parent.width - (Kirigami.Units.smallSpacing*2) - versionLabel.width - addHistoryButton.width; | ||||
951 | value: root.model.acbfData.metaData.documentInfo.version; | ||||
952 | | ||||
953 | onValueChanged: { | ||||
954 | if (root.model.acbfData.metaData.documentInfo.version!==value) { | ||||
955 | root.model.acbfData.metaData.documentInfo.version = value; | ||||
956 | } | ||||
957 | } | ||||
958 | } | ||||
959 | } | ||||
960 | | ||||
287 | 961 | | |||
288 | AuthorEntryEditor { | 962 | AuthorEntryEditor { | ||
289 | id: authorEditor; | 963 | id: authorEditor; | ||
290 | bookinfo: root.model.acbfData.metaData.bookInfo; | 964 | bookinfo: root.model.acbfData.metaData.bookInfo; | ||
291 | onSave: { | 965 | onSave: { | ||
292 | root.model.acbfData.metaData.bookInfo.setAuthor(index, activity, language, firstName, middleName, lastName, nickName, [homePage], [email]); | 966 | root.model.acbfData.metaData.bookInfo.setAuthor(index, activity, language, firstName, middleName, lastName, nickName, homePage, email); | ||
967 | root.model.setDirty(); | ||||
968 | } | ||||
969 | } | ||||
970 | AuthorEntryEditor { | ||||
971 | id: docAuthorEditor; | ||||
972 | bookinfo: root.model.acbfData.metaData.documentInfo; | ||||
973 | onSave: { | ||||
974 | root.model.acbfData.metaData.documentInfo.setAuthor(index, activity, language, firstName, middleName, lastName, nickName, homePage, email); | ||||
293 | root.model.setDirty(); | 975 | root.model.setDirty(); | ||
294 | } | 976 | } | ||
295 | } | 977 | } | ||
Context not available. |