Ticket #11020: epg_v1_master.patch
File epg_v1_master.patch, 25.0 KB (added by , 10 years ago) |
---|
-
mythtv/programs/mythfrontend/guidegrid.cpp
diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp index 5cdbb1b..51fb310 100644
a b bool JumpToChannel::Update(void) 164 164 } 165 165 } 166 166 167 class GuideStatus 168 { 169 public: 170 unsigned int m_firstRow; 171 int m_numRows; 172 QVector<int> m_channums; 173 uint m_currentStartChannel; 174 QDateTime m_currentStartTime; 175 QDateTime m_currentEndTime; 176 int m_currentRow; 177 int m_currentCol; 178 int m_channelCount; 179 int m_timeCount; 180 bool m_verticalLayout; 181 QDateTime m_firstTime; 182 QDateTime m_lastTime; 183 int m_channelInfos_size; 184 MythRect m_gg_programRect; 185 int m_gg_channelCount; 186 }; 187 188 class GuideUpdateClosure 189 { 190 public: 191 GuideUpdateClosure(GuideGrid *guide) : m_guide(guide), m_seq(++s_seq) {} 192 193 // Execute the initial non-UI part (in a separate thread). Return 194 // true if ExecuteUI() should be run later, or false if the work 195 // is no longer relevant (e.g., the UI elements have scrolled 196 // offscreen by now). 197 virtual bool ExecuteNonUI(void) = 0; 198 // Execute the UI part in the UI thread. 199 virtual void ExecuteUI(void) = 0; 200 201 protected: 202 GuideGrid *m_guide; 203 unsigned m_seq; 204 static unsigned s_seq; 205 }; 206 unsigned GuideUpdateClosure::s_seq; 207 208 struct UIGuideElement { 209 UIGuideElement(int row, int col, const QRect &area, 210 const QString &title, const QString &category, 211 int arrow, int recType, int recStat, bool selected) 212 : m_row(row), m_col(col), m_area(area), m_title(title), 213 m_category(category), m_arrow(arrow), m_recType(recType), 214 m_recStat(recStat), m_selected(selected) {} 215 UIGuideElement(void) {} 216 int m_row; 217 int m_col; 218 QRect m_area; 219 QString m_title; 220 QString m_category; 221 int m_arrow; 222 int m_recType; 223 int m_recStat; 224 bool m_selected; 225 }; 226 227 class GuideUpdateProgramRow : public GuideUpdateClosure 228 { 229 public: 230 GuideUpdateProgramRow(GuideGrid *guide, GuideStatus gs, 231 const QVector<ProgramList*> &proglists 232 ) 233 : GuideUpdateClosure(guide), 234 m_gs(gs), 235 m_proglists(proglists) 236 { 237 for (int i = m_gs.m_firstRow; i < m_gs.m_firstRow + m_gs.m_numRows; ++i) 238 for (int j = 0; j < MAX_DISPLAY_TIMES; ++j) 239 m_programInfos[i][j] = NULL; 240 } 241 virtual bool ExecuteNonUI(void) 242 { 243 // Don't bother to do any work if the starting coordinates of 244 // the guide have changed while the thread was waiting to 245 // start. 246 if (m_gs.m_currentStartChannel != m_guide->GetCurrentStartChannel() || 247 m_gs.m_currentStartTime != m_guide->GetCurrentStartTime()) 248 { 249 return false; 250 } 251 252 for (int i = 0; i < m_gs.m_numRows; ++i) 253 { 254 int row = i + m_gs.m_firstRow; 255 if (!m_proglists[i]) 256 m_proglists[i] = 257 m_guide->getProgramListFromProgram(m_gs.m_channums[i]); 258 fillProgramRowInfosWith(row, m_gs.m_channums[i], m_gs.m_currentStartTime, 259 m_proglists[i]); 260 } 261 //sleep(1); 262 return true; 263 } 264 virtual void ExecuteUI(void) 265 { 266 m_guide->updateProgramsUI(m_gs.m_firstRow, m_gs.m_numRows, 267 m_progPast, m_proglists, m_result); 268 } 269 void fillProgramRowInfosWith(int row, int chanNum, QDateTime start, 270 ProgramList *proglist); 271 const GuideStatus m_gs; 272 QVector<ProgramList*> m_proglists; 273 ProgramInfo *m_programInfos[MAX_DISPLAY_CHANS][MAX_DISPLAY_TIMES]; 274 int m_progPast; 275 QVector<UIGuideElement> m_result; 276 }; 277 278 class GuideUpdateChannels : public GuideUpdateClosure 279 { 280 public: 281 GuideUpdateChannels(GuideGrid *guide, uint startChan) 282 : GuideUpdateClosure(guide), m_currentStartChannel(startChan) {} 283 virtual bool ExecuteNonUI(void) 284 { 285 if (m_currentStartChannel != m_guide->GetCurrentStartChannel()) 286 return false; 287 m_guide->updateChannelsNonUI(m_chinfos, m_unavailables); 288 return true; 289 } 290 virtual void ExecuteUI(void) 291 { 292 m_guide->updateChannelsUI(m_chinfos, m_unavailables); 293 } 294 uint m_currentStartChannel; 295 QVector<ChannelInfo *> m_chinfos; 296 QVector<bool> m_unavailables; 297 }; 298 299 class UpdateGuideEvent : public QEvent 300 { 301 public: 302 UpdateGuideEvent(GuideUpdateClosure *closure) : 303 QEvent(kEventType), m_closure(closure) {} 304 GuideUpdateClosure *m_closure; 305 static Type kEventType; 306 }; 307 QEvent::Type UpdateGuideEvent::kEventType = 308 (QEvent::Type) QEvent::registerEventType(); 309 310 class GuideHelper : public QRunnable 311 { 312 public: 313 GuideHelper(GuideGrid *guide, GuideUpdateClosure *closure) 314 : m_guide(guide), m_closure(closure) 315 { 316 QMutexLocker locker(&s_lock); 317 ++s_loading[m_guide]; 318 } 319 virtual void run(void) 320 { 321 QThread::currentThread()->setPriority(QThread::IdlePriority); 322 if (m_closure) 323 { 324 if (m_closure->ExecuteNonUI()) 325 QCoreApplication::postEvent(m_guide, 326 new UpdateGuideEvent(m_closure)); 327 else 328 { 329 delete m_closure; 330 m_closure = NULL; 331 } 332 } 333 334 QMutexLocker locker(&s_lock); 335 --s_loading[m_guide]; 336 if (!s_loading[m_guide]) 337 s_wait.wakeAll(); 338 } 339 static bool IsLoading(GuideGrid *guide) 340 { 341 QMutexLocker locker(&s_lock); 342 return s_loading[guide]; 343 } 344 static void Wait(GuideGrid *guide) 345 { 346 QMutexLocker locker(&s_lock); 347 if (!s_loading[guide]) 348 return; 349 while (s_wait.wait(&s_lock)) 350 { 351 if (!s_loading[guide]) 352 return; 353 } 354 } 355 private: 356 GuideGrid *m_guide; 357 GuideUpdateClosure *m_closure; 358 359 static QMutex s_lock; 360 static QWaitCondition s_wait; 361 static QMap<GuideGrid*,uint> s_loading; 362 }; 363 QMutex GuideHelper::s_lock; 364 QWaitCondition GuideHelper::s_wait; 365 QMap<GuideGrid*,uint> GuideHelper::s_loading; 366 167 367 void GuideGrid::RunProgramGuide(uint chanid, const QString &channum, 168 368 const QDateTime startTime, 169 369 TV *player, bool embedVideo, … … GuideGrid::GuideGrid(MythScreenStack *parent, 241 441 m_previewVideoRefreshTimer(new QTimer(this)), 242 442 m_channelOrdering(gCoreContext->GetSetting("ChannelOrdering", "channum")), 243 443 m_updateTimer(NULL), 444 m_threadPool("GuideGridHelperPool"), 244 445 m_changrpid(changrpid), 245 446 m_changrplist(ChannelGroup::GetChannelGroups(false)), 246 447 m_jumpToChannelLock(QMutex::Recursive), … … GuideGrid::GuideGrid(MythScreenStack *parent, 274 475 int secsoffset = -((m_originalStartTime.time().minute() % 30) * 60 + 275 476 m_originalStartTime.time().second()); 276 477 m_currentStartTime = m_originalStartTime.addSecs(secsoffset); 478 m_threadPool.setMaxThreadCount(1); 277 479 } 278 480 279 481 bool GuideGrid::Create() … … void GuideGrid::Init(void) 356 558 updateChannels(); 357 559 358 560 fillProgramInfos(true); 359 updateInfo();360 561 361 562 m_updateTimer = new QTimer(this); 362 563 connect(m_updateTimer, SIGNAL(timeout()), SLOT(updateTimeout()) ); … … void GuideGrid::Init(void) 374 575 375 576 GuideGrid::~GuideGrid() 376 577 { 578 GuideHelper::Wait(this); 579 377 580 gCoreContext->removeListener(this); 378 581 379 582 while (!m_programs.empty()) … … void GuideGrid::fillTimeInfos() 1046 1249 1047 1250 void GuideGrid::fillProgramInfos(bool useExistingData) 1048 1251 { 1049 m_guideGrid->ResetData(); 1050 1051 for (int y = 0; y < m_channelCount; ++y) 1052 { 1053 fillProgramRowInfos(y, useExistingData); 1054 } 1252 fillProgramRowInfos(-1, useExistingData); 1055 1253 } 1056 1254 1057 1255 ProgramList *GuideGrid::getProgramListFromProgram(int chanNum) … … ProgramList *GuideGrid::getProgramListFromProgram(int chanNum) 1077 1275 return proglist; 1078 1276 } 1079 1277 1080 void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData)1278 static ProgramList *CopyProglist(ProgramList *proglist) 1081 1279 { 1082 m_guideGrid->ResetRow(row); 1083 1084 // never divide by zero.. 1085 if (!m_guideGrid->getChannelCount() || !m_timeCount) 1086 return; 1280 if (!proglist) 1281 return NULL; 1282 ProgramList *result = new ProgramList(); 1283 for (ProgramList::iterator pi = proglist->begin(); pi != proglist->end(); ++pi) 1284 result->push_back(new ProgramInfo(**pi)); 1285 return result; 1286 } 1087 1287 1088 for (int x = 0; x < m_timeCount; ++x) 1288 void GuideGrid::fillProgramRowInfos(int firstRow, bool useExistingData) 1289 { 1290 bool allRows = false; 1291 int numRows = 1; 1292 if (firstRow < 0) 1089 1293 { 1090 m_programInfos[row][x] = NULL; 1294 firstRow = 0; 1295 allRows = true; 1296 numRows = min((int)m_channelInfos.size(), m_guideGrid->getChannelCount()); 1091 1297 } 1298 QVector<int> chanNums; 1299 QVector<ProgramList*> proglists; 1092 1300 1093 if (m_channelInfos.empty()) 1094 return; 1301 for (unsigned int i = 0; i < numRows; ++i) 1302 { 1303 unsigned int row = i + firstRow; 1304 // never divide by zero.. 1305 if (!m_guideGrid->getChannelCount() || !m_timeCount) 1306 return; 1095 1307 1096 int chanNum = row + m_currentStartChannel; 1097 if (chanNum >= (int) m_channelInfos.size()) 1098 chanNum -= (int) m_channelInfos.size(); 1099 if (chanNum >= (int) m_channelInfos.size()) 1100 return; 1308 for (int x = 0; x < m_timeCount; ++x) 1309 { 1310 m_programInfos[row][x] = NULL; 1311 } 1101 1312 1102 if (chanNum < 0)1103 chanNum = 0;1313 if (m_channelInfos.empty()) 1314 return; 1104 1315 1105 if (!useExistingData) 1316 int chanNum = row + m_currentStartChannel; 1317 if (chanNum >= (int) m_channelInfos.size()) 1318 chanNum -= (int) m_channelInfos.size(); 1319 if (chanNum >= (int) m_channelInfos.size()) 1320 return; 1321 1322 if (chanNum < 0) 1323 chanNum = 0; 1324 1325 ProgramList *proglist = NULL; 1326 if (useExistingData) 1327 proglist = CopyProglist(m_programs[row]); 1328 chanNums.push_back(chanNum); 1329 proglists.push_back(proglist); 1330 } 1331 if (allRows) 1106 1332 { 1107 delete m_programs[row]; 1108 m_programs[row] = getProgramListFromProgram(chanNum); 1333 for (unsigned int i = numRows; i < m_guideGrid->getChannelCount(); ++i) 1334 { 1335 delete m_programs[i]; 1336 m_programs[i] = NULL; 1337 m_guideGrid->ResetRow(i); 1338 } 1109 1339 } 1110 1111 ProgramList *proglist = m_programs[row]; 1112 if (!proglist) 1340 GuideStatus gs; 1341 gs.m_firstRow = firstRow; 1342 gs.m_numRows = chanNums.size(); 1343 gs.m_channums = chanNums; 1344 gs.m_currentStartChannel = m_currentStartChannel; 1345 gs.m_currentStartTime = m_currentStartTime; 1346 gs.m_currentEndTime = m_currentEndTime; 1347 gs.m_currentRow = m_currentRow; 1348 gs.m_currentCol = m_currentCol; 1349 gs.m_channelCount = m_channelCount; 1350 gs.m_timeCount = m_timeCount; 1351 gs.m_verticalLayout = m_verticalLayout; 1352 gs.m_firstTime = m_firstTime; 1353 gs.m_lastTime = m_lastTime; 1354 gs.m_channelInfos_size = m_channelInfos.size(); 1355 gs.m_gg_programRect = m_guideGrid->GetArea(); 1356 gs.m_gg_channelCount = m_guideGrid->getChannelCount(); 1357 GuideUpdateProgramRow *closure = 1358 new GuideUpdateProgramRow(this, gs, proglists); 1359 m_threadPool.start(new GuideHelper(this, closure), "GuideHelper"); 1360 } 1361 1362 void GuideUpdateProgramRow::fillProgramRowInfosWith(int row, int chanNum, QDateTime start, 1363 ProgramList *proglist) 1364 { 1365 if (row < 0 || row >= m_gs.m_channelCount || 1366 start != m_gs.m_currentStartTime) 1367 { 1368 delete proglist; 1113 1369 return; 1370 } 1114 1371 1115 QDateTime ts = m_ currentStartTime;1372 QDateTime ts = m_gs.m_currentStartTime; 1116 1373 1117 1374 QDateTime tnow = MythDate::current(); 1118 1375 int progPast = 0; 1119 if (tnow > m_ currentEndTime)1376 if (tnow > m_gs.m_currentEndTime) 1120 1377 progPast = 100; 1121 else if (tnow < m_ currentStartTime)1378 else if (tnow < m_gs.m_currentStartTime) 1122 1379 progPast = 0; 1123 1380 else 1124 1381 { 1125 int played = m_ currentStartTime.secsTo(tnow);1126 int length = m_ currentStartTime.secsTo(m_currentEndTime);1382 int played = m_gs.m_currentStartTime.secsTo(tnow); 1383 int length = m_gs.m_currentStartTime.secsTo(m_gs.m_currentEndTime); 1127 1384 if (length) 1128 1385 progPast = played * 100 / length; 1129 1386 } 1130 1387 1131 m_ guideGrid->SetProgPast(progPast);1388 m_progPast = progPast; 1132 1389 1133 1390 ProgramList::iterator program = proglist->begin(); 1134 1391 vector<ProgramInfo*> unknownlist; 1135 1392 bool unknown = false; 1136 1393 ProgramInfo *proginfo = NULL; 1137 for (int x = 0; x < m_ timeCount; ++x)1394 for (int x = 0; x < m_gs.m_timeCount; ++x) 1138 1395 { 1139 1396 if (program != proglist->end() && 1140 1397 (ts >= (*program)->GetScheduledEndTime())) … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1153 1410 } 1154 1411 else 1155 1412 { 1156 proginfo = new ProgramInfo(kUnknownTitle, tr("Unknown"), 1413 proginfo = new ProgramInfo(kUnknownTitle, 1414 GuideGrid::tr("Unknown"), 1157 1415 ts, ts.addSecs(5*60)); 1158 1416 unknownlist.push_back(proginfo); 1159 1417 proginfo->startCol = x; … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1186 1444 for (; it != unknownlist.end(); ++it) 1187 1445 proglist->push_back(*it); 1188 1446 1189 MythRect programRect = m_g uideGrid->GetArea();1447 MythRect programRect = m_gs.m_gg_programRect; 1190 1448 1191 1449 /// use doubles to avoid large gaps at end.. 1192 1450 double ydifference = 0.0, xdifference = 0.0; 1193 1451 1194 if (m_ verticalLayout)1452 if (m_gs.m_verticalLayout) 1195 1453 { 1196 1454 ydifference = programRect.width() / 1197 (double) m_g uideGrid->getChannelCount();1455 (double) m_gs.m_gg_channelCount; 1198 1456 xdifference = programRect.height() / 1199 (double) m_ timeCount;1457 (double) m_gs.m_timeCount; 1200 1458 } 1201 1459 else 1202 1460 { 1203 1461 ydifference = programRect.height() / 1204 (double) m_g uideGrid->getChannelCount();1462 (double) m_gs.m_gg_channelCount; 1205 1463 xdifference = programRect.width() / 1206 (double) m_ timeCount;1464 (double) m_gs.m_timeCount; 1207 1465 } 1208 1466 1209 1467 int arrow = 0; … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1213 1471 QRect tempRect; 1214 1472 bool isCurrent = false; 1215 1473 1216 for (int x = 0; x < m_ timeCount; ++x)1474 for (int x = 0; x < m_gs.m_timeCount; ++x) 1217 1475 { 1218 1476 ProgramInfo *pginfo = m_programInfos[row][x]; 1219 1477 if (!pginfo) … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1223 1481 if (pginfo->GetScheduledStartTime() != lastprog) 1224 1482 { 1225 1483 arrow = 0; 1226 if (pginfo->GetScheduledStartTime() < m_ firstTime.addSecs(-300))1484 if (pginfo->GetScheduledStartTime() < m_gs.m_firstTime.addSecs(-300)) 1227 1485 arrow = arrow + 1; 1228 if (pginfo->GetScheduledEndTime() > m_ lastTime.addSecs(2100))1486 if (pginfo->GetScheduledEndTime() > m_gs.m_lastTime.addSecs(2100)) 1229 1487 arrow = arrow + 2; 1230 1488 1231 1489 if (pginfo->spread != -1) … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1234 1492 } 1235 1493 else 1236 1494 { 1237 for (int z = x + 1; z < m_ timeCount; ++z)1495 for (int z = x + 1; z < m_gs.m_timeCount; ++z) 1238 1496 { 1239 1497 ProgramInfo *test = m_programInfos[row][z]; 1240 1498 if (test && (test->GetScheduledStartTime() == … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1255 1513 } 1256 1514 } 1257 1515 1258 if (m_ verticalLayout)1516 if (m_gs.m_verticalLayout) 1259 1517 { 1260 1518 tempRect = QRect((int)(row * ydifference), 1261 1519 (int)(x * xdifference), … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1276 1534 if (tempRect.bottom() + 2 >= programRect.bottom()) 1277 1535 tempRect.setBottom(programRect.bottom()); 1278 1536 1279 if (m_ currentRow == (int)row && (m_currentCol >= x) &&1280 (m_ currentCol < (x + spread)))1537 if (m_gs.m_currentRow == (int)row && (m_gs.m_currentCol >= x) && 1538 (m_gs.m_currentCol < (x + spread))) 1281 1539 isCurrent = true; 1282 1540 else 1283 1541 isCurrent = false; … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1320 1578 recStat = 0; 1321 1579 1322 1580 QString title = (pginfo->GetTitle() == kUnknownTitle) ? 1323 1581 GuideGrid::tr("Unknown", "Unknown program title") : 1324 1582 pginfo->GetTitle(); 1325 m_ guideGrid->SetProgramInfo(1583 m_result.push_back(UIGuideElement( 1326 1584 row, cnt, tempRect, title, 1327 1585 pginfo->GetCategory(), arrow, recFlag, 1328 recStat, isCurrent) ;1586 recStat, isCurrent)); 1329 1587 1330 1588 cnt++; 1331 1589 } 1332 1590 1333 1591 lastprog = pginfo->GetScheduledStartTime(); 1334 1592 } 1593 1335 1594 } 1336 1595 1337 1596 void GuideGrid::customEvent(QEvent *event) … … void GuideGrid::customEvent(QEvent *event) 1345 1604 { 1346 1605 LoadFromScheduler(m_recList); 1347 1606 fillProgramInfos(); 1348 updateInfo();1349 1607 } 1350 1608 else if (message == "STOP_VIDEO_REFRESH_TIMER") 1351 1609 { … … void GuideGrid::customEvent(QEvent *event) 1489 1747 else 1490 1748 ScheduleCommon::customEvent(event); 1491 1749 } 1750 else if (event->type() == UpdateGuideEvent::kEventType) 1751 { 1752 UpdateGuideEvent *uge = static_cast<UpdateGuideEvent*>(event); 1753 if (uge->m_closure) 1754 { 1755 uge->m_closure->ExecuteUI(); 1756 delete uge->m_closure; 1757 uge->m_closure = NULL; 1758 } 1759 } 1492 1760 } 1493 1761 1494 1762 void GuideGrid::updateDateText(void) … … void GuideGrid::updateDateText(void) 1500 1768 (MythDate::kDateFull | MythDate::kSimplify))); 1501 1769 } 1502 1770 1771 void GuideGrid::updateProgramsUI(unsigned int firstRow, int numRows, 1772 int progPast, 1773 const QVector<ProgramList*> &proglists, 1774 const QVector<struct UIGuideElement> &elements) 1775 { 1776 for (int i = 0; i < numRows; ++i) 1777 { 1778 int row = i + firstRow; 1779 m_guideGrid->ResetRow(row); 1780 if (m_programs[row] != proglists[i]) 1781 { 1782 delete m_programs[row]; 1783 m_programs[row] = proglists[i]; 1784 } 1785 } 1786 m_guideGrid->SetProgPast(progPast); 1787 for (int i = 0; i < elements.size(); ++i) 1788 { 1789 UIGuideElement r = elements[i]; 1790 m_guideGrid->SetProgramInfo(r.m_row, r.m_col, r.m_area, r.m_title, 1791 r.m_category, r.m_arrow, r.m_recType, 1792 r.m_recStat, r.m_selected); 1793 } 1794 for (int i = firstRow; i < firstRow + numRows; ++i) 1795 { 1796 for (int j = 0; j < MAX_DISPLAY_TIMES; ++j) 1797 m_programInfos[i][j] = m_programInfos[i][j]; 1798 if (i == m_currentRow) 1799 updateInfo(); 1800 } 1801 m_guideGrid->SetRedraw(); 1802 } 1803 1503 1804 void GuideGrid::updateChannels(void) 1504 1805 { 1505 m_channelList->Reset(); 1806 m_threadPool.start(new GuideHelper(this, new GuideUpdateChannels(this, m_currentStartChannel)), 1807 "GuideHelper"); 1808 } 1506 1809 1810 void GuideGrid::updateChannelsNonUI(QVector<ChannelInfo *> &chinfos, 1811 QVector<bool> &unavailables) 1812 { 1507 1813 ChannelInfo *chinfo = GetChannelInfo(m_currentStartChannel); 1508 1814 1509 1815 if (m_player) … … void GuideGrid::updateChannels(void) 1551 1857 unavailable = (alt == m_channelInfoIdx[chanNumber]); 1552 1858 } 1553 1859 } 1860 chinfos.push_back(chinfo); 1861 unavailables.push_back(unavailable); 1862 } 1863 } 1554 1864 1865 void GuideGrid::updateChannelsUI(const QVector<ChannelInfo *> &chinfos, 1866 const QVector<bool> &unavailables) 1867 { 1868 m_channelList->Reset(); 1869 for (int i = 0; i < chinfos.size(); ++i) 1870 { 1871 ChannelInfo *chinfo = chinfos[i]; 1872 bool unavailable = unavailables[i]; 1555 1873 MythUIButtonListItem *item = 1556 1874 new MythUIButtonListItem(m_channelList, 1557 1875 chinfo ? chinfo->GetFormatted(ChannelInfo::kChannelShort) : QString()); … … void GuideGrid::updateInfo(void) 1636 1954 QString rating = QString::number(pginfo->GetStars(10)); 1637 1955 ratingState->DisplayState(rating); 1638 1956 } 1957 m_guideGrid->SetRedraw(); 1639 1958 } 1640 1959 1641 1960 void GuideGrid::toggleGuideListing() … … void GuideGrid::cursorLeft() 1786 2105 else 1787 2106 { 1788 2107 fillProgramRowInfos(m_currentRow, true); 1789 m_guideGrid->SetRedraw();1790 updateInfo();1791 2108 } 1792 2109 } 1793 2110 … … void GuideGrid::cursorRight() 1814 2131 else 1815 2132 { 1816 2133 fillProgramRowInfos(m_currentRow, true); 1817 m_guideGrid->SetRedraw();1818 updateInfo();1819 2134 } 1820 2135 } 1821 2136 … … void GuideGrid::cursorDown() 1831 2146 else 1832 2147 { 1833 2148 fillProgramRowInfos(m_currentRow, true); 1834 m_guideGrid->SetRedraw();1835 updateInfo();1836 updateChannels();1837 2149 } 1838 2150 } 1839 2151 … … void GuideGrid::cursorUp() 1849 2161 else 1850 2162 { 1851 2163 fillProgramRowInfos(m_currentRow, true); 1852 m_guideGrid->SetRedraw();1853 updateInfo();1854 updateChannels();1855 2164 } 1856 2165 } 1857 2166 … … void GuideGrid::moveLeftRight(MoveVector movement) 1883 2192 1884 2193 fillTimeInfos(); 1885 2194 fillProgramInfos(); 1886 m_guideGrid->SetRedraw();1887 updateInfo();1888 2195 updateDateText(); 1889 2196 } 1890 2197 … … void GuideGrid::moveUpDown(MoveVector movement) 1909 2216 } 1910 2217 1911 2218 fillProgramInfos(); 1912 m_guideGrid->SetRedraw();1913 updateInfo();1914 2219 updateChannels(); 1915 2220 } 1916 2221 … … void GuideGrid::moveToTime(QDateTime datetime) 1923 2228 1924 2229 fillTimeInfos(); 1925 2230 fillProgramInfos(); 1926 m_guideGrid->SetRedraw();1927 updateInfo();1928 2231 updateDateText(); 1929 2232 } 1930 2233 … … void GuideGrid::quickRecord() 1992 2295 QuickRecord(pginfo); 1993 2296 LoadFromScheduler(m_recList); 1994 2297 fillProgramInfos(); 1995 updateInfo();1996 2298 } 1997 2299 1998 2300 void GuideGrid::editRecSchedule() … … void GuideGrid::GoTo(int start, int cur_row) 2139 2441 m_currentRow = cur_row % m_channelCount; 2140 2442 updateChannels(); 2141 2443 fillProgramInfos(); 2142 updateInfo();2143 2444 updateJumpToChannel(); 2144 2445 } 2145 2446 -
mythtv/programs/mythfrontend/guidegrid.h
diff --git a/mythtv/programs/mythfrontend/guidegrid.h b/mythtv/programs/mythfrontend/guidegrid.h index fd11d27..665d4ea 100644
a b using namespace std; 17 17 #include "channelgroup.h" 18 18 #include "channelutil.h" 19 19 #include "mythuiguidegrid.h" 20 #include "mthreadpool.h" 20 21 21 22 // mythfrontend 22 23 #include "schedulecommon.h" … … class GuideGrid : public ScheduleCommon, public JumpToChannelListener 102 103 103 104 virtual void aboutToShow(); 104 105 virtual void aboutToHide(); 106 // Allow class GuideUpdateProgramRow to figure out whether the 107 // current start time/channel coordinates are the same, so that it can 108 // skip the work if not. 109 uint GetCurrentStartChannel(void) const { return m_currentStartChannel; } 110 QDateTime GetCurrentStartTime(void) const { return m_currentStartTime; } 105 111 106 112 protected slots: 107 113 void cursorLeft(); … … class GuideGrid : public ScheduleCommon, public JumpToChannelListener 179 185 void fillChannelInfos(bool gotostartchannel = true); 180 186 void fillTimeInfos(void); 181 187 void fillProgramInfos(bool useExistingData = false); 182 void fillProgramRowInfos(unsigned int row, bool useExistingData = false); 188 // Set row=-1 to fill all rows. 189 void fillProgramRowInfos(int row, bool useExistingData); 190 public: 191 // These need to be public so that the helper classes can operate. 183 192 ProgramList *getProgramListFromProgram(int chanNum); 193 void updateProgramsUI(unsigned int firstRow, int numRows, 194 int progPast, 195 const QVector<ProgramList*> &proglists, 196 const QVector<struct UIGuideElement> &elements); 197 void updateChannelsNonUI(QVector<ChannelInfo *> &chinfos, 198 QVector<bool> &unavailables); 199 void updateChannelsUI(const QVector<ChannelInfo *> &chinfos, 200 const QVector<bool> &unavailables); 201 private: 184 202 185 203 void setStartChannel(int newStartChannel); 186 204 … … class GuideGrid : public ScheduleCommon, public JumpToChannelListener 235 253 236 254 QTimer *m_updateTimer; // audited ref #5318 237 255 256 MThreadPool m_threadPool; 257 238 258 int m_changrpid; 239 259 ChannelGroupList m_changrplist; 240 260