Ticket #12387: 0001-Fix-notifications-playback-exit.-Refs-12387.patch

File 0001-Fix-notifications-playback-exit.-Refs-12387.patch, 10.8 KB (added by Roger Siddons <dizygotheca@…>, 10 years ago)

Fix

  • mythtv/libs/libmythtv/osd.cpp

    From b5ee87a9a1f3a45d9fe108e054a51dacc0dcb58e Mon Sep 17 00:00:00 2001
    From: Roger Siddons <dizygotheca@ntlworld.com>
    Date: Tue, 28 Apr 2015 01:03:40 +0100
    Subject: [PATCH] Fix notifications & playback exit. Refs #12387
    
    Fixes re-display of previous notifications.
    Fixes display of notifications on playback window.
    Fixes 'ESC key won't exit playback' due to hidden notifications.
    
    Issues were introduced by commits ccde7292, 6350a12a & 3016a7be.
    
    diff --git a/mythtv/libs/libmythtv/osd.cpp b/mythtv/libs/libmythtv/osd.cpp
    index 7b030ff..edb6b67 100644
    a b bool OSD::DrawDirect(MythPainter* painter, QSize size, bool repaint) 
    665665    QList<MythScreenType*>::iterator it2 = notifications.begin();
    666666    while (it2 != notifications.end())
    667667    {
    668         if (!GetNotificationCenter()->ScreenCreated(*it2))
     668        if (!nc->ScreenCreated(*it2))
    669669        {
     670            LOG(VB_GUI, LOG_DEBUG, LOC + "Creating OSD Notification");
     671
    670672            if (!m_UIScaleOverride)
    671673            {
    672674                OverrideUIScale(false);
  • mythtv/libs/libmythui/mythnotificationcenter.cpp

    diff --git a/mythtv/libs/libmythui/mythnotificationcenter.cpp b/mythtv/libs/libmythui/mythnotificationcenter.cpp
    index 55148f5..d909741 100644
    a b MythNotificationScreen::MythNotificationScreen(MythScreenStack *stack, 
    196196}
    197197
    198198MythNotificationScreen::MythNotificationScreen(MythScreenStack *stack,
    199                                                    const MythNotificationScreen &s)
     199                                               const MythNotificationScreen &s)
    200200    : MythScreenType(stack, "mythnotification"),
    201       m_duration(-1),           m_progress(-1.0),   m_fullscreen(false),
     201      m_id(s.m_id),
     202      m_image(s.m_image),
     203      m_imagePath(s.m_imagePath),
     204      m_title(s.m_title),
     205      m_origin(s.m_origin),
     206      m_description(s.m_description),
     207      m_extra(s.m_extra),
     208      m_duration(s.m_duration),
     209      m_progress(s.m_progress),
     210      m_progresstext(s.m_progresstext),
     211      m_fullscreen(s.m_fullscreen),
    202212      m_added(false),
    203       m_created(false),         m_content(kNone),   m_update(kAll),
    204       m_type(MythNotification::New),
     213      m_created(false),
     214      m_content(s.m_content),
     215      m_update(s.m_content), // so all fields are initialised regardless of notification type
     216      m_type(s.m_type),
    205217      m_artworkImage(NULL),     m_titleText(NULL),  m_originText(NULL),
    206218      m_descriptionText(NULL),  m_extraText(NULL),  m_progresstextText(NULL),
    207219      m_progressBar(NULL),      m_errorState(NULL), m_mediaState(NULL),
     220      m_creation(),
     221      m_expiry(),
     222      m_index(0),
     223      m_position(),
    208224      m_timer(new QTimer(this)),
     225      m_style(s.m_style),
    209226      m_visibility(MythNotification::kAll),
    210227      m_priority(MythNotification::kDefault),
    211228      m_refresh(true)
    212229{
    213     *this = s;
    214230    connect(m_timer, SIGNAL(timeout()), this, SLOT(ProcessTimer()));
    215231}
    216232
    217 
    218 MythNotificationScreen &MythNotificationScreen::operator=(const MythNotificationScreen &s)
    219 {
    220     if (this == &s)
    221         return *this;
    222 
    223     // check if anything have changed
    224     m_refresh = !(
    225                   m_id == s.m_id &&
    226                   m_image == s.m_image &&
    227                   m_imagePath == s.m_imagePath &&
    228                   m_title == s.m_title &&
    229                   m_origin == s.m_origin &&
    230                   m_description == s.m_description &&
    231                   m_extra == s.m_extra &&
    232                   m_duration == s.m_duration &&
    233                   m_progress == s.m_progress &&
    234                   m_progresstext == s.m_progresstext &&
    235                   m_content == s.m_content &&
    236                   m_fullscreen == s.m_fullscreen &&
    237                   m_expiry == s.m_expiry &&
    238                   m_index == s.m_index &&
    239                   m_style == s.m_style &&
    240                   m_visibility == s.m_visibility &&
    241                   m_priority == s.m_priority &&
    242                   m_type == s.m_type
    243                   );
    244 
    245     m_id            = s.m_id;
    246     m_image         = s.m_image;
    247     m_imagePath     = s.m_imagePath;
    248     m_title         = s.m_title;
    249     m_origin        = s.m_origin;
    250     m_description   = s.m_description;
    251     m_extra         = s.m_extra;
    252     m_duration      = s.m_duration;
    253     m_progress      = s.m_progress;
    254     m_progresstext  = s.m_progresstext;
    255     m_content       = s.m_content;
    256     m_fullscreen    = s.m_fullscreen;
    257     m_expiry        = s.m_expiry;
    258     m_index         = s.m_index;
    259     m_style         = s.m_style;
    260     m_visibility    = s.m_visibility;
    261     m_priority      = s.m_priority;
    262     m_type          = s.m_type;
    263 
    264     m_update        = m_content; // so all fields are initialised regardless of notification type
    265 
    266     m_added         = s.m_added;
    267     m_created       = s.m_created;
    268 
    269     m_artworkImage     = NULL;
    270     m_titleText        = NULL;
    271     m_originText       = NULL;
    272     m_descriptionText  = NULL;
    273     m_extraText        = NULL;
    274     m_progresstextText = NULL;
    275     m_progressBar      = NULL;
    276     m_errorState       = NULL;
    277     m_mediaState       = NULL;
    278 
    279     m_timer            = new QTimer(this);
    280     connect(m_timer, SIGNAL(timeout()), this, SLOT(ProcessTimer()));
    281 
    282     return *this;
    283 }
    284 
    285233MythNotificationScreen::~MythNotificationScreen()
    286234{
    287235    m_timer->stop();
    void MythNotificationScreen::UpdatePlayback(float progress, const QString &text) 
    684632}
    685633
    686634/**
     635 * Copy metadata from another notification
     636 */
     637void MythNotificationScreen::UpdateFrom(const MythNotificationScreen &s)
     638{
     639    // check if anything has changed
     640    m_refresh = !(
     641                  m_id == s.m_id &&
     642                  m_image == s.m_image &&
     643                  m_imagePath == s.m_imagePath &&
     644                  m_title == s.m_title &&
     645                  m_origin == s.m_origin &&
     646                  m_description == s.m_description &&
     647                  m_extra == s.m_extra &&
     648                  m_duration == s.m_duration &&
     649                  m_progress == s.m_progress &&
     650                  m_progresstext == s.m_progresstext &&
     651                  m_content == s.m_content &&
     652                  m_fullscreen == s.m_fullscreen &&
     653                  m_expiry == s.m_expiry &&
     654                  m_index == s.m_index &&
     655                  m_style == s.m_style &&
     656                  m_visibility == s.m_visibility &&
     657                  m_priority == s.m_priority &&
     658                  m_type == s.m_type
     659                  );
     660
     661    if (m_refresh)
     662    {
     663        m_id            = s.m_id;
     664        m_image         = s.m_image;
     665        m_imagePath     = s.m_imagePath;
     666        m_title         = s.m_title;
     667        m_origin        = s.m_origin;
     668        m_description   = s.m_description;
     669        m_extra         = s.m_extra;
     670        m_duration      = s.m_duration;
     671        m_progress      = s.m_progress;
     672        m_progresstext  = s.m_progresstext;
     673        m_content       = s.m_content;
     674        m_fullscreen    = s.m_fullscreen;
     675        m_expiry        = s.m_expiry;
     676        m_index         = s.m_index;
     677        m_style         = s.m_style;
     678        m_visibility    = s.m_visibility;
     679        m_priority      = s.m_priority;
     680        m_type          = s.m_type;
     681    }
     682
     683    m_update        = m_content; // so all fields are initialised regardless of notification type
     684}
     685
     686/**
    687687 * Update Y position of the screen
    688688 * All children elements will be relocated.
    689689 */
    int MythNotificationScreen::GetHeight(void) 
    732732
    733733void MythNotificationScreen::ProcessTimer(void)
    734734{
    735     LOG(VB_GUI, LOG_DEBUG, LOC + "ProcessTimer()");
     735    LOG(VB_GUI, LOG_DEBUG, LOC + QString("Screen id %1 \"%2\" expired")
     736        .arg(m_id).arg(m_title));
    736737    // delete screen
    737738    GetScreenStack()->PopScreen(this, true, true);
    738739}
    void MythNotificationScreen::SetSingleShotTimer(int s, bool update) 
    755756    m_timer->stop();
    756757    m_timer->setSingleShot(true);
    757758    m_timer->start(ms);
     759    LOG(VB_GUI, LOG_DEBUG, LOC + QString("Screen %1 expires at %2")
     760        .arg(m_id).arg(m_expiry.toString("mm:ss")));
     761
    758762}
    759763
    760764// Public event handling
    void NCPrivate::ProcessQueue(void) 
    960964        }
    961965        if (!screen)
    962966        {
     967            LOG(VB_GUI, LOG_DEBUG, LOC + QString("Creating screen %1, \"%2\"")
     968                .arg(id).arg(n->GetDescription()));
     969
    963970            // We have a registration, but no screen. Create one and display it
    964971            screen = CreateScreen(n);
    965972            if (!screen) // Reads screen definition from xml, and constructs screen
    void NCPrivate::ProcessQueue(void) 
    977984        }
    978985        else
    979986        {
     987            LOG(VB_GUI, LOG_DEBUG, LOC + QString("Using screen %1, \"%2\"")
     988                .arg(id).arg(screen->m_title));
    980989            screen->SetNotification(*n);
    981990        }
    982991
    983992        // if the screen got allocated, but did't read theme yet, do it now
    984993        if (screen && !screen->m_created)
    985994        {
     995            LOG(VB_GUI, LOG_DEBUG, LOC + QString("Reloading screen %1, \"%2\"")
     996                .arg(id).arg(screen->m_title));
     997
     998
    986999            if (!screen->Create())
    9871000            {
    9881001                delete screen;
    void NCPrivate::ProcessQueue(void) 
    9941007
    9951008        if (created || !m_screens.contains(screen))
    9961009        {
     1010            LOG(VB_GUI, LOG_DEBUG, LOC + QString("Inserting screen %1").arg(id));
     1011
    9971012            int pos = InsertScreen(screen);
    9981013            // adjust vertical positions
    9991014            RefreshScreenPosition(pos);
    void NCPrivate::GetNotificationScreens(QList<MythScreenType*> &_screens) 
    12871302            else
    12881303            {
    12891304                newscreen = m_converted[screen];
    1290                 // Copy old content in case it changed
    1291                 *newscreen = *screen;
     1305                // Copy new content in case it has changed
     1306                newscreen->UpdateFrom(*screen);
    12921307            }
    12931308            newscreen->SetVisible(true);
    12941309            newscreen->SetIndex(position++);
  • mythtv/libs/libmythui/mythnotificationcenter_private.h

    diff --git a/mythtv/libs/libmythui/mythnotificationcenter_private.h b/mythtv/libs/libmythui/mythnotificationcenter_private.h
    index b1586cb..5adb56e 100644
    a b public: 
    155155    MythNotificationScreen(MythScreenStack *stack,
    156156                             const MythNotificationScreen &screen);
    157157   
    158     MythNotificationScreen &operator=(const MythNotificationScreen &s);
    159 
    160158    virtual ~MythNotificationScreen();
    161159
    162160    bool keyPressEvent(QKeyEvent *event);
    public: 
    172170    void UpdateArtwork(const QString &image);
    173171    void UpdateMetaData(const DMAP &data);
    174172    void UpdatePlayback(float progress, const QString &text);
     173    void UpdateFrom(const MythNotificationScreen &s);
    175174
    176175    void SetSingleShotTimer(int s, bool update = false);
    177176    void SetErrorState(void);