From da955d84beda72e26ce641375bd6fc4159a4c9fc Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 25 Oct 2017 14:00:43 +0200 Subject: Prepare logview for error merging. --- framework/qml/Notifications.qml | 28 ++++++++++++++++++++++++++++ framework/qmldir | 1 + framework/src/sinkfabric.cpp | 7 ++++--- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 framework/qml/Notifications.qml (limited to 'framework') diff --git a/framework/qml/Notifications.qml b/framework/qml/Notifications.qml new file mode 100644 index 00000000..df1190d3 --- /dev/null +++ b/framework/qml/Notifications.qml @@ -0,0 +1,28 @@ +/* + Copyright (C) 2017 Michael Bohlender, + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +pragma Singleton + +import QtQuick 2.7 + +Item { + property string error: "error" + property string info: "info" + property string progress: "progress" +} + diff --git a/framework/qmldir b/framework/qmldir index 90d1c762..12eeb43d 100644 --- a/framework/qmldir +++ b/framework/qmldir @@ -47,6 +47,7 @@ GridView 1.0 GridView.qml ScrollHelper 1.0 ScrollHelper.qml ModelIndexRetriever 1.0 ModelIndexRetriever.qml singleton Messages 1.0 Messages.qml +singleton Notifications 1.0 Notifications.qml singleton Colors 1.0 Colors.qml singleton Icons 1.0 Icons.qml singleton Units 1.0 Units.qml diff --git a/framework/src/sinkfabric.cpp b/framework/src/sinkfabric.cpp index 9768fa96..cdaa9a90 100644 --- a/framework/src/sinkfabric.cpp +++ b/framework/src/sinkfabric.cpp @@ -151,7 +151,7 @@ public: SinkLog() << "Received notification: " << notification; QVariantMap message; if (notification.type == Sink::Notification::Warning) { - message["type"] = Notification::Warning; + message["type"] = "warning"; if (notification.code == Sink::ApplicationDomain::TransmissionError) { message["message"] = QObject::tr("Failed to send message."); } else { @@ -160,7 +160,7 @@ public: } else if (notification.type == Sink::Notification::Status) { return; } else if (notification.type == Sink::Notification::Error) { - message["type"] = Notification::Warning; + message["type"] = "error"; message["resource"] = QString{notification.resource}; message["details"] = notification.message; switch(notification.code) { @@ -188,12 +188,13 @@ public: Fabric::Fabric{}.postMessage("errorNotification", message); } else if (notification.type == Sink::Notification::Info) { if (notification.code == Sink::ApplicationDomain::TransmissionSuccess) { - message["type"] = Notification::Info; + message["type"] = "info"; message["message"] = QObject::tr("A message has been sent."); } else { return; } } else if (notification.type == Sink::Notification::Progress) { + message["type"] = "progress"; message["progress"] = notification.progress; message["total"] = notification.total; if (!notification.entities.isEmpty()) { -- cgit v1.2.3