Ticket #12387: 0001-Fix-notifications-playback-exit.-Refs-12387.patch
File 0001-Fix-notifications-playback-exit.-Refs-12387.patch, 10.8 KB (added by , 10 years ago) |
---|
-
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) 665 665 QList<MythScreenType*>::iterator it2 = notifications.begin(); 666 666 while (it2 != notifications.end()) 667 667 { 668 if (! GetNotificationCenter()->ScreenCreated(*it2))668 if (!nc->ScreenCreated(*it2)) 669 669 { 670 LOG(VB_GUI, LOG_DEBUG, LOC + "Creating OSD Notification"); 671 670 672 if (!m_UIScaleOverride) 671 673 { 672 674 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, 196 196 } 197 197 198 198 MythNotificationScreen::MythNotificationScreen(MythScreenStack *stack, 199 199 const MythNotificationScreen &s) 200 200 : 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), 202 212 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), 205 217 m_artworkImage(NULL), m_titleText(NULL), m_originText(NULL), 206 218 m_descriptionText(NULL), m_extraText(NULL), m_progresstextText(NULL), 207 219 m_progressBar(NULL), m_errorState(NULL), m_mediaState(NULL), 220 m_creation(), 221 m_expiry(), 222 m_index(0), 223 m_position(), 208 224 m_timer(new QTimer(this)), 225 m_style(s.m_style), 209 226 m_visibility(MythNotification::kAll), 210 227 m_priority(MythNotification::kDefault), 211 228 m_refresh(true) 212 229 { 213 *this = s;214 230 connect(m_timer, SIGNAL(timeout()), this, SLOT(ProcessTimer())); 215 231 } 216 232 217 218 MythNotificationScreen &MythNotificationScreen::operator=(const MythNotificationScreen &s)219 {220 if (this == &s)221 return *this;222 223 // check if anything have changed224 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_type243 );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 type265 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 285 233 MythNotificationScreen::~MythNotificationScreen() 286 234 { 287 235 m_timer->stop(); … … void MythNotificationScreen::UpdatePlayback(float progress, const QString &text) 684 632 } 685 633 686 634 /** 635 * Copy metadata from another notification 636 */ 637 void 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 /** 687 687 * Update Y position of the screen 688 688 * All children elements will be relocated. 689 689 */ … … int MythNotificationScreen::GetHeight(void) 732 732 733 733 void MythNotificationScreen::ProcessTimer(void) 734 734 { 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)); 736 737 // delete screen 737 738 GetScreenStack()->PopScreen(this, true, true); 738 739 } … … void MythNotificationScreen::SetSingleShotTimer(int s, bool update) 755 756 m_timer->stop(); 756 757 m_timer->setSingleShot(true); 757 758 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 758 762 } 759 763 760 764 // Public event handling … … void NCPrivate::ProcessQueue(void) 960 964 } 961 965 if (!screen) 962 966 { 967 LOG(VB_GUI, LOG_DEBUG, LOC + QString("Creating screen %1, \"%2\"") 968 .arg(id).arg(n->GetDescription())); 969 963 970 // We have a registration, but no screen. Create one and display it 964 971 screen = CreateScreen(n); 965 972 if (!screen) // Reads screen definition from xml, and constructs screen … … void NCPrivate::ProcessQueue(void) 977 984 } 978 985 else 979 986 { 987 LOG(VB_GUI, LOG_DEBUG, LOC + QString("Using screen %1, \"%2\"") 988 .arg(id).arg(screen->m_title)); 980 989 screen->SetNotification(*n); 981 990 } 982 991 983 992 // if the screen got allocated, but did't read theme yet, do it now 984 993 if (screen && !screen->m_created) 985 994 { 995 LOG(VB_GUI, LOG_DEBUG, LOC + QString("Reloading screen %1, \"%2\"") 996 .arg(id).arg(screen->m_title)); 997 998 986 999 if (!screen->Create()) 987 1000 { 988 1001 delete screen; … … void NCPrivate::ProcessQueue(void) 994 1007 995 1008 if (created || !m_screens.contains(screen)) 996 1009 { 1010 LOG(VB_GUI, LOG_DEBUG, LOC + QString("Inserting screen %1").arg(id)); 1011 997 1012 int pos = InsertScreen(screen); 998 1013 // adjust vertical positions 999 1014 RefreshScreenPosition(pos); … … void NCPrivate::GetNotificationScreens(QList<MythScreenType*> &_screens) 1287 1302 else 1288 1303 { 1289 1304 newscreen = m_converted[screen]; 1290 // Copy old content in case itchanged1291 *newscreen = *screen;1305 // Copy new content in case it has changed 1306 newscreen->UpdateFrom(*screen); 1292 1307 } 1293 1308 newscreen->SetVisible(true); 1294 1309 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: 155 155 MythNotificationScreen(MythScreenStack *stack, 156 156 const MythNotificationScreen &screen); 157 157 158 MythNotificationScreen &operator=(const MythNotificationScreen &s);159 160 158 virtual ~MythNotificationScreen(); 161 159 162 160 bool keyPressEvent(QKeyEvent *event); … … public: 172 170 void UpdateArtwork(const QString &image); 173 171 void UpdateMetaData(const DMAP &data); 174 172 void UpdatePlayback(float progress, const QString &text); 173 void UpdateFrom(const MythNotificationScreen &s); 175 174 176 175 void SetSingleShotTimer(int s, bool update = false); 177 176 void SetErrorState(void);