Changeset View
Changeset View
Standalone View
Standalone View
applets/kimpanel/backend/ibus/emojier/ui/CategoryPage.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2019 Aleix Pol Gonzalez <aleixpol@kde.org> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2 of | ||||
7 | * the License or (at your option) version 3 or any later version | ||||
8 | * accepted by the membership of KDE e.V. (or its successor approved | ||||
9 | * by the membership of KDE e.V.), which shall act as a proxy | ||||
10 | * defined in Section 14 of version 3 of the license. | ||||
11 | * | ||||
12 | * This program 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 | ||||
15 | * GNU General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU General Public License | ||||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | import QtQuick 2.11 | ||||
22 | import QtQuick.Layouts 1.3 | ||||
23 | import org.kde.kirigami 2.6 as Kirigami | ||||
24 | import QtQuick.Controls 2.11 as QQC2 | ||||
25 | import org.kde.plasma.emoji 1.0 | ||||
26 | | ||||
27 | Kirigami.ScrollablePage | ||||
28 | { | ||||
29 | id: view | ||||
30 | property alias model: emojiModel.sourceModel | ||||
31 | property alias category: filter.category | ||||
32 | | ||||
33 | header: QQC2.TextField { | ||||
34 | id: searchField | ||||
35 | Layout.fillWidth: true | ||||
36 | placeholderText: i18n("Search...") | ||||
37 | onTextChanged: emojiModel.search = text | ||||
38 | height: visible ? implicitHeight : 0 | ||||
39 | visible: false | ||||
40 | } | ||||
41 | | ||||
42 | actions.main: Kirigami.Action { | ||||
43 | icon.name: "search" | ||||
44 | tooltip: i18n("Search...") | ||||
45 | shortcut: StandardKey.Find | ||||
46 | onTriggered: { | ||||
47 | searchField.visible = true | ||||
48 | searchField.focus = true | ||||
49 | } | ||||
50 | } | ||||
51 | | ||||
52 | GridView { | ||||
53 | cellWidth: 64 | ||||
54 | cellHeight: cellWidth | ||||
55 | model: CategoryModelFilter { | ||||
56 | id: filter | ||||
57 | sourceModel: SearchModelFilter { | ||||
58 | id: emojiModel | ||||
59 | } | ||||
60 | } | ||||
61 | | ||||
62 | delegate: QQC2.Label { | ||||
63 | font.pointSize: 30 | ||||
64 | fontSizeMode: Text.Fit | ||||
65 | minimumPointSize: 10 | ||||
66 | text: model.display | ||||
67 | | ||||
68 | QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay | ||||
69 | QQC2.ToolTip.text: model.toolTip | ||||
70 | QQC2.ToolTip.visible: mouse.containsMouse | ||||
71 | | ||||
72 | opacity: mouse.containsMouse ? 0.7 : 1 | ||||
73 | | ||||
74 | MouseArea { | ||||
75 | id: mouse | ||||
76 | anchors.fill: parent | ||||
77 | hoverEnabled: true | ||||
78 | onClicked: window.report(model.display, model.toolTip) | ||||
79 | } | ||||
80 | } | ||||
81 | } | ||||
82 | } |