Changeset View
Changeset View
Standalone View
Standalone View
src/creator/qml/AddPageArea.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2018 Wolthera van Hövell tot Westerflier<griffinvalley@gmail.com> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | * later version accepted by the membership of KDE e.V. (or its | ||||
9 | * successor approved by the membership of KDE e.V.), which shall | ||||
10 | * act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | * | ||||
12 | * This library is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | * Lesser General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU Lesser General Public | ||||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | * | ||||
20 | */ | ||||
21 | | ||||
22 | import QtQuick 2.2 | ||||
23 | | ||||
24 | import org.kde.kirigami 2.1 as Kirigami | ||||
25 | import QtQuick.Controls 2.2 as QtControls | ||||
26 | /** | ||||
27 | * @brief a special overlay sheet for adding frames/textareas/jumps | ||||
28 | */ | ||||
29 | Kirigami.OverlaySheet { | ||||
30 | id: root; | ||||
31 | signal save(); | ||||
32 | property alias type: typeComboBox.currentIndex; | ||||
33 | property point topLeft; | ||||
34 | property point bottomRight; | ||||
35 | | ||||
36 | Column { | ||||
37 | height: childrenRect.height; | ||||
38 | spacing: Kirigami.Units.smallSpacing; | ||||
39 | Kirigami.Heading { | ||||
40 | width: parent.width; | ||||
41 | height: paintedHeight; | ||||
42 | text: i18nc("title text for the add page area sheet", "Add Page Area"); | ||||
43 | QtControls.Button { | ||||
44 | id: closeButton; | ||||
45 | anchors { | ||||
46 | right: saveButton.left; | ||||
47 | rightMargin: Kirigami.Units.smallSpacing; | ||||
48 | } | ||||
49 | contentItem: Kirigami.Icon { | ||||
50 | source: "dialog-cancel"; | ||||
51 | } | ||||
52 | height: parent.height; | ||||
53 | width: height; | ||||
54 | Keys.onReturnPressed: root.close(); | ||||
55 | onClicked: root.close(); | ||||
56 | } | ||||
57 | QtControls.Button { | ||||
58 | id: saveButton; | ||||
59 | anchors { | ||||
60 | right: parent.right; | ||||
61 | leftMargin: Kirigami.Units.smallSpacing; | ||||
62 | } | ||||
63 | contentItem: Kirigami.Icon { | ||||
64 | source: "dialog-ok"; | ||||
65 | } | ||||
66 | height: parent.height; | ||||
67 | width: height; | ||||
68 | Keys.onReturnPressed: saveAndClose(); | ||||
69 | onClicked: saveAndClose(); | ||||
70 | | ||||
71 | function saveAndClose() { | ||||
72 | root.save(); | ||||
73 | root.close(); | ||||
74 | } | ||||
75 | } | ||||
76 | } | ||||
77 | Item { | ||||
78 | width: parent.width; | ||||
79 | height: Kirigami.Units.largeSpacing; | ||||
80 | } | ||||
81 | | ||||
82 | QtControls.Label { | ||||
83 | width: parent.width; | ||||
84 | height: paintedHeight; | ||||
85 | text: i18nc("label for the activity field", "Activity:"); | ||||
86 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere; | ||||
87 | } | ||||
88 | QtControls.ComboBox { | ||||
89 | id: typeComboBox; | ||||
90 | model: [i18n("Frame"), i18n("Textarea"), i18n("Jump")] | ||||
91 | width: parent.width - Kirigami.Units.smallSpacing; | ||||
92 | } | ||||
93 | } | ||||
94 | } |