From e66cf868e84f21423975575a6ab6778e0c2fd753 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 29 Apr 2022 12:50:26 -0400 Subject: [PATCH] 2022-04-29 Fred Gleason * Added an 'RDNotification::dump()' method. Signed-off-by: Fred Gleason --- ChangeLog | 2 ++ lib/rdnotification.cpp | 28 ++++++++++++++++++++++++++++ lib/rdnotification.h | 3 ++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5d6b7c5f..5579bbdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23000,3 +23000,5 @@ * Fixed a regression in rdcatch(1) where creating a new event using the 'Save As' button would fail to send notifications of the added event. +2022-04-29 Fred Gleason + * Added an 'RDNotification::dump()' method. diff --git a/lib/rdnotification.cpp b/lib/rdnotification.cpp index 412fc465..37ee1bea 100644 --- a/lib/rdnotification.cpp +++ b/lib/rdnotification.cpp @@ -190,6 +190,34 @@ QString RDNotification::write() const } +QString RDNotification::dump() const +{ + QString ret; + + switch((QMetaType::Type)id().type()) { + case QMetaType::Int: + ret+=QString::asprintf("id: %d",id().toInt()); + break; + + case QMetaType::UInt: + ret+=QString::asprintf("id: %u",id().toUInt()); + break; + + case QMetaType::QString: + ret+="id: "+id().toString(); + break; + + default: + ret+="Unknown QMetaType type value: %u\n",id().type(); + break; + } + ret+="type: "+RDNotification::typeString(type()); + ret+="action: "+RDNotification::actionString(action()); + + return ret; +} + + QString RDNotification::typeString(RDNotification::Type type) { QString ret="UNKNOWN"; diff --git a/lib/rdnotification.h b/lib/rdnotification.h index 0ffe6d47..c1a7750b 100644 --- a/lib/rdnotification.h +++ b/lib/rdnotification.h @@ -2,7 +2,7 @@ // // A container class for a Rivendell Notification message. // -// (C) Copyright 2018-2020 Fred Gleason +// (C) Copyright 2018-2022 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -42,6 +42,7 @@ class RDNotification bool isValid() const; bool read(const QString &str); QString write() const; + QString dump() const; static QString typeString(Type type); static QString actionString(Action action);