Skip to content

Commit

Permalink
Add support for "error" type notification and add visibility field
Browse files Browse the repository at this point in the history
Uses new extended ShowNotification method
  • Loading branch information
jyavenard committed Jul 18, 2013
1 parent e4f6e69 commit fc6ec79
Showing 1 changed file with 10 additions and 33 deletions.
43 changes: 10 additions & 33 deletions mythtv/libs/libmythui/mythudplistener.cpp
Expand Up @@ -112,6 +112,8 @@ void MythUDPListener::Process(const QByteArray &buf, QHostAddress sender,
QString progress_text = "";
float progress = -1.0f;
bool fullscreen = false;
bool error = false;
int visibility = 0;

QDomNode n = docElem.firstChild();
while (!n.isNull())
Expand All @@ -135,6 +137,10 @@ void MythUDPListener::Process(const QByteArray &buf, QHostAddress sender,
progress_text = e.text();
else if (notification && e.tagName() == "fullscreen")
fullscreen = e.text().toLower() == "true";
else if (notification && e.tagName() == "error")
error = e.text().toLower() == "true";
else if (e.tagName() == "visibility")
visibility = e.text().toUInt();
else if (notification && e.tagName() == "progress")
{
bool ok;
Expand All @@ -160,39 +166,10 @@ void MythUDPListener::Process(const QByteArray &buf, QHostAddress sender,
timeout = notification ? 5 : 0;
if (notification)
{
DMAP data;
data["minm"] = msg;
data["asar"] = origin.isNull() ? tr("UDP Listener") : origin;
data["asal"] = description;
data["asfm"] = extra;

MythNotification *n;
if (!image.isEmpty())
{
if (progress >= 0)
{
n = new MythMediaNotification(MythNotification::New,
image, data,
progress, progress_text);
}
else
{
n = new MythImageNotification(MythNotification::New, image, data);
}
}
else if (progress >= 0)
{
n = new MythPlaybackNotification(MythNotification::New,
progress, progress_text, data);
}
else
{
n = new MythNotification(MythNotification::New, data);
}
n->SetDuration(timeout);
n->SetFullScreen(fullscreen);
MythUINotificationCenter::GetInstance()->Queue(*n);
delete n;
origin = origin.isNull() ? tr("UDP Listener") : origin;
ShowNotification(error, msg, origin, description, image, extra,
progress_text, progress, timeout, fullscreen,
visibility);
}
else
{
Expand Down

0 comments on commit fc6ec79

Please sign in to comment.