KNewStuff

FeedbackOverlay.qml
1 /*
2  * Copyright (C) 2019 Dan Leinir Turthra Jensen <[email protected]>
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.11
23 import QtQuick.Controls 2.11 as QtControls
24 
25 import org.kde.kirigami 2.7 as Kirigami
26 
27 import org.kde.newstuff 1.62 as NewStuff
28 
29 Item {
30  property QtObject newStuffModel
31  visible: opacity > 0
32  opacity: (model.status == NewStuff.ItemsModel.InstallingStatus || model.status == NewStuff.ItemsModel.UpdatingStatus) ? 1 : 0
33  Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration; } }
34  Rectangle {
35  anchors.fill: parent
36  color: Kirigami.Theme.backgroundColor
37  opacity: 0.9;
38  }
39  QtControls.BusyIndicator {
40  anchors {
41  horizontalCenter: parent.horizontalCenter
42  bottom: parent.verticalCenter
43  bottomMargin: Kirigami.Units.smallSpacing
44  }
45  running: parent.visible
46  }
47  QtControls.Label {
48  id: statusLabel
49  Connections {
50  target: newStuffModel
51  onEntryChanged: {
52  var status = newStuffModel.data(newStuffModel.index(index, 0), NewStuff.ItemsModel.StatusRole);
53  if (status == NewStuff.ItemsModel.DownloadableStatus
54  || status == NewStuff.ItemsModel.InstalledStatus
55  || status == NewStuff.ItemsModel.UpdateableStatus
56  || status == NewStuff.ItemsModel.DeletedStatus) {
57  statusLabel.text = "";
58  } else if (status == NewStuff.ItemsModel.InstallingStatus) {
59  statusLabel.text = i18ndc("knewstuff5", "Label for the busy indicator showing an item is being installed", "Installing...");
60  } else if (status == NewStuff.ItemsModel.UpdatingStatus) {
61  statusLabel.text = i18ndc("knewstuff5", "Label for the busy indicator showing an item is in the process of being updated", "Updating...");
62  } else {
63  statusLabel.text = i18ndc("knewstuff5", "Label for the busy indicator which should only be shown when the entry has been given some unknown or invalid status.", "Invalid or unknown state. <a href=\"https://bugs.kde.org/enter_bug.cgi?product=frameworks-knewstuff\">Please report this to the KDE Community in a bug report</a>.");
64  }
65  }
66  }
67  onLinkActivated: Qt.openUrlExternally(link);
68  anchors {
69  top: parent.verticalCenter
70  left: parent.left
71  right: parent.right
72  margins: Kirigami.Units.smallSpacing
73  }
74  horizontalAlignment: Text.AlignHCenter
75  // TODO: This is where we'd want to put the download progress and cancel button as well
76  text: i18ndc("knewstuff5", "Label for the busy indicator showing an item is installing", "Installing...");
77  }
78 }
QTextStream & right(QTextStream &stream)
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QTextStream & left(QTextStream &stream)
QTextStream & left(QTextStream &s)
QTextStream & right(QTextStream &s)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.