376 changes: 304 additions & 72 deletions mythtv/libs/libmythui/mythnotification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,167 @@
// Copyright (c) 2013 Bubblestuff Pty Ltd. All rights reserved.
//

// libmyth headers
// Qt
#include <QCoreApplication>

// MythTV
#include "mythlogging.h"
#include "mythnotification.h"

#include <QCoreApplication>
MythNotification::MythNotification(Type nType, void* Parent)
: MythEvent(nType, "NOTIFICATION"),
m_parent(Parent)
{
}

MythNotification::MythNotification(int Id, void* Parent)
: MythEvent(Update, "NOTIFICATION"),
m_id(Id),
m_parent(Parent)
{
}

MythNotification::MythNotification(const QString& Title, const QString& Author,
const QString& Details)
: MythEvent(New, "NOTIFICATION"),
m_description(Title),
m_metadata({{"minm", Title}, {"asar", Author}, {"asal", Details}})
{
ToStringList();
}

MythNotification::MythNotification(Type nType, const QString& Title, const QString& Author,
const QString& Details, const QString& Extra)
: MythEvent(nType, "NOTIFICATION"),
m_description(Title),
m_metadata({{"minm", Title}, {"asar", Author}, {"asal", Details}, {"asfm", Extra}})
{
ToStringList();
}

QEvent::Type MythNotification::New =
(QEvent::Type) QEvent::registerEventType();
QEvent::Type MythNotification::Update =
(QEvent::Type) QEvent::registerEventType();
QEvent::Type MythNotification::Info =
(QEvent::Type) QEvent::registerEventType();
QEvent::Type MythNotification::Error =
(QEvent::Type) QEvent::registerEventType();
QEvent::Type MythNotification::Warning =
(QEvent::Type) QEvent::registerEventType();
QEvent::Type MythNotification::Check =
(QEvent::Type) QEvent::registerEventType();
QEvent::Type MythNotification::Busy =
(QEvent::Type) QEvent::registerEventType();

void MythNotification::SetId(int id)
{
m_id = id;
MythNotification::MythNotification(Type nType, DMAP Metadata)
: MythEvent(nType, "NOTIFICATION"),
m_metadata(std::move(Metadata))
{
ToStringList();
}

MythNotification::MythNotification(const MythEvent& Event)
: MythEvent(Event)
{
FromStringList();
}

MythNotification::MythNotification(const MythNotification& Notification)
: MythEvent(Notification),
m_id(Notification.m_id),
m_parent(Notification.m_parent),
m_fullScreen(Notification.m_fullScreen),
m_description(Notification.m_description),
m_duration(Notification.m_duration),
m_metadata(Notification.m_metadata),
m_style(Notification.m_style),
m_visibility(Notification.m_visibility),
m_priority(Notification.m_priority)
{
ToStringList();
}

MythEvent* MythNotification::clone() const
{
return new MythNotification(*this);
}

/*! \brief Contains the application registration id
*
* Required to update an existing notification screen owned by an application
*/
void MythNotification::SetId(int Id)
{
m_id = Id;
// default registered notification is to not expire
if (m_id > 0 && m_duration == 0)
{
m_duration = -1;
}
}

void MythNotification::ToStringList(void)
/*! \brief Contains the parent address. Required if id is set
* Id provided must match the parent address as provided during the
* MythNotificationCenter registration, otherwise the id value will be
* ignored
*/
void MythNotification::SetParent(void* Parent)
{
m_extradata.clear();
m_parent = Parent;
}

/*! \brief A notification may request to be displayed in full screen,
* this request may not be fullfilled should the theme not handle full screen
* notification
*/
void MythNotification::SetFullScreen(bool FullScreen)
{
m_fullScreen = FullScreen;
ToStringList();
}

/*! \brief Contains a short description of the notification
*/
void MythNotification::SetDescription(const QString& Description)
{
m_description = Description;
ToStringList();
}

/*! \brief metadata of the notification.
* In DMAP format. DMAP can contains various information such as artist,
* album name, author name, genre etc..
*/
void MythNotification::SetMetaData(const DMAP& MetaData)
{
m_metadata = MetaData;
ToStringList();
}

/*! \brief Contains a duration during which the notification will be displayed for.
* The duration is informative only as the MythNotificationCenter will
* determine automatically how long a notification can be displayed for
* and will depend on priority, visibility and other factors
*/
void MythNotification::SetDuration(int Duration)
{
m_duration = Duration;
ToStringList();
}

/*! \brief Contains an alternative notification style.
* Should a style be defined, the Notification Center will attempt to load
* an alternative theme and fall back to the default one if unsuccessful
*/
void MythNotification::SetStyle(const QString& Style)
{
m_style = Style;
ToStringList();
}

/*! \brief Define a bitmask of Visibility
*/
void MythNotification::SetVisibility(VNMask Visibility)
{
m_visibility = Visibility;
ToStringList();
}

/*! \brief Reserved for future use, not implemented at this stage
*/
void MythNotification::SetPriority(Priority nPriority)
{
m_priority = nPriority;
ToStringList();
}

void MythNotification::ToStringList()
{
m_extradata.clear();
m_extradata << QString::number(Type())
<< QString::number(static_cast<int>(m_fullScreen))
<< m_description
Expand All @@ -54,20 +180,18 @@ void MythNotification::ToStringList(void)
<< m_metadata.value("asfm");
}

bool MythNotification::FromStringList(void)
bool MythNotification::FromStringList()
{
if (m_extradata.size() != 11)
{
LOG(VB_GENERAL, LOG_ERR,
QString("MythNotification::FromStringList called with %1 items, "
"expecting 11. '%2'")
QString("MythNotification::FromStringList called with %1 items, expecting 11. '%2'")
.arg(m_extradata.size()).arg(m_extradata.join(",")));
return false;
}

QStringList::const_iterator Istr = m_extradata.cbegin();

Type type = static_cast<Type>((*Istr++).toInt());
QStringList::const_iterator it = m_extradata.cbegin();
Type type = static_cast<Type>((*it++).toInt());
if (type != Type())
{
LOG(VB_GENERAL, LOG_ERR,
Expand All @@ -76,69 +200,177 @@ bool MythNotification::FromStringList(void)
.arg(type).arg(Type()));
return false;
}
m_fullScreen = ((*Istr++).toInt() != 0);
m_description = *Istr++;
m_duration = (*Istr++).toInt();
m_style = *Istr++;
m_visibility = static_cast<VNMask>((*Istr++).toInt());
m_priority = static_cast<Priority>((*Istr++).toInt());
m_metadata["minm"] = *Istr++;
m_metadata["asar"] = *Istr++;
m_metadata["asal"] = *Istr++;
m_metadata["asfm"] = *Istr++;

m_fullScreen = ((*it++).toInt() != 0);
m_description = *it++;
m_duration = (*it++).toInt();
m_style = *it++;
m_visibility = static_cast<VNMask>((*it++).toInt());
m_priority = static_cast<Priority>((*it++).toInt());
m_metadata["minm"] = *it++;
m_metadata["asar"] = *it++;
m_metadata["asal"] = *it++;
m_metadata["asfm"] = *it++;
return true;
}


/**
* stringFromSeconds:
/*! \brief Create a string in the format HH:mm:ss from a duration in seconds.
*
* Usage: stringFromSeconds(seconds).
* Description: create a string in the format HH:mm:ss from a duration in seconds.
* HH: will not be displayed if there's less than one hour.
*/
QString MythPlaybackNotification::stringFromSeconds(int time)
QString MythPlaybackNotification::StringFromSeconds(int Time)
{
int hour = time / 3600;
int minute = (time - hour * 3600) / 60;
int seconds = time - hour * 3600 - minute * 60;
int hour = Time / 3600;
int minute = (Time - hour * 3600) / 60;
int seconds = Time - hour * 3600 - minute * 60;
QString str;

if (hour)
{
str += QString("%1:").arg(hour);
}
if (minute < 10)
{
str += "0";
}
str += QString("%1:").arg(minute);
if (seconds < 10)
{
str += "0";
}
str += QString::number(seconds);
return str;
}

MythNotification::Type MythNotification::TypeFromString(const QString &type)
MythNotification::Type MythNotification::TypeFromString(const QString& Type)
{
if (type == "error")
{
return MythNotification::Error;
}
if (type == "warning")
{
return MythNotification::Warning;
}
if (type == "check")
{
return MythNotification::Check;
}
if (type == "busy")
{
return MythNotification::Busy;
}
if (Type == "error") return MythNotification::Error;
if (Type == "warning") return MythNotification::Warning;
if (Type == "check") return MythNotification::Check;
if (Type == "busy") return MythNotification::Busy;
return MythNotification::New;
}

MythImageNotification::MythImageNotification(Type nType, QImage Image)
: MythNotification(nType),
m_image(std::move(Image))
{
}

MythImageNotification::MythImageNotification(Type nType, QString ImagePath)
: MythNotification(nType),
m_imagePath(std::move(ImagePath))
{
}

MythImageNotification::MythImageNotification(Type nType, QImage Image, const DMAP& Metadata)
: MythNotification(nType, Metadata),
m_image(std::move(Image))
{
}

MythImageNotification::MythImageNotification(Type nType, QString ImagePath, const DMAP& Metadata)
: MythNotification(nType, Metadata),
m_imagePath(std::move(ImagePath))
{
}

MythEvent* MythImageNotification::clone() const
{
return new MythImageNotification(*this);
}

MythPlaybackNotification::MythPlaybackNotification(Type nType, float Progress,
QString ProgressText)
: MythNotification(nType),
m_progress(Progress),
m_progressText(std::move(ProgressText))
{
}

MythPlaybackNotification::MythPlaybackNotification(Type nType, float Progress,
QString ProgressText,
const DMAP& Metadata)
: MythNotification(nType, Metadata),
m_progress(Progress),
m_progressText(std::move(ProgressText))
{
}

MythPlaybackNotification::MythPlaybackNotification(Type nType, int Duration,
int Position)
: MythNotification(nType),
m_progress(static_cast<float>(Position) / static_cast<float>(Duration)),
m_progressText(StringFromSeconds(Duration))
{
}

MythEvent* MythPlaybackNotification::clone() const
{
return new MythPlaybackNotification(*this);
}

MythMediaNotification::MythMediaNotification(Type nType, const QImage& Image, const DMAP& Metadata,
float Progress, const QString& DurationText)
: MythNotification(nType, Metadata),
MythImageNotification(nType, Image),
MythPlaybackNotification(nType, Progress, DurationText)
{
}

MythMediaNotification::MythMediaNotification(Type nType, const QImage& Image, const DMAP& Metadata,
int Duration, int Position)
: MythNotification(nType, Metadata),
MythImageNotification(nType, Image),
MythPlaybackNotification(nType, Duration, Position)
{
}

MythMediaNotification::MythMediaNotification(Type nType, const QString& Image, const DMAP& Metadata,
float Progress, const QString& DurationText)
: MythNotification(nType, Metadata),
MythImageNotification(nType, Image),
MythPlaybackNotification(nType, Progress, DurationText)
{
}

MythMediaNotification::MythMediaNotification(Type nType, const QString& Image, const DMAP& Metadata,
int Duration, int Dosition)
: MythNotification(nType, Metadata),
MythImageNotification(nType, Image),
MythPlaybackNotification(nType, Duration, Dosition)
{
}

MythMediaNotification::MythMediaNotification(const MythMediaNotification& Notification)
: MythNotification(Notification),
MythImageNotification(Notification),
MythPlaybackNotification(Notification)
{
}

MythEvent* MythMediaNotification::clone() const
{
return new MythMediaNotification(*this);
}

MythErrorNotification::MythErrorNotification(const QString& Title, const QString& Author,
const QString& Details)
: MythNotification(Error, Title, Author, Details)
{
SetDuration(10);
}

MythWarningNotification::MythWarningNotification(const QString& Title, const QString& Author,
const QString& Details)
: MythNotification(Warning, Title, Author, Details)
{
SetDuration(10);
}

MythCheckNotification::MythCheckNotification(const QString& Title, const QString& Author,
const QString& Details)
: MythNotification(Check, Title, Author, Details)
{
SetDuration(5);
}

MythBusyNotification::MythBusyNotification(const QString& Title, const QString& Author,
const QString& Details)
: MythNotification(Busy, Title, Author, Details)
{
}
413 changes: 103 additions & 310 deletions mythtv/libs/libmythui/mythnotification.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,104 +9,65 @@
#ifndef MYTHTV_MYTHNOTIFICATION_H
#define MYTHTV_MYTHNOTIFICATION_H

#include <utility>

// Qt headers
// Qt
#include <QImage>
#include <QMap>
#include <QMutex>

// MythTV headers
// MythTV
#include "mythevent.h"
#include "mythuiexp.h"

// Std
#include <utility>

using DMAP = QMap<QString,QString>;
using VNMask = unsigned int;

class MUI_PUBLIC MythNotification : public MythEvent
{
public:

static Type New;
static Type Update;
static Type Info;
static Type Error;
static Type Warning;
static Type Check;
static Type Busy;

explicit MythNotification(Type type, void *parent = nullptr)
: MythEvent(type, "NOTIFICATION"),
m_parent(parent)
{
}

MythNotification(int id, void *parent)
: MythEvent(Update, "NOTIFICATION"),
m_id(id),
m_parent(parent)
{
}

MythNotification(const QString &title, const QString &author,
const QString &details = QString())
: MythEvent(New, "NOTIFICATION"),
m_description(title),
m_metadata({{"minm", title}, {"asar", author}, {"asal", details}})
{
ToStringList();
}

MythNotification(Type type, const QString &title, const QString &author,
const QString &details = QString(),
const QString &extra = QString())
: MythEvent(type, "NOTIFICATION"),
m_description(title),
m_metadata({{"minm", title}, {"asar", author}, {"asal", details}, {"asfm", extra}})
{
ToStringList();
}

MythNotification(Type type, DMAP metadata)
: MythEvent(type, "NOTIFICATION"), m_metadata(std::move(metadata))
{
ToStringList();
}

explicit MythNotification(const MythEvent &me)
: MythEvent(me)
{
FromStringList();
}

~MythNotification() override = default;

MythEvent *clone(void) const override // MythEvent
{
return new MythNotification(*this);
}

/** Priority enum
static inline Type New = static_cast<QEvent::Type>(QEvent::registerEventType());
static inline Type Update = static_cast<QEvent::Type>(QEvent::registerEventType());
static inline Type Info = static_cast<QEvent::Type>(QEvent::registerEventType());
static inline Type Error = static_cast<QEvent::Type>(QEvent::registerEventType());
static inline Type Warning = static_cast<QEvent::Type>(QEvent::registerEventType());
static inline Type Check = static_cast<QEvent::Type>(QEvent::registerEventType());
static inline Type Busy = static_cast<QEvent::Type>(QEvent::registerEventType());

MythNotification(Type nType, void* Parent = nullptr);
MythNotification(int Id, void* Parent);
MythNotification(const QString& Title, const QString& Author,
const QString& Details = QString());
MythNotification(Type nType, const QString& Title, const QString& Author,
const QString& Details = QString(), const QString& Extra = QString());
MythNotification(Type nType, DMAP Metadata);
explicit MythNotification(const MythEvent& Event);
~MythNotification() override = default;
MythEvent* clone() const override;

/*! \enum Priority
* A notification can be given a priority. Display order of notification
* will be sorted according to the priority level
*/
enum Priority
{
kDefault = 0,
kDefault = 0,
kLow,
kMedium,
kHigh,
kHigher,
kHighest,
};

/** Visibility enum
/*! \enum Visibility
* A notification can be given visibility mask allowing to not be visible
* under some circumstances, like the screen currently being displayed.
* This is used to prevent redundant information appearing more than once:
* like in MythMusic, there's no need to show music notifications
*/
enum Visibility {
enum Visibility
{
kNone = 0,
kAll = ~0,
kPlayback = (1 << 0),
Expand All @@ -117,310 +78,142 @@ class MUI_PUBLIC MythNotification : public MythEvent
kRecordings = (1 << 5),
};

// Setter
/**
* Optional MythNotification elements
*/
/**
* contains the application registration id
* Required to update an existing notification screen owned by an application
*/
void SetId(int id);
/**
* contains the parent address. Required if id is set
* Id provided must match the parent address as provided during the
* MythNotificationCenter registration, otherwise the id value will be
* ignored
*/
void SetParent(void *parent) { m_parent = parent; }
/**
* a notification may request to be displayed in full screen,
* this request may not be fullfilled should the theme not handle full screen
* notification
*/
void SetFullScreen(bool f) { m_fullScreen = f; ToStringList(); }
/**
* contains a short description of the notification
*/
void SetDescription(const QString &desc)
{ m_description = desc; ToStringList(); }
/**
* metadata of the notification.
* In DMAP format. DMAP can contains various information such as artist,
* album name, author name, genre etc..
*/
void SetMetaData(const DMAP &data) { m_metadata = data; ToStringList(); }
/**
* contains a duration during which the notification will be displayed for.
* The duration is informative only as the MythNotificationCenter will
* determine automatically how long a notification can be displayed for
* and will depend on priority, visibility and other factors
*/
void SetDuration(int duration) { m_duration = duration; ToStringList(); }
/**
* contains an alternative notification style.
* Should a style be defined, the Notification Center will attempt to load
* an alternative theme and fall back to the default one if unsuccessful
*/
void SetStyle(const QString &style) { m_style = style; ToStringList(); }
/**
* define a bitmask of Visibility
*/
void SetVisibility(VNMask n) { m_visibility = n; ToStringList(); }
/**
* For future use, not implemented at this stage
*/
void SetPriority(Priority n) { m_priority = n; ToStringList(); }

/**
* return Type object from type name
*/
static Type TypeFromString(const QString &type);

void ToStringList(void);
bool FromStringList(void);
void SetId(int Id);
void SetParent(void* Parent);
void SetFullScreen(bool FullScreen);
void SetDescription(const QString& Description);
void SetMetaData(const DMAP& MetaData);
void SetDuration(int Duration);
void SetStyle(const QString& Style);
void SetVisibility(VNMask Visibility);
void SetPriority(Priority nPriority);
static Type TypeFromString(const QString& Type);
void ToStringList();
bool FromStringList();

// Getter
int GetId(void) const { return m_id; }
void *GetParent(void) const { return m_parent; }
bool GetFullScreen(void) const { return m_fullScreen; }
QString GetDescription(void) const { return m_description; }
DMAP GetMetaData(void) const { return m_metadata; }
int GetDuration(void) const { return m_duration; }
QString GetStyle(void) const { return m_style; }
VNMask GetVisibility(void) const { return m_visibility; }
Priority GetPriority(void) const { return m_priority; }
int GetId() const { return m_id; }
void* GetParent() const { return m_parent; }
bool GetFullScreen() const { return m_fullScreen; }
QString GetDescription() const { return m_description; }
DMAP GetMetaData() const { return m_metadata; }
int GetDuration() const { return m_duration; }
QString GetStyle() const { return m_style; }
VNMask GetVisibility() const { return m_visibility; }
Priority GetPriority() const { return m_priority; }

protected:
MythNotification(const MythNotification &o)
: MythEvent(o),
m_id(o.m_id),
m_parent(o.m_parent),
m_fullScreen(o.m_fullScreen),
m_description(o.m_description),
m_duration(o.m_duration),
m_metadata(o.m_metadata),
m_style(o.m_style),
m_visibility(o.m_visibility),
m_priority(o.m_priority)
{
ToStringList();
}
MythNotification(const MythNotification& Notification);

#ifndef _MSC_VER
MythNotification &operator=(const MythNotification&);
#endif

protected:
int m_id {-1};
void *m_parent {nullptr};
bool m_fullScreen {false};
QString m_description;
int m_duration {0};
DMAP m_metadata;
QString m_style;
VNMask m_visibility {(VNMask)kAll};
Priority m_priority {kDefault};
int m_id { -1 };
void* m_parent { nullptr };
bool m_fullScreen { false };
QString m_description;
int m_duration { 0 };
DMAP m_metadata;
QString m_style;
VNMask m_visibility { static_cast<VNMask>(kAll) };
Priority m_priority { kDefault };
};

class MUI_PUBLIC MythImageNotification : public virtual MythNotification
{
public:
MythImageNotification(Type type, QImage image)
: MythNotification(type),
m_image(std::move(image))
{
}

MythImageNotification(Type type, QString imagePath)
: MythNotification(type),
m_imagePath(std::move(imagePath))
{
}

MythImageNotification(Type type, QImage image, const DMAP &metadata)
: MythNotification(type, metadata),
m_image(std::move(image))
{
}
MythImageNotification(Type nType, QImage Image);
MythImageNotification(Type nType, QString ImagePath);
MythImageNotification(Type nType, QImage Image, const DMAP& Metadata);
MythImageNotification(Type nType, QString ImagePath, const DMAP& Metadata);
MythEvent *clone() const override;

MythImageNotification(Type type, QString imagePath, const DMAP &metadata)
: MythNotification(type, metadata),
m_imagePath(std::move(imagePath))
{
}

MythEvent *clone(void) const override // MythNotification
{
return new MythImageNotification(*this);
}

// Setter
/**
* image to be displayed with the notification
*/
void SetImage(const QImage &image) { m_image = image; }
/**
* image filename to be displayed with the notification
*/
void SetImagePath(const QString &image) { m_imagePath = image; }

//Getter
QImage GetImage(void) const { return m_image; }
QString GetImagePath(void) const { return m_imagePath; }
void SetImage(const QImage& Image) { m_image = Image; }
void SetImagePath(const QString& Image) { m_imagePath = Image; }
QImage GetImage() const { return m_image; }
QString GetImagePath() const { return m_imagePath; }

protected:
MythImageNotification(const MythImageNotification&) = default;

protected:
QImage m_image;
QString m_imagePath;
QImage m_image;
QString m_imagePath;
};

class MUI_PUBLIC MythPlaybackNotification : public virtual MythNotification
{
public:
MythPlaybackNotification(Type type, float progress, QString progressText)
: MythNotification(type),
m_progress(progress),
m_progressText(std::move(progressText))
{
}

MythPlaybackNotification(Type type, float progress, QString progressText,
const DMAP &metadata)
: MythNotification(type, metadata),
m_progress(progress),
m_progressText(std::move(progressText))
{
}

MythPlaybackNotification(Type type, int duration, int position)
: MythNotification(type),
m_progress(static_cast<float>(position) / static_cast<float>(duration)),
m_progressText(stringFromSeconds(duration))
{
}

MythEvent *clone(void) const override // MythNotification
{ return new MythPlaybackNotification(*this); }
MythPlaybackNotification(Type nType, float Progress, QString ProgressText);
MythPlaybackNotification(Type nType, float Progress, QString ProgressText,
const DMAP& Metadata);
MythPlaybackNotification(Type nType, int Duration, int Position);
MythEvent* clone() const override;

// Setter
/**
* current playback position to be displayed with the notification.
/*! \brief Set the current playback position to be displayed with the notification.
* Value to be between 0 <= x <= 1.
* Note: x < 0 means no progress bar to be displayed.
*/
void SetProgress(float progress) { m_progress = progress; }
/**
* text to be displayed with the notification as duration or progress.
*/
void SetProgressText(const QString &text) { m_progressText = text; }

//Getter
float GetProgress(void) const { return m_progress; }
QString GetProgressText(void) const { return m_progressText; }

// utility methods
static QString stringFromSeconds(int time);
*/
void SetProgress(float progress) { m_progress = progress; }
void SetProgressText(const QString& text) { m_progressText = text; }
float GetProgress() const { return m_progress; }
QString GetProgressText() const { return m_progressText; }
static QString StringFromSeconds(int Time);

protected:
MythPlaybackNotification(const MythPlaybackNotification&) = default;

protected:
float m_progress;
QString m_progressText;
float m_progress { -1.0F };
QString m_progressText;
};

class MUI_PUBLIC MythMediaNotification : public MythImageNotification,
public MythPlaybackNotification
{
public:
MythMediaNotification(Type type, const QImage &image, const DMAP &metadata,
float progress, const QString &durationText)
: MythNotification(type, metadata),
MythImageNotification(type, image),
MythPlaybackNotification(type, progress, durationText)
{
}

MythMediaNotification(Type type, const QImage &image, const DMAP &metadata,
int duration, int position)
: MythNotification(type, metadata),
MythImageNotification(type, image),
MythPlaybackNotification(type, duration, position)
{
}

MythMediaNotification(Type type, const QString &imagePath, const DMAP &metadata,
float progress, const QString &durationText)
: MythNotification(type, metadata),
MythImageNotification(type, imagePath),
MythPlaybackNotification(type, progress, durationText)
{
}

MythMediaNotification(Type type, const QString &imagePath, const DMAP &metadata,
int duration, int position)
: MythNotification(type, metadata),
MythImageNotification(type, imagePath),
MythPlaybackNotification(type, duration, position)
{
}

MythEvent *clone(void) const override // MythImageNotification
{
return new MythMediaNotification(*this);
}
MythMediaNotification(Type nType, const QImage& Image, const DMAP& Metadata,
float Progress, const QString& DurationText);
MythMediaNotification(Type nType, const QImage& Image, const DMAP& Metadata,
int Duration, int Position);
MythMediaNotification(Type nType, const QString& Image, const DMAP& Metadata,
float Progress, const QString& DurationText);
MythMediaNotification(Type nType, const QString& Image, const DMAP& Metadata,
int Duration, int Dosition);
MythEvent* clone() const override;

protected:
MythMediaNotification(const MythMediaNotification &o)
: MythNotification(o),
MythImageNotification(o),
MythPlaybackNotification(o)
{
}
MythMediaNotification(const MythMediaNotification& Notification);
};

class MUI_PUBLIC MythErrorNotification : public MythNotification
{
public:
MythErrorNotification(const QString &title, const QString &author,
const QString &details = QString())
: MythNotification(Error, title, author, details)
{
SetDuration(10);
}
MythErrorNotification(const QString& Title, const QString& Author,
const QString& Details = QString());
};

class MUI_PUBLIC MythWarningNotification : public MythNotification
{
public:
MythWarningNotification(const QString &title, const QString &author,
const QString &details = QString())
: MythNotification(Warning, title, author, details)
{
SetDuration(10);
}
MythWarningNotification(const QString& Title, const QString& Author,
const QString& Details = QString());
};

class MUI_PUBLIC MythCheckNotification : public MythNotification
{
public:
MythCheckNotification(const QString &title, const QString &author,
const QString &details = QString())
: MythNotification(Check, title, author, details)
{
SetDuration(5);
}
MythCheckNotification(const QString& Title, const QString& Author,
const QString& Details = QString());
};

class MUI_PUBLIC MythBusyNotification : public MythNotification
{
public:
MythBusyNotification(const QString &title, const QString &author,
const QString &details = QString())
: MythNotification(Busy, title, author, details) { }
MythBusyNotification(const QString& Title, const QString& Author,
const QString& Details = QString());
};

#endif