Skip to content

Commit

Permalink
Add MythBusyNotification type
Browse files Browse the repository at this point in the history
  • Loading branch information
jyavenard committed Aug 14, 2013
1 parent c9e8dcc commit e04aba4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
6 changes: 6 additions & 0 deletions mythtv/libs/libmythui/mythnotification.cpp
Expand Up @@ -22,6 +22,8 @@ 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)
{
Expand Down Expand Up @@ -78,6 +80,10 @@ MythNotification::Type MythNotification::TypeFromString(const QString &type)
{
return MythNotification::Check;
}
else if (type == "busy")
{
return MythNotification::Busy;
}
else
{
return MythNotification::New;
Expand Down
9 changes: 9 additions & 0 deletions mythtv/libs/libmythui/mythnotification.h
Expand Up @@ -29,6 +29,7 @@ class MUI_PUBLIC MythNotification : public MythEvent
static Type Error;
static Type Warning;
static Type Check;
static Type Busy;

MythNotification(Type t, void *parent = NULL)
: MythEvent(t), m_id(-1), m_parent(parent), m_fullScreen(false),
Expand Down Expand Up @@ -382,4 +383,12 @@ class MUI_PUBLIC MythCheckNotification : public MythNotification
}
};

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

#endif /* defined(__MythTV__mythnotification__) */
14 changes: 11 additions & 3 deletions mythtv/libs/libmythui/mythnotificationcenter.cpp
Expand Up @@ -232,7 +232,8 @@ void MythNotificationScreen::SetNotification(MythNotification &notification)

if (m_type == MythNotification::Error ||
m_type == MythNotification::Warning ||
m_type == MythNotification::Check)
m_type == MythNotification::Check ||
m_type == MythNotification::Busy)
{
m_update |= kImage;
update = false;
Expand Down Expand Up @@ -533,6 +534,10 @@ void MythNotificationScreen::SetErrorState(void)
{
state = "check";
}
else if (m_type == MythNotification::Busy)
{
state = "busy";
}
else
{
state = "ok";
Expand Down Expand Up @@ -1503,10 +1508,13 @@ void ShowNotification(MythNotification::Type type,

if (type == MythNotification::Error ||
type == MythNotification::Warning ||
type == MythNotification::Check)
type == MythNotification::Check ||
type == MythNotification::Busy)
{
n = new MythNotification(type, data);
if (!duration && type != MythNotification::Check)
if (!duration &&
type != MythNotification::Check &&
type != MythNotification::Busy)
{
// default duration for those type of notifications is 10s
duration = 10;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythutil/commandlineparser.cpp
Expand Up @@ -180,7 +180,7 @@ void MythUtilCommandLineParser::LoadArguments(void)
->SetChildOf("notification");
add("--visibility", "visibility", 0, "(optional) bitmask indicating where to show the notification", "")
->SetChildOf("notification");
add("--type", "type", "type", "(optional) type of notification (normal, error, warning, check", "")
add("--type", "type", "type", "(optional) type of notification (normal, error, warning, check, busy", "")
->SetChildOf("notification");

// Generic Options used by more than one utility
Expand Down

0 comments on commit e04aba4

Please sign in to comment.