File indexing completed on 2024-05-12 05:26:01

0001 /*
0002  * Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
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 #include "notification.h"
0021 
0022 using namespace Sink;
0023 
0024 static QByteArray name(int type)
0025 {
0026     switch (type) {
0027         case Notification::Shutdown:
0028             return "shutdown";
0029         case Notification::Status:
0030             return "status";
0031         case Notification::Info:
0032             return "info";
0033         case Notification::Warning:
0034             return "warning";
0035         case Notification::Error:
0036             return "error";
0037         case Notification::Progress:
0038             return "progress";
0039         case Notification::Inspection:
0040             return "inspection";
0041         case Notification::RevisionUpdate:
0042             return "revisionupdate";
0043         case Notification::FlushCompletion:
0044             return "flushcompletion";
0045     }
0046     return "Unknown:" + QByteArray::number(type);
0047 }
0048 
0049 QDebug operator<<(QDebug dbg, const Sink::Notification &n)
0050 {
0051     dbg << "Notification(Type:" << name(n.type) << ", Id:" << n.id  << ", Code:";
0052     dbg << n.code;
0053     dbg << ", Message:" << n.message << ", Entities(" << n.entitiesType << "):" << n.entities << ")";
0054     return dbg.space();
0055 }