Skip to content

Commit

Permalink
Make no-artwork condition themeable.
Browse files Browse the repository at this point in the history
  • Loading branch information
jyavenard committed Jul 15, 2013
1 parent 640da5a commit 4d0fbb7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
29 changes: 26 additions & 3 deletions mythtv/libs/libmythui/mythuinotificationcenter.cpp
Expand Up @@ -46,7 +46,8 @@ MythUINotificationScreen::MythUINotificationScreen(MythScreenStack *stack,
m_created(false), m_content(kNone), m_update(kAll),
m_artworkImage(NULL), m_titleText(NULL), m_originText(NULL),
m_descriptionText(NULL), m_extraText(NULL), m_progresstextText(NULL),
m_progressBar(NULL), m_errorState(NULL), m_index(0),
m_progressBar(NULL), m_errorState(NULL), m_mediaState(NULL),
m_index(0),
m_timer(new QTimer(this)),
m_visibility(MythNotification::kAll),
m_priority(MythNotification::kDefault)
Expand All @@ -65,7 +66,8 @@ MythUINotificationScreen::MythUINotificationScreen(MythScreenStack *stack,
m_update(kAll),
m_artworkImage(NULL), m_titleText(NULL), m_originText(NULL),
m_descriptionText(NULL), m_extraText(NULL), m_progresstextText(NULL),
m_progressBar(NULL), m_errorState(NULL), m_index(0),
m_progressBar(NULL), m_errorState(NULL), m_mediaState(NULL),
m_index(0),
m_timer(new QTimer(this)),
m_visibility(MythNotification::kAll),
m_priority(MythNotification::kDefault)
Expand All @@ -82,7 +84,7 @@ MythUINotificationScreen::MythUINotificationScreen(MythScreenStack *stack,
m_created(false), m_content(kNone), m_update(kAll),
m_artworkImage(NULL), m_titleText(NULL), m_originText(NULL),
m_descriptionText(NULL), m_extraText(NULL), m_progresstextText(NULL),
m_progressBar(NULL), m_errorState(NULL),
m_progressBar(NULL), m_errorState(NULL), m_mediaState(NULL),
m_timer(new QTimer(this)),
m_visibility(MythNotification::kAll),
m_priority(MythNotification::kDefault)
Expand Down Expand Up @@ -140,6 +142,13 @@ void MythUINotificationScreen::SetNotification(MythNotification &notification)
m_update |= kDuration;
}

MythMediaNotification *media =
dynamic_cast<MythMediaNotification*>(&notification);
if (media && m_imagePath.isEmpty() && m_image.isNull())
{
m_update |= kNoArtwork;
}

if (!notification.GetMetaData().isEmpty())
{
UpdateMetaData(notification.GetMetaData());
Expand Down Expand Up @@ -215,6 +224,16 @@ bool MythUINotificationScreen::Create(void)
m_progresstextText = dynamic_cast<MythUIText*>(GetChild("progress_text"));
m_progressBar = dynamic_cast<MythUIProgressBar*>(GetChild("progress"));
m_errorState = dynamic_cast<MythUIStateType*>(GetChild("errorstate"));
m_mediaState = dynamic_cast<MythUIStateType*>(GetChild("mediastate"));

if (m_errorState)
{
m_errorState->DisplayState(m_content & kError ? "error" : "ok");
}
if (m_mediaState && (m_update & kImage))
{
m_mediaState->DisplayState(m_content & kNoArtwork ? "noartwork" : "ok");
}

// store original position
m_position = GetPosition();
Expand Down Expand Up @@ -334,6 +353,10 @@ void MythUINotificationScreen::Init(void)
{
m_errorState->DisplayState(m_update & kError ? "error" : "ok");
}
if (m_mediaState && (m_update & kImage))
{
m_mediaState->DisplayState(m_update & kNoArtwork ? "noartwork" : "ok");
}

// No field will be refreshed the next time unless specified otherwise
m_update = kNone;
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythui/mythuinotificationcenter_private.h
Expand Up @@ -185,6 +185,7 @@ class MythUINotificationScreen : public MythScreenType
kMetaData = 1 << 2,
kStyle = 1 << 3,
kError = 1 << 4,
kNoArtwork = 1 << 5,
kAll = ~kNone,
};

Expand Down Expand Up @@ -220,6 +221,7 @@ public slots:
MythUIText *m_progresstextText;
MythUIProgressBar *m_progressBar;
MythUIStateType *m_errorState;
MythUIStateType *m_mediaState;
QDateTime m_creation, m_expiry;
int m_index;
MythPoint m_position;
Expand Down

0 comments on commit 4d0fbb7

Please sign in to comment.