Warning, /graphics/peruse/src/creator/qml/WelcomePage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * Copyright (C) 2015 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) version 3, or any
0008  * later version accepted by the membership of KDE e.V. (or its
0009  * successor approved by the membership of KDE e.V.), which shall
0010  * act as a proxy defined in Section 6 of version 3 of the license.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public
0018  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0019  *
0020  */
0021 
0022 import QtQuick 2.12
0023 import QtQuick.Controls 2.12 as QtControls
0024 
0025 import org.kde.kirigami 2.13 as Kirigami
0026 /**
0027  * @brief The page on which Peruse Creator opens.
0028  * 
0029  * This page gives an introduction to peruse and has options for:
0030  * - Opening the last opened archive by either Peruse or Peruse Creator.
0031  * - Opening an existing comic.
0032  * - Creating a blank comic.
0033  * - Creating a comic archive from a selection of images.
0034  */
0035 Kirigami.ScrollablePage {
0036     id: root;
0037     property string categoryName: "welcomePage";
0038     title: i18nc("title of the welcome page", "Welcome");
0039 
0040     ListView {
0041         id: startupChoices
0042         header: Column {
0043             height: titleContainer.height + instructionsCard.height + Kirigami.Units.largeSpacing * 5;
0044             width: startupChoices.width;
0045             spacing: Kirigami.Units.largeSpacing
0046             Item { height: Kirigami.Units.largeSpacing; width: Kirigami.Units.largeSpacing; }
0047             Item {
0048                 id: titleContainer;
0049                 anchors.horizontalCenter: parent.horizontalCenter
0050                 width: startupChoices.width - Kirigami.Units.largeSpacing * 4
0051                 height: appNameLabel.height + appDescriptionLabel.height + Kirigami.Units.largeSpacing;
0052                 Kirigami.Heading {
0053                     id: appNameLabel;
0054                     anchors {
0055                         left: parent.left;
0056                         right: parent.right;
0057                         bottom: parent.verticalCenter;
0058                     }
0059                     text: i18nc("The application's name", "Peruse Creator");
0060                     horizontalAlignment: Text.AlignHCenter;
0061                 }
0062                 QtControls.Label {
0063                     id: appDescriptionLabel;
0064                     anchors {
0065                         top: parent.verticalCenter;
0066                         left: parent.left;
0067                         right: parent.right;
0068                     }
0069                     text: i18nc("application subtitle", "Comic Book Creation Tool");
0070                     horizontalAlignment: Text.AlignHCenter;
0071                 }
0072                 Rectangle {
0073                     anchors.centerIn: parent;
0074                     height: 1;
0075                     color: Kirigami.Theme.textColor;
0076                     width: appDescriptionLabel.paintedWidth;
0077                 }
0078             }
0079             Kirigami.Card {
0080                 id: instructionsCard
0081                 width: startupChoices.width - Kirigami.Units.largeSpacing * 4
0082                 anchors.horizontalCenter: parent.horizontalCenter
0083                 contentItem: QtControls.Label {
0084                     wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
0085                     padding: Kirigami.Units.smallSpacing;
0086                     text: i18nc("Longer introduction text used on the welcome page", "Welcome to Peruse Creator, a tool designed to assist you in creating comic book archives which can be read with any cbz capable comic book reader app. You can either create entirely new comic book archives from scratch, create one from a set of pictures, or editing existing archives. Once you have created them, you can even publish them directly to the online comic book archive at the KDE Store from within the application, or just share the files with your friends.");
0087                 }
0088             }
0089             Item { height: Kirigami.Units.largeSpacing; width: Kirigami.Units.largeSpacing; }
0090         }
0091         Component.onCompleted: {
0092             startupChoices.model.append( {
0093                 text: i18nc("@action:button open existing comic book archive", "Open Existing..."),
0094                 subtitle: "",
0095                 icon: "document-open",
0096                 script: " mainWindow.openOther()"
0097             });
0098             startupChoices.model.append( {
0099                 text: i18nc("@action:button create a new, empty comic book archive", "Create Blank"),
0100                 subtitle: "",
0101                 icon: "document-new",
0102                 script: "mainWindow.changeCategory(createNewBookPage)"
0103             });
0104             startupChoices.model.append( {
0105                 text: i18nc("@action:button create a new comic book archive by copying in a bunch of pictures", "Create from Images..."),
0106                 subtitle: "",
0107                 icon: "folder-open",
0108                 script: ""
0109             });
0110             if(peruseConfig.recentlyOpened.length > 0) {
0111                 for(var i = 0; i < peruseConfig.recentlyOpened.length; ++i) {
0112                     if(peruseConfig.recentlyOpened[i].toLowerCase().slice(-4) === ".cbz") {
0113                         var recentBook = peruseConfig.recentlyOpened[i];
0114                         startupChoices.model.append({
0115                             text: i18nc("@action:button continue working on the most recently opened comic book archive", "Continue working on %1", recentBook.split('/').pop()),
0116                             subtitle: recentBook,
0117                             icon: "image://comiccover/" + recentBook,
0118                             script: "mainWindow.openBook(\"" + recentBook + "\")"
0119                         });
0120                     }
0121                 }
0122             }
0123         }
0124         model: ListModel { }
0125         delegate: Kirigami.BasicListItem {
0126             height: Kirigami.Units.gridUnit * 3
0127             text: model.text
0128             subtitle: model.subtitle
0129             icon: model.icon
0130             onClicked: eval(model.script);
0131         }
0132     }
0133 }