Skip to content

Commit

Permalink
Add methods to query state of modifications and remove notification f…
Browse files Browse the repository at this point in the history
…rom screen

Will be used with OSD and fixing #11657
  • Loading branch information
jyavenard committed Jul 10, 2013
1 parent 578abe3 commit 00bd90d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
38 changes: 38 additions & 0 deletions mythtv/libs/libmythui/mythuinotificationcenter.cpp
Expand Up @@ -993,6 +993,29 @@ void NCPrivate::GetNotificationScreens(QList<MythScreenType*> &_screens)
_screens = list;
}

int NCPrivate::DisplayedNotifications(void) const
{
return m_screens.size();
}

int NCPrivate::QueuedNotifications(void) const
{
return m_notifications.size();
}

bool NCPrivate::RemoveFirst(void)
{
QMutexLocker lock(&m_lock);

if (m_screens.isEmpty())
return false;

MythUINotificationScreen *screen = m_screens.first();
// simulate time-out
screen->ProcessTimer();
return true;
}

/////////////////////// MythUINotificationCenter

MythUINotificationCenter *MythUINotificationCenter::GetInstance(void)
Expand Down Expand Up @@ -1094,6 +1117,21 @@ void MythUINotificationCenter::UpdateScreen(MythScreenType *screen)
}
}

int MythUINotificationCenter::DisplayedNotifications(void) const
{
return d->DisplayedNotifications();
}

int MythUINotificationCenter::QueuedNotifications(void) const
{
return d->QueuedNotifications();
}

bool MythUINotificationCenter::RemoveFirst(void)
{
return d->RemoveFirst();
}

void ShowNotificationError(const QString &msg,
const QString &from,
const QString &detail,
Expand Down
13 changes: 13 additions & 0 deletions mythtv/libs/libmythui/mythuinotificationcenter.h
Expand Up @@ -91,6 +91,19 @@ class MUI_PUBLIC MythUINotificationCenter
* ::Create() has been called for it already
*/
void UpdateScreen(MythScreenType *screen);
/**
* Returns number of notifications currently displayed
*/
int DisplayedNotifications(void) const;
/**
* Returns number of notifications currently queued
*/
int QueuedNotifications(void) const;
/**
* Will remove the oldest notification from the stack
* return true if a screen was removed; or false if nothing was done
*/
bool RemoveFirst(void);
/**
* ProcessQueue will be called by the GUI event handler and will process
* all queued MythNotifications and delete screens marked to be deleted
Expand Down
13 changes: 13 additions & 0 deletions mythtv/libs/libmythui/mythuinotificationcenter_private.h
Expand Up @@ -93,6 +93,19 @@ public slots:
* ::Create() has been called for it already
*/
void UpdateScreen(MythScreenType *screen);
/**
* Returns number of notifications currently displayed
*/
int DisplayedNotifications(void) const;
/**
* Returns number of notifications currently queued
*/
int QueuedNotifications(void) const;
/**
* Will remove the oldest notification from the stack
* return true if a screen was removed; or false if nothing was done
*/
bool RemoveFirst(void);
/**
* ProcessQueue will be called by the GUI event handler and will process
* all queued MythNotifications and delete screens marked to be deleted
Expand Down

0 comments on commit 00bd90d

Please sign in to comment.