diff --git a/src/creator/qml/AddPageArea.qml b/src/creator/qml/AddPageArea.qml index 3ef0dd0..87f9952 100644 --- a/src/creator/qml/AddPageArea.qml +++ b/src/creator/qml/AddPageArea.qml @@ -1,92 +1,94 @@ /* * Copyright (C) 2018 Wolthera van Hövell tot Westerflier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ import QtQuick 2.2 import org.kde.kirigami 2.1 as Kirigami import QtQuick.Controls 2.2 as QtControls /** * @brief a special overlay sheet for adding frames/textareas/jumps */ Kirigami.OverlaySheet { id: root; signal save(); property alias type: typeComboBox.currentIndex; property point topLeft; property point bottomRight; Column { height: childrenRect.height; spacing: Kirigami.Units.smallSpacing; Kirigami.Heading { width: parent.width; height: paintedHeight; text: i18nc("title text for the add page area sheet", "Add Page Area"); QtControls.Button { - id: saveButton; + id: closeButton; anchors { - right: parent.right; - leftMargin: Kirigami.Units.smallSpacing; + right: saveButton.left; + rightMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { - source: "dialog-ok"; + source: "dialog-cancel"; } height: parent.height; width: height; - onClicked: { - root.save(); - root.close(); - } + Keys.onReturnPressed: root.close(); + onClicked: root.close(); } QtControls.Button { - id: closeButton; + id: saveButton; anchors { - right: saveButton.left; - rightMargin: Kirigami.Units.smallSpacing; + right: parent.right; + leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { - source: "dialog-cancel"; + source: "dialog-ok"; } height: parent.height; width: height; - onClicked: { + Keys.onReturnPressed: saveAndClose(); + onClicked: saveAndClose(); + + function saveAndClose() { + root.save(); root.close(); } } } Item { width: parent.width; height: Kirigami.Units.largeSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the activity field", "Activity:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } QtControls.ComboBox { id: typeComboBox; model: [i18n("Frame"), i18n("Textarea"), i18n("Jump")] width: parent.width - Kirigami.Units.smallSpacing; } } } diff --git a/src/creator/qml/BookMetainfoPage.qml b/src/creator/qml/BookMetainfoPage.qml index afb1343..05b2b92 100644 --- a/src/creator/qml/BookMetainfoPage.qml +++ b/src/creator/qml/BookMetainfoPage.qml @@ -1,979 +1,980 @@ /* * Copyright (C) 2015 Dan Leinir Turthra Jensen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ import QtQuick 2.2 import QtQuick.Controls 2.2 as QtControls import org.kde.kirigami 2.1 as Kirigami import "metainfoeditors" /** * @brief Page with form to edit the comic metadata. * * Most metadata entries are quite simple. * * Others, like Author, need a dedicated entry editor (AuthorEntryEditor). */ Kirigami.ScrollablePage { id: root; title: i18nc("title text for the book meta information editor sheet", "Edit Meta Information"); property QtObject model; actions { main: saveAndCloseAction; } Kirigami.Action { id: saveAndCloseAction; text: i18nc("Saves the remaining unsaved edited fields and closes the metainfo editor", "Save and Close Editor"); iconName: "dialog-ok"; + shortcut: "Esc"; onTriggered: { // Save the default title/annotation/keywords. root.model.acbfData.metaData.bookInfo.setTitle(defaultTitle.text, ""); root.model.acbfData.metaData.bookInfo.setAnnotation(defaultAnnotation.text.split("\n\n"), ""); var keywords = defaultKeywords.text.split(",") for (var i in keywords) { keywords[i] = keywords[i].trim(); } root.model.acbfData.metaData.bookInfo.setKeywords(keywords, ""); root.model.setDirty(); pageStack.pop(); } } Column { id: contentColumn; width: root.width - (root.leftPadding + root.rightPadding); height: childrenRect.height; spacing: Kirigami.Units.smallSpacing; Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the book title", "Title"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { id: defaultTitle; width: parent.width; placeholderText: i18nc("placeholder text for default title text-input", "Write to add default title"); text:root.model.acbfData ? root.model.acbfData.metaData.bookInfo.title("") : ""; } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the default annotation", "Annotation"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextArea { id: defaultAnnotation; width: parent.width; placeholderText: i18nc("placeholder text for default annotiation text-area", "Write to add default annotation"); text:root.model.acbfData ? root.model.acbfData.metaData.bookInfo.annotation("").join("\n\n") : ""; } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the keyword list", "Keywords"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { id: defaultKeywords; width: parent.width; placeholderText: i18nc("placeholder text for the add new keyword text entry", "Write a comma seperated list of keywords."); text:root.model.acbfData ? root.model.acbfData.metaData.bookInfo.keywords("").join(", ") : ""; } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the author list", "Authors (" + authorRepeater.count + ")"); } Repeater { id: authorRepeater; model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.authorNames : 0; delegate: QtControls.Label { width: parent.width - removeAuthorButton.width - Kirigami.Units.smallSpacing; text: modelData.length > 0 ? modelData : "(unnamed)"; QtControls.Button { id: editAuthorButton; anchors { right: removeAuthorButton.left; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "document-edit"; } height: parent.height; width: height; onClicked: { authorEditor.index = model.index; authorEditor.open(); } } QtControls.Button { id: removeAuthorButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: parent.height; width: height; onClicked: { // When removing, set the model dirty first, and then remove the entry to avoid reference errors. root.model.setDirty(); root.model.acbfData.metaData.bookInfo.removeAuthor(index); } } } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { width: parent.width - addAuthorButton.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the add new author text entry", "Write to add new author (nickname)"); Keys.onReturnPressed: addAuthor(); function addAuthor() { if(text !== "") { // Just add an author where only the nickname is defined root.model.acbfData.metaData.bookInfo.addAuthor("", "", "", "", "", text, [""], [""]); root.model.setDirty(); text = ""; } } QtControls.Button { id: addAuthorButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addAuthor(); } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the genre list", "Genres"); } Repeater { model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.genres : 0; delegate: Item { width: parent.width; height: childrenRect.height; QtControls.Label { id: genreText; width: parent.width - removeGenreButton.width - Kirigami.Units.smallSpacing; text: modelData; QtControls.Button { id: removeGenreButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: parent.height; width: height; onClicked: { root.model.setDirty(); root.model.acbfData.metaData.bookInfo.removeGenre(modelData); } } } QtControls.Slider { anchors { top: genreText.bottom; topMargin: Kirigami.Units.smallSpacing; } from: 0; to: 100; stepSize: 1.0; width: genreText.width; value: root.model.acbfData.metaData.bookInfo.genrePercentage(modelData); onValueChanged: { if(value > 0 && value !== root.model.acbfData.metaData.bookInfo.genrePercentage(modelData)) { root.model.acbfData.metaData.bookInfo.setGenre(modelData, value); root.model.setDirty(); } } } } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.ComboBox { width: parent.width - addGenreButton.width - Kirigami.Units.smallSpacing; model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.availableGenres().filter(checkGenreInUse) : 0; Keys.onReturnPressed: addGenre(); function addGenre() { root.model.acbfData.metaData.bookInfo.setGenre(currentText); root.model.setDirty(); currentIndex=0; } function checkGenreInUse (genre) { return root.model.acbfData.metaData.bookInfo.genres.indexOf(genre) === -1; } QtControls.Button { id: addGenreButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addGenre(); } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the character list", "Characters"); } Repeater { model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.characters : 0; delegate: QtControls.TextField { width: parent.width - removeCharacterButton.width - Kirigami.Units.smallSpacing; text: modelData; onEditingFinished: root.model.acbfData.metaData.bookInfo.characters[index] = text; QtControls.Button { id: removeCharacterButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: parent.height; width: height; onClicked: { root.model.setDirty(); root.model.acbfData.metaData.bookInfo.removeCharacter(modelData); } } } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { width: parent.width - addCharacterButton.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the add new character text entry", "Write to add new character"); Keys.onReturnPressed: addCharacter(); function addCharacter() { if(text !== "") { root.model.acbfData.metaData.bookInfo.addCharacter(text); root.model.setDirty(); text = ""; } } QtControls.Button { id: addCharacterButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addCharacter(); } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the sequence list", "Sequence"); } Repeater { id: sequenceListRepeater; model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.sequenceCount : 0; delegate: Item { width: parent.width; height: childrenRect.height; function updateSeries() { root.model.acbfData.metaData.bookInfo.sequence(modelData).title = seriesTextField.text; if (numberField.value !== root.model.acbfData.metaData.bookInfo.sequence(modelData).number) { root.model.acbfData.metaData.bookInfo.sequence(modelData).number = numberField.value; } if (volumeField.value !== root.model.acbfData.metaData.bookInfo.sequence(modelData).volume) { root.model.acbfData.metaData.bookInfo.sequence(modelData).volume = volumeField.value; } root.model.setDirty(); } QtControls.TextField { id: seriesTextField; width: parent.width - removeSequenceButton.width - Kirigami.Units.smallSpacing; text: root.model.acbfData.metaData.bookInfo.sequence(modelData).title; onEditingFinished: parent.updateSeries(); } QtControls.SpinBox { anchors { top: seriesTextField.bottom; topMargin: Kirigami.Units.smallSpacing; } value : root.model.acbfData.metaData.bookInfo.sequence(modelData).number; width : (seriesTextField.width+Kirigami.Units.smallSpacing)/2; id: numberField; onValueChanged: parent.updateSeries(); } QtControls.SpinBox { anchors { left: numberField.right; leftMargin: Kirigami.Units.smallSpacing; top: seriesTextField.bottom; topMargin: Kirigami.Units.smallSpacing; } value : root.model.acbfData.metaData.bookInfo.sequence(modelData).volume; width : (seriesTextField.width/2)-(Kirigami.Units.smallSpacing*1.5); id: volumeField; onValueChanged: parent.updateSeries(); } QtControls.Button { id: removeSequenceButton; anchors { left: seriesTextField.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: seriesTextField.height; width: height; onClicked: { root.model.setDirty(); root.model.acbfData.metaData.bookInfo.removeSequence(index); } } } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { width: parent.width - addSequenceButton.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the add new series text entry", "Write to add new series"); Keys.onReturnPressed:addSequence(); function addSequence() { if(text !== "") { root.model.acbfData.metaData.bookInfo.addSequence(0, text); root.model.setDirty(); text = ""; } } QtControls.Button { id: addSequenceButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addSequence(); } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the database reference list", "Database References"); } Repeater { model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.databaseRefCount : 0; delegate: Item { width: parent.width; height: childrenRect.height; function updateDatabaseRef() { root.model.acbfData.metaData.bookInfo.databaseRef(modelData).reference = referenceTextField.text root.model.acbfData.metaData.bookInfo.databaseRef(modelData).dbname = databaseNameField.text root.model.acbfData.metaData.bookInfo.databaseRef(modelData).type = referenceTypeField.text root.model.setDirty(); } QtControls.TextField { id: referenceTextField; width: parent.width - removeReferenceButton.width - Kirigami.Units.smallSpacing; text: root.model.acbfData.metaData.bookInfo.databaseRef(modelData).reference; onEditingFinished: parent.updateDatabaseRef(); } QtControls.TextField { anchors { top: referenceTextField.bottom; topMargin: Kirigami.Units.smallSpacing; } width : (referenceTextField.width+Kirigami.Units.smallSpacing)/2; id: databaseNameField; text: root.model.acbfData.metaData.bookInfo.databaseRef(modelData).dbname; onEditingFinished: parent.updateDatabaseRef(); } QtControls.TextField { anchors { left: databaseNameField.right; leftMargin: Kirigami.Units.smallSpacing; top: referenceTextField.bottom; topMargin: Kirigami.Units.smallSpacing; } width : (referenceTextField.width/2)-(Kirigami.Units.smallSpacing*1.5); id: referenceTypeField; text: root.model.acbfData.metaData.bookInfo.databaseRef(modelData).type; placeholderText: i18nc("placeholder text for the add reference type text entry", "Write to add reference type"); onEditingFinished: parent.updateDatabaseRef(); } QtControls.Button { id: removeReferenceButton; anchors { left: referenceTextField.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: referenceTextField.height; width: height; onClicked: { root.model.setDirty(); root.model.acbfData.metaData.bookInfo.removeDatabaseRef(index); } } } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } Item { width: parent.width; height: childrenRect.height; function addReference() { if(addReferenceField.text !== "" && addDatabaseNameField.text !== "") { root.model.acbfData.metaData.bookInfo.addDatabaseRef(addReferenceField.text, addDatabaseNameField.text); root.model.setDirty(); addReferenceField.text = ""; addDatabaseNameField.text = ""; } } QtControls.TextField { id: addReferenceField width: parent.width - addReferenceButton.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the add new reference text entry", "Write to add new reference"); Keys.onReturnPressed: parent.addReference(); } QtControls.TextField { id: addDatabaseNameField anchors { top: addReferenceField.bottom; topMargin: Kirigami.Units.smallSpacing; } width: parent.width - addReferenceButton.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the add databasename text entry", "Write to add database name for new reference."); Keys.onReturnPressed: parent.addReference(); } QtControls.Button { id: addReferenceButton; anchors { left: addReferenceField.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: addReferenceField.height; width: height; onClicked: parent.addReference(); } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the content rating list", "Content Ratings"); } Repeater { model: root.model.acbfData ? root.model.acbfData.metaData.bookInfo.contentRatingCount : 0; delegate: Item { width: parent.width; height: childrenRect.height; function updateRating() { root.model.acbfData.metaData.bookInfo.contentRating(modelData).rating = ratingNameField.text root.model.acbfData.metaData.bookInfo.contentRating(modelData).type = systemNameField.text root.model.setDirty(); } QtControls.TextField { width : (parent.width-removeRatingButton.width+Kirigami.Units.smallSpacing)/2; id: ratingNameField; text: root.model.acbfData.metaData.bookInfo.contentRating(modelData).rating; onEditingFinished: parent.updateRating(); } QtControls.TextField { anchors { left: ratingNameField.right; leftMargin: Kirigami.Units.smallSpacing; } width : ((parent.width-removeRatingButton.width)/2)-(Kirigami.Units.smallSpacing*1.5); id: systemNameField; text: root.model.acbfData.metaData.bookInfo.contentRating(modelData).type; placeholderText: i18nc("placeholder text for the add reference type text entry", "Write to add reference type"); onEditingFinished: parent.updateRating(); } QtControls.Button { id: removeRatingButton; anchors { left: systemNameField.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: systemNameField.height; width: height; onClicked: { root.model.setDirty(); root.model.acbfData.metaData.bookInfo.removeContentRating(index); } } } } Item { width: parent.width; height: childrenRect.height; function addRating() { if(addRatingField.text !== "" && addSystemField.text !== "") { root.model.acbfData.metaData.bookInfo.addContentRating(addRatingField.text, addSystemField.text); root.model.setDirty(); addRatingField.text = ""; addSystemField.text = ""; } } QtControls.TextField { width : (parent.width-addRatingButton.width+Kirigami.Units.smallSpacing)/2; id: addRatingField; placeholderText: i18nc("placeholder text for the add content rating text entry", "Write to add rating label."); onEditingFinished: parent.addRating(); } QtControls.TextField { anchors { left: addRatingField.right; leftMargin: Kirigami.Units.smallSpacing; } width : ((parent.width-addRatingButton.width)/2)-(Kirigami.Units.smallSpacing*1.5); id: addSystemField; placeholderText: i18nc("placeholder text for the add content rating system text entry", "Write to add rating system."); onEditingFinished: parent.addRating(); } QtControls.Button { id: addRatingButton; anchors { left: addSystemField.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: addSystemField.height; width: height; onClicked: parent.addRating(); } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the form for the publishing info list", "Publisher Info"); } QtControls.Label { text: i18nc("Label for publisher", "Publisher:"); } QtControls.TextField { width : parent.width; id: publisher; placeholderText: i18nc("placeholder text for the publisher entry", "Write to add publisher"); text: root.model.acbfData? root.model.acbfData.metaData.publishInfo.publisher: ""; onEditingFinished: { if (root.model.acbfData && text !=="") { root.model.acbfData.metaData.publishInfo.publisher = text root.model.setDirty(); } } } QtControls.Label { text: i18nc("Label for publishing date", "Publishing Date:"); } Item { width : parent.width; id: publishingDate; height: childrenRect.height; property date publishingDate: root.model.acbfData.metaData.publishInfo.publishDate; function changePublishDate() { root.model.acbfData.metaData.publishInfo.setPublishDateFromInts(pdYear.value, (pdMonth.currentIndex+1), pdDate.value); root.model.setDirty(); } QtControls.SpinBox { id: pdYear width: (parent.width-(Kirigami.Units.smallSpacing*2))/3; value: parent.publishingDate.getFullYear(); onValueChanged: parent.changePublishDate(); editable: true; from: 0; to: 9999; } QtControls.ComboBox { id: pdMonth anchors { left: pdYear.right; margins: Kirigami.Units.smallSpacing; } model: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] width: (parent.width-(Kirigami.Units.smallSpacing*2))/3; currentIndex: parent.publishingDate.getMonth(); displayText: Qt.locale().monthName(currentText, Locale.LongFormat); onActivated: parent.changePublishDate(); delegate: QtControls.ItemDelegate { text:Qt.locale().monthName(modelData, Locale.LongFormat); } } QtControls.SpinBox { id: pdDate anchors { left: pdMonth.right; margins: Kirigami.Units.smallSpacing; } width: (parent.width-(Kirigami.Units.smallSpacing*2))/3; height: pdMonth.height; from: 1; to: 31; editable: true; value: parent.publishingDate.getDate(); onValueChanged: parent.changePublishDate(); } } QtControls.Label { text: i18nc("Label for city", "City:"); } QtControls.TextField { width : parent.width; id: city; placeholderText: i18nc("placeholder text for the publishing city entry", "Write to add city"); text: root.model.acbfData? root.model.acbfData.metaData.publishInfo.city: ""; onEditingFinished: { if (root.model.acbfData && text !=="") { root.model.acbfData.metaData.publishInfo.city = text ; root.model.setDirty(); } } } QtControls.Label { text: i18nc("Label for isbn", "ISBN:"); } QtControls.TextField { width : parent.width; id: isbn; placeholderText: i18nc("placeholder text for the publishing isbn entry", "Write to add isbn"); text: root.model.acbfData? root.model.acbfData.metaData.publishInfo.isbn: ""; onEditingFinished: { if (root.model.acbfData && text !=="") { root.model.acbfData.metaData.publishInfo.isbn = text root.model.setDirty(); } } } QtControls.Label { text: i18nc("Label for license", "License:"); } QtControls.TextField { width : parent.width; id: license; placeholderText: i18nc("placeholder text for the publishing license entry", "Write to add license"); text: root.model.acbfData? root.model.acbfData.metaData.publishInfo.license: ""; onEditingFinished: { if (root.model.acbfData && text !=="") { root.model.acbfData.metaData.publishInfo.license = text root.model.setDirty(); } } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the form for the document info list", "Document Authors"); } Repeater { id: docAuthorRepeater; model: root.model.acbfData ? root.model.acbfData.metaData.documentInfo.authorNames : 0; delegate: QtControls.Label { width: parent.width - removeDocAuthorButton.width - Kirigami.Units.smallSpacing; text: modelData.length > 0 ? modelData : "(unnamed)"; QtControls.Button { id: editDocAuthorButton; anchors { right: removeDocAuthorButton.left; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "document-edit"; } height: parent.height; width: height; onClicked: { docAuthorEditor.index = model.index; docAuthorEditor.open(); } } QtControls.Button { id: removeDocAuthorButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: parent.height; width: height; onClicked: { // When removing, set the model dirty first, and then remove the entry to avoid reference errors. root.model.setDirty(); root.model.acbfData.metaData.documentInfo.removeAuthor(index); } } } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { width: parent.width - addDocAuthorButton.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the add new author text entry", "Write to add new author (nickname)"); Keys.onReturnPressed: addAuthor(); function addAuthor() { if(text !== "") { // Just add an author where only the nickname is defined root.model.acbfData.metaData.documentInfo.addAuthor("", "", "", "", "", text, [""], [""]); root.model.setDirty(); text = ""; } } QtControls.Button { id: addDocAuthorButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addAuthor(); } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the form for the sources list", "Document Sources"); } Repeater { model: root.model.acbfData ? root.model.acbfData.metaData.documentInfo.source : 0; delegate: Item { width: parent.width; height: childrenRect.height; QtControls.TextField { id: sourceText; width: parent.width - removeSourceButton.width - Kirigami.Units.smallSpacing; text: modelData; onEditingFinished: root.model.acbfData.metaData.documentInfo.sources[index] = text; QtControls.Button { id: removeSourceButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: parent.height; width: height; onClicked: { root.model.setDirty(); root.model.acbfData.metaData.documentInfo.removeSource(index); } } } } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { width: parent.width - addSourceButton.width - Kirigami.Units.smallSpacing; Keys.onReturnPressed: addEntry(); function addEntry() { if (text !== "") { root.model.acbfData.metaData.documentInfo.source.push(text); root.model.setDirty(); text = ""; } } QtControls.Button { id: addSourceButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addEntry(); } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the form for the history list", "Document History"); } Repeater { model: root.model.acbfData ? root.model.acbfData.metaData.documentInfo.history : 0; delegate: Item { width: parent.width; height: childrenRect.height; QtControls.TextField { id: historyText; width: parent.width - removeHistoryButton.width - Kirigami.Units.smallSpacing; text: modelData; onEditingFinished: root.model.acbfData.metaData.documentInfo.history[index] = text; QtControls.Button { id: removeHistoryButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: parent.height; width: height; onClicked: { root.model.setDirty(); root.model.acbfData.metaData.documentInfo.removeHistoryLine(index); } } } } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { width: parent.width - addHistoryButton.width - Kirigami.Units.smallSpacing; Keys.onReturnPressed: addEntry(); function addEntry() { if (text !== "") { root.model.acbfData.metaData.documentInfo.history.push(text); root.model.setDirty(); text = ""; } } QtControls.Button { id: addHistoryButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addEntry(); } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } Item { width: parent.width; height: childrenRect.height; QtControls.Label { id: versionLabel; height: versionSpinBox.height; text: i18nc("Label for the document version spinbox","Document Version:"); } QtControls.SpinBox { id: versionSpinBox; anchors { top: versionLabel.top; left: versionLabel.right; leftMargin: Kirigami.Units.smallSpacing; } width: parent.width - (Kirigami.Units.smallSpacing*2) - versionLabel.width - addHistoryButton.width; value: root.model.acbfData.metaData.documentInfo.version; onValueChanged: { if (root.model.acbfData.metaData.documentInfo.version!==value) { root.model.acbfData.metaData.documentInfo.version = value; } } } } AuthorEntryEditor { id: authorEditor; bookinfo: root.model.acbfData.metaData.bookInfo; onSave: { root.model.acbfData.metaData.bookInfo.setAuthor(index, activity, language, firstName, middleName, lastName, nickName, homePage, email); root.model.setDirty(); } } AuthorEntryEditor { id: docAuthorEditor; bookinfo: root.model.acbfData.metaData.documentInfo; onSave: { root.model.acbfData.metaData.documentInfo.setAuthor(index, activity, language, firstName, middleName, lastName, nickName, homePage, email); root.model.setDirty(); } } } } diff --git a/src/creator/qml/BookPage.qml b/src/creator/qml/BookPage.qml index 877c73d..5d95dbc 100644 --- a/src/creator/qml/BookPage.qml +++ b/src/creator/qml/BookPage.qml @@ -1,241 +1,242 @@ /* * Copyright (C) 2015 Dan Leinir Turthra Jensen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ import QtQuick 2.2 import org.kde.kirigami 2.1 as Kirigami /** * Page that holds an image to edit the frames on. */ Kirigami.Page { id: root; property string categoryName: "bookPage"; title: i18nc("title of the page editing sub-page for the book editor", "Page %1", root.pageTitle === "" ? root.index : root.pageTitle); property QtObject model; property QtObject currentPage; property int index: -1; property string pageUrl: ""; property string pageTitle: ""; signal save(); onIndexChanged: { if (root.index===0) { root.currentPage = root.model.acbfData.metaData.bookInfo.coverpage(); } else if (root.index > 0) { root.currentPage = root.model.acbfData.body.page(root.index-1); } root.pageTitle = root.currentPage.title(""); // Let's ensure there's always a default text-layer. if (root.currentPage.textLayerLanguages.length === 0) { root.currentPage.addTextLayer("") } else if (root.currentPage.textLayerLanguages.indexOf("") < 0) { root.currentPage.duplicateTextLayer(root.currentPage.textLayerLanguages[1], ""); } } actions { main: saveAndCloseAction; right: editPageDataAction; } Kirigami.Action { id: saveAndCloseAction; text: i18nc("Saves the remaining unsaved edited fields and closes the page editor", "Save and Close Page"); iconName: "dialog-ok"; + shortcut: "Esc"; onTriggered: { root.save(); root.model.setDirty(); pageStack.pop(); } } Kirigami.Action { id: editPageDataAction; - text: i18nc("Saves the remaining unsaved edited fields and closes the page editor", "Save and Close Page"); + text: i18nc("Edit the page data in detail", "Edit Page Data"); iconName: "document-edit" onTriggered: pageStack.push(pageInfo) } Image { id: coverImage; anchors { fill: parent; margins: Kirigami.Units.smallSpacing; } asynchronous: true; fillMode: Image.PreserveAspectFit; source: pageUrl; width: root.width; height: root.height; property real muliplierWidth: (paintedWidth / sourceSize.width); property real muliplierHeight: (paintedHeight / sourceSize.height); property int offsetX: (width-paintedWidth)/2 property int offsetY: (height-paintedHeight)/2 Repeater { model: root.currentPage.frameCount Rectangle { width: coverImage.muliplierWidth * root.currentPage.frame(index).bounds.width; height: coverImage.muliplierHeight * root.currentPage.frame(index).bounds.height; x: coverImage.muliplierWidth * root.currentPage.frame(index).bounds.x + coverImage.offsetX y: coverImage.muliplierHeight * root.currentPage.frame(index).bounds.y + coverImage.offsetY; opacity: 0.2; color: "blue"; border.color: "blue"; Rectangle { anchors.fill: parent; border.color: "blue"; color: "transparent"; border.width: Kirigami.Units.smallSpacing; } } } Repeater { model: root.currentPage.textLayer("").textareaCount Rectangle { width: coverImage.muliplierWidth * root.currentPage.textLayer("").textarea(index).bounds.width; height: coverImage.muliplierHeight * root.currentPage.textLayer("").textarea(index).bounds.height; x: coverImage.muliplierWidth * root.currentPage.textLayer("").textarea(index).bounds.x + coverImage.offsetX y: coverImage.muliplierHeight * root.currentPage.textLayer("").textarea(index).bounds.y + coverImage.offsetY; opacity: { 0.2;} color: "red"; border.color: "red"; border.width: Kirigami.Units.smallSpacing; Rectangle { anchors.fill: parent; border.color: "red"; color: "transparent"; border.width: Kirigami.Units.smallSpacing; } } } Repeater { model: root.currentPage.jumpCount Rectangle { width: coverImage.muliplierWidth * root.currentPage.jump(index).bounds.width; height: coverImage.muliplierHeight * root.currentPage.jump(index).bounds.height; x: coverImage.muliplierWidth * root.currentPage.jump(index).bounds.x + coverImage.offsetX y: coverImage.muliplierHeight * root.currentPage.jump(index).bounds.y + coverImage.offsetY; opacity: { 0.2;} color: "green"; border.color: "green"; border.width: Kirigami.Units.smallSpacing; Rectangle { anchors.fill: parent; border.color: "green"; color: "transparent"; border.width: Kirigami.Units.smallSpacing; } } } MouseArea { anchors.fill: parent; id: pointCatchArea; property point startPoint: Qt.point(0,0); property point endPoint: Qt.point(0,0); property bool dragging: false; hoverEnabled: true; onClicked: { if (dragging == false) { startPoint = Qt.point(mouse.x, mouse.y); endPoint = startPoint; dragging = true; } else { if (Qt.point(mouse.x, mouse.y)!==startPoint) { endPoint = Qt.point(mouse.x, mouse.y) dragging = false; createFrame(); } } mouse.accepted } onPositionChanged: { if (dragging) { endPoint = Qt.point(mouse.x, mouse.y) } } Rectangle { x: Math.min(parent.startPoint.x, parent.endPoint.x); y: Math.min(parent.startPoint.y, parent.endPoint.y); width: Math.max(parent.startPoint.x, parent.endPoint.x) - Math.min(parent.startPoint.x, parent.endPoint.x); height: Math.max(parent.startPoint.y, parent.endPoint.y) - Math.min(parent.startPoint.y, parent.endPoint.y); opacity: 0.5; border.color: "black"; border.width: 1; } function createFrame() { var x = ( Math.min(startPoint.x, endPoint.x) - coverImage.offsetX ) / coverImage.muliplierWidth; var x2 = ( Math.max(startPoint.x, endPoint.x) - coverImage.offsetX ) / coverImage.muliplierWidth; var y = ( Math.min(startPoint.y, endPoint.y) - coverImage.offsetY ) / coverImage.muliplierHeight; var y2 = ( Math.max(startPoint.y, endPoint.y) - coverImage.offsetY ) / coverImage.muliplierHeight; addPageArea.topLeft = Qt.point(x,y); addPageArea.bottomRight = Qt.point(x2,y2); endPoint = startPoint; addPageArea.open(); } } } Component { id: pageInfo; PageMetaInfo { page: root.currentPage; onSave: {root.pageTitle = page.title(""); root.model.setDirty();} } } AddPageArea { id: addPageArea onSave: { var index = 0; if (type===0) { index = root.currentPage.frameCount; root.currentPage.addFrame(index); root.currentPage.frame(index).setPointsFromRect(topLeft, bottomRight); } else if (type===1) { index = root.currentPage.textLayer("").textareaCount; root.currentPage.textLayer("").addTextarea(index); root.currentPage.textLayer("").textarea(index).setPointsFromRect(topLeft, bottomRight); } else if (type===2) { index = root.currentPage.jumpCount; root.currentPage.addJump(index); root.currentPage.jump(index).setPointsFromRect(topLeft, bottomRight); } } } } diff --git a/src/creator/qml/PageMetaInfo.qml b/src/creator/qml/PageMetaInfo.qml index d05ed13..d232cc2 100644 --- a/src/creator/qml/PageMetaInfo.qml +++ b/src/creator/qml/PageMetaInfo.qml @@ -1,269 +1,270 @@ /* * Copyright (C) 2018 Wolthera van Hövell tot Westerflier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ import QtQuick 2.2 import QtQuick.Controls 2.2 as QtControls import org.kde.kirigami 2.1 as Kirigami /** * Page that holds an image to edit the frames on. */ import QtQuick 2.0 Kirigami.ScrollablePage { id: root; title: i18nc("title text for the page meta information editor sheet", "Edit Page Information"); property QtObject page; property string colorname: "#ffffff"; signal save(); actions { main: saveAndCloseAction; } Kirigami.Action { id: saveAndCloseAction; text: i18nc("Saves the remaining unsaved edited fields and closes the metainfo editor", "Close Editor"); iconName: "dialog-ok"; + shortcut: "Esc"; onTriggered: { root.page.setTitle(defaultTitle.text, "") root.page.bgcolor = pageBackgroundColor.text; root.save(); pageStack.pop(); } } Column { id: contentColumn; width: root.width - (root.leftPadding + root.rightPadding); height: childrenRect.height; spacing: Kirigami.Units.smallSpacing; Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the page title", "Title"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { id: defaultTitle; width: parent.width; placeholderText: i18nc("placeholder text for default page text-input", "Write to add default title"); text: root.page.title(""); onEditingFinished: root.page.setTitle(text, ""); } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the page transition type", "Transition"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.ComboBox { id: transition; width: parent.width; model: root.page.availableTransitions(); currentIndex: root.page.transition!==""? root.page.availableTransitions().indexOf(root.page.transition): root.page.availableTransitions().indexOf("none"); onActivated: root.page.transition = currentText; } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the page background color", "Background Color"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.TextField { id: pageBackgroundColor; width: parent.width; placeholderText: root.colorname; text: root.page.bgcolor; onEditingFinished: root.page.bgcolor = text; } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the page frames", "Frames"); } ListView { width: parent.width; height: childrenRect.height; model: page.frameCount delegate: Kirigami.SwipeListItem { id: frameItem; height: Kirigami.Units.iconSizes.huge + Kirigami.Units.smallSpacing * 2; width: parent.width; supportsMouseEvents: true; actions: [ Kirigami.Action { text: i18nc("swap the position of this frame with the previous one", "Move Up"); iconName: "go-up" onTriggered: { page.swapFrames(index, index - 1); } enabled: index > 0; visible: enabled; }, Kirigami.Action { text: i18nc("swap the position of this frame with the next one", "Move Down"); iconName: "go-down" onTriggered: { page.swapFrames(index, index + 1); } enabled: index < page.frameCount - 1; visible: enabled; }, Kirigami.Action { text: i18nc("remove the frame from the page", "Delete Frame"); iconName: "list-remove" onTriggered: page.removeFrame(index); } ] Item { anchors.fill: parent; QtControls.Label { text: i18nc("Comic book panel frame name.", "Frame %1", index+1); } } } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the page textareas", "Text Areas"); } ListView { model: page.textLayer("").textareaCount; width: parent.width; height: childrenRect.height; delegate: Kirigami.SwipeListItem { id: textAreaItem; height: Kirigami.Units.iconSizes.huge + Kirigami.Units.smallSpacing * 2; supportsMouseEvents: true; actions: [ Kirigami.Action { text: i18nc("swap the position of this text area with the previous one", "Move Up"); iconName: "go-up" onTriggered: { page.textLayer("").swapTextareas(index, index - 1); } enabled: index > 0; visible: enabled; }, Kirigami.Action { text: i18nc("swap the position of this text area with the next one", "Move Down"); iconName: "go-down" onTriggered: { page.textLayer("").swapTextareas(index, index + 1); } enabled: index < page.textLayer("").textareaCount - 1; visible: enabled; }, Kirigami.Action { text: i18nc("remove the text area from the page", "Delete Text Area"); iconName: "list-remove" onTriggered: page.textLayer("").removeTextarea(index); } ] Item { anchors.fill:parent; QtControls.Label { id: textareaLabel; text: i18nc("Comic book panel textarea name.", "Text Area %1", index+1); } QtControls.TextArea { anchors { top: textareaLabel.bottom; topMargin: Kirigami.Units.smallSpacing; } width:parent.width-Kirigami.Units.iconSizes.huge; text: page.textLayer("").textarea(index).paragraphs.join("\n\n"); onEditingFinished: page.textLayer("").textarea(index).paragraphs = text.split("\n\n"); } } } } Kirigami.Heading { width: parent.width; height: paintedHeight + Kirigami.Units.smallSpacing * 2; text: i18nc("label text for the edit field for the page jumps", "Jumps"); } ListView { model: page.jumpCount width: parent.width; height: childrenRect.height; delegate: Kirigami.SwipeListItem { id: jumpItem; height: Kirigami.Units.iconSizes.huge + Kirigami.Units.smallSpacing * 2; supportsMouseEvents: true; actions: [ Kirigami.Action { text: i18nc("swap the position of this jump with the previous one", "Move Up"); iconName: "go-up" onTriggered: { page.swapJumps(index, index - 1); } enabled: index > 0; visible: enabled; }, Kirigami.Action { text: i18nc("swap the position of this jump with the next one", "Move Down"); iconName: "go-down" onTriggered: { page.swapJumps(index, index + 1); } enabled: index < page.jumpCount - 1; visible: enabled; }, Kirigami.Action { text: i18nc("remove the jump from the page", "Delete Jump"); iconName: "list-remove" onTriggered: page.removeJump(index); } ] Item { anchors.fill:parent; QtControls.Label { id: jumpLabel; text: i18nc("Comic book panel jump name.", "Jump %1", index+1); } QtControls.Label { id: pageIndexLabel; anchors { top: jumpLabel.bottom; topMargin: Kirigami.Units.smallSpacing; } height: jumpIndexSpin.height; text: i18nc("Label from jump page index.", "Page Index:"); } QtControls.SpinBox { anchors { top: jumpLabel.bottom; topMargin: Kirigami.Units.smallSpacing; left: pageIndexLabel.right; leftMargin: Kirigami.Units.smallSpacing; } from: 0; to: 99; id: jumpIndexSpin; value: page.jump(index).pageIndex; onValueChanged: { if (page.jump(index).pageIndex !== value) { page.jump(index).pageIndex = value; } } } } } } } } diff --git a/src/creator/qml/metainfoeditors/AuthorEntryEditor.qml b/src/creator/qml/metainfoeditors/AuthorEntryEditor.qml index 8a2a1c6..5f368f3 100644 --- a/src/creator/qml/metainfoeditors/AuthorEntryEditor.qml +++ b/src/creator/qml/metainfoeditors/AuthorEntryEditor.qml @@ -1,293 +1,297 @@ /* * Copyright (C) 2015 Dan Leinir Turthra Jensen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ import QtQuick 2.2 import org.kde.kirigami 2.1 as Kirigami import QtQuick.Controls 2.2 as QtControls /** * @brief a special overlay sheet for editing the author information. * * Authors can have the full names, nicknames and some contact information * like email adress and homepage. They can also be assigned a role * from a list of predefined author activities. * * Author is used in acbf for both the actual authors as well as the people * who handled generating the acbf document, which is why this is * a dedicated form. * * TODO: Support input for multiple homepage and email adresses. */ Kirigami.OverlaySheet { id: root; property int index: -1; property QtObject bookinfo: null; signal save(); onIndexChanged: { root.author = bookinfo.getAuthor(index); activityField.model = root.author.availableActivities(); activityField.currentIndex = activityField.find(author.activity()); languageField.text = root.author.language(); firstNameField.text = root.author.firstName(); middleNameField.text = root.author.middleName(); lastNameField.text = root.author.lastName(); nickNameField.text = root.author.nickName(); } property QtObject author: null; property alias activity: activityField.currentText; property alias language: languageField.text; property alias firstName: firstNameField.text; property alias middleName: middleNameField.text; property alias lastName: lastNameField.text; property alias nickName: nickNameField.text; property var homePage: root.author.homePages; property var email: root.author.emails; Column { height: childrenRect.height; spacing: Kirigami.Units.smallSpacing; Kirigami.Heading { width: parent.width; height: paintedHeight; text: i18nc("title text for the edit author sheet", "Edit Author"); QtControls.Button { id: saveButton; anchors { right: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "dialog-ok"; } height: parent.height; width: height; + Keys.onReturnPressed: { + root.save(); + root.close(); + } onClicked: { root.save(); root.close(); } } } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("help text for the edit author sheet", "Please coplete the information for this author."); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } Item { width: parent.width; height: Kirigami.Units.largeSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the activity field", "Activity:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } QtControls.ComboBox { //enabled: activity; id: activityField; width: parent.width - Kirigami.Units.smallSpacing; } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the language field", "Language:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } QtControls.TextField { id: languageField; width: parent.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the language field", "Language"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the first name field", "First name:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } QtControls.TextField { id: firstNameField; width: parent.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the first name field", "First Name"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the middle name field", "Middle name:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } QtControls.TextField { id: middleNameField; width: parent.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the middle name field", "Middle Name"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the last name field", "Last name:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } QtControls.TextField { id: lastNameField; width: parent.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the last name field", "Last Name"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the nickname field", "Nickname:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } QtControls.TextField { id: nickNameField; width: parent.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the nickname field", "Nickname"); } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the homepage field", "Homepage addresses:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } Repeater { model: root.author.homePages; QtControls.TextField { width: parent.width - removeHomePageButton.width - Kirigami.Units.smallSpacing; text: modelData; onEditingFinished: root.author.homePages[index] = text; QtControls.Button { id: removeHomePageButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: parent.height; width: height; onClicked: root.author.removeHomePage(index); } } } QtControls.TextField { id: homePageField; width: parent.width - addHomepageButton.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the homepage field", "Add Homepage"); Keys.onReturnPressed: addEntry(); function addEntry() { if (text!=="") { root.author.addHomePage(text); text=""; } } QtControls.Button { id: addHomepageButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addEntry(); } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } QtControls.Label { width: parent.width; height: paintedHeight; text: i18nc("label for the email field", "Email addresses:"); wrapMode: Text.WrapAtWordBoundaryOrAnywhere; } Repeater { model: root.author.emails; QtControls.TextField { width: parent.width - addEmailButton.width - Kirigami.Units.smallSpacing; text: modelData; onEditingFinished: root.author.emails[index] = text; QtControls.Button { id: removeEmailButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-remove"; } height: parent.height; width: height; onClicked: root.author.removeEmail(index); } } } QtControls.TextField { id: emailField; width: parent.width - addEmailButton.width - Kirigami.Units.smallSpacing; placeholderText: i18nc("placeholder text for the email field", "Add Email address"); Keys.onReturnPressed: addEntry(); function addEntry() { if (text!=="") { root.author.addEmail(text); text = ""; } } QtControls.Button { id: addEmailButton; anchors { left: parent.right; leftMargin: Kirigami.Units.smallSpacing; } contentItem: Kirigami.Icon { source: "list-add"; } height: parent.height; width: height; onClicked: parent.addEntry(); } } Item { width: parent.width; height: Kirigami.Units.smallSpacing; } } }