Ticket #11020: epg_v1_fixes27.patch
File epg_v1_fixes27.patch, 24.7 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 5a5f52c..142d810 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() 1075 1278 1076 1279 void GuideGrid::fillProgramInfos(bool useExistingData) 1077 1280 { 1078 m_guideGrid->ResetData(); 1079 1080 for (int y = 0; y < m_channelCount; ++y) 1081 { 1082 fillProgramRowInfos(y, useExistingData); 1083 } 1281 fillProgramRowInfos(-1, useExistingData); 1084 1282 } 1085 1283 1086 1284 ProgramList *GuideGrid::getProgramListFromProgram(int chanNum) … … ProgramList *GuideGrid::getProgramListFromProgram(int chanNum) 1106 1304 return proglist; 1107 1305 } 1108 1306 1109 void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData)1307 static ProgramList *CopyProglist(ProgramList *proglist) 1110 1308 { 1111 m_guideGrid->ResetRow(row); 1112 1113 // never divide by zero.. 1114 if (!m_guideGrid->getChannelCount() || !m_timeCount) 1115 return; 1309 if (!proglist) 1310 return NULL; 1311 ProgramList *result = new ProgramList(); 1312 for (ProgramList::iterator pi = proglist->begin(); pi != proglist->end(); ++pi) 1313 result->push_back(new ProgramInfo(**pi)); 1314 return result; 1315 } 1116 1316 1117 for (int x = 0; x < m_timeCount; ++x) 1317 void GuideGrid::fillProgramRowInfos(int firstRow, bool useExistingData) 1318 { 1319 bool allRows = false; 1320 int numRows = 1; 1321 if (firstRow < 0) 1118 1322 { 1119 m_programInfos[row][x] = NULL; 1323 firstRow = 0; 1324 allRows = true; 1325 numRows = min((int)m_channelInfos.size(), m_guideGrid->getChannelCount()); 1120 1326 } 1327 QVector<int> chanNums; 1328 QVector<ProgramList*> proglists; 1121 1329 1122 if (m_channelInfos.empty()) 1123 return; 1330 for (unsigned int i = 0; i < numRows; ++i) 1331 { 1332 unsigned int row = i + firstRow; 1333 // never divide by zero.. 1334 if (!m_guideGrid->getChannelCount() || !m_timeCount) 1335 return; 1124 1336 1125 int chanNum = row + m_currentStartChannel; 1126 if (chanNum >= (int) m_channelInfos.size()) 1127 chanNum -= (int) m_channelInfos.size(); 1128 if (chanNum >= (int) m_channelInfos.size()) 1129 return; 1337 for (int x = 0; x < m_timeCount; ++x) 1338 { 1339 m_programInfos[row][x] = NULL; 1340 } 1130 1341 1131 if (chanNum < 0)1132 chanNum = 0;1342 if (m_channelInfos.empty()) 1343 return; 1133 1344 1134 if (!useExistingData) 1345 int chanNum = row + m_currentStartChannel; 1346 if (chanNum >= (int) m_channelInfos.size()) 1347 chanNum -= (int) m_channelInfos.size(); 1348 if (chanNum >= (int) m_channelInfos.size()) 1349 return; 1350 1351 if (chanNum < 0) 1352 chanNum = 0; 1353 1354 ProgramList *proglist = NULL; 1355 if (useExistingData) 1356 proglist = CopyProglist(m_programs[row]); 1357 chanNums.push_back(chanNum); 1358 proglists.push_back(proglist); 1359 } 1360 if (allRows) 1135 1361 { 1136 delete m_programs[row]; 1137 m_programs[row] = getProgramListFromProgram(chanNum); 1362 for (unsigned int i = numRows; i < m_guideGrid->getChannelCount(); ++i) 1363 { 1364 delete m_programs[i]; 1365 m_programs[i] = NULL; 1366 m_guideGrid->ResetRow(i); 1367 } 1138 1368 } 1139 1140 ProgramList *proglist = m_programs[row]; 1141 if (!proglist) 1369 GuideStatus gs; 1370 gs.m_firstRow = firstRow; 1371 gs.m_numRows = chanNums.size(); 1372 gs.m_channums = chanNums; 1373 gs.m_currentStartChannel = m_currentStartChannel; 1374 gs.m_currentStartTime = m_currentStartTime; 1375 gs.m_currentEndTime = m_currentEndTime; 1376 gs.m_currentRow = m_currentRow; 1377 gs.m_currentCol = m_currentCol; 1378 gs.m_channelCount = m_channelCount; 1379 gs.m_timeCount = m_timeCount; 1380 gs.m_verticalLayout = m_verticalLayout; 1381 gs.m_firstTime = m_firstTime; 1382 gs.m_lastTime = m_lastTime; 1383 gs.m_channelInfos_size = m_channelInfos.size(); 1384 gs.m_gg_programRect = m_guideGrid->GetArea(); 1385 gs.m_gg_channelCount = m_guideGrid->getChannelCount(); 1386 GuideUpdateProgramRow *closure = 1387 new GuideUpdateProgramRow(this, gs, proglists); 1388 m_threadPool.start(new GuideHelper(this, closure), "GuideHelper"); 1389 } 1390 1391 void GuideUpdateProgramRow::fillProgramRowInfosWith(int row, int chanNum, QDateTime start, 1392 ProgramList *proglist) 1393 { 1394 if (row < 0 || row >= m_gs.m_channelCount || 1395 start != m_gs.m_currentStartTime) 1396 { 1397 delete proglist; 1142 1398 return; 1399 } 1143 1400 1144 QDateTime ts = m_ currentStartTime;1401 QDateTime ts = m_gs.m_currentStartTime; 1145 1402 1146 1403 QDateTime tnow = MythDate::current(); 1147 1404 int progPast = 0; 1148 if (tnow > m_ currentEndTime)1405 if (tnow > m_gs.m_currentEndTime) 1149 1406 progPast = 100; 1150 else if (tnow < m_ currentStartTime)1407 else if (tnow < m_gs.m_currentStartTime) 1151 1408 progPast = 0; 1152 1409 else 1153 1410 { 1154 int played = m_ currentStartTime.secsTo(tnow);1155 int length = m_ currentStartTime.secsTo(m_currentEndTime);1411 int played = m_gs.m_currentStartTime.secsTo(tnow); 1412 int length = m_gs.m_currentStartTime.secsTo(m_gs.m_currentEndTime); 1156 1413 if (length) 1157 1414 progPast = played * 100 / length; 1158 1415 } 1159 1416 1160 m_ guideGrid->SetProgPast(progPast);1417 m_progPast = progPast; 1161 1418 1162 1419 ProgramList::iterator program = proglist->begin(); 1163 1420 vector<ProgramInfo*> unknownlist; 1164 1421 bool unknown = false; 1165 1422 ProgramInfo *proginfo = NULL; 1166 for (int x = 0; x < m_ timeCount; ++x)1423 for (int x = 0; x < m_gs.m_timeCount; ++x) 1167 1424 { 1168 1425 if (program != proglist->end() && 1169 1426 (ts >= (*program)->GetScheduledEndTime())) … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1215 1472 for (; it != unknownlist.end(); ++it) 1216 1473 proglist->push_back(*it); 1217 1474 1218 MythRect programRect = m_g uideGrid->GetArea();1475 MythRect programRect = m_gs.m_gg_programRect; 1219 1476 1220 1477 /// use doubles to avoid large gaps at end.. 1221 1478 double ydifference = 0.0, xdifference = 0.0; 1222 1479 1223 if (m_ verticalLayout)1480 if (m_gs.m_verticalLayout) 1224 1481 { 1225 1482 ydifference = programRect.width() / 1226 (double) m_g uideGrid->getChannelCount();1483 (double) m_gs.m_gg_channelCount; 1227 1484 xdifference = programRect.height() / 1228 (double) m_ timeCount;1485 (double) m_gs.m_timeCount; 1229 1486 } 1230 1487 else 1231 1488 { 1232 1489 ydifference = programRect.height() / 1233 (double) m_g uideGrid->getChannelCount();1490 (double) m_gs.m_gg_channelCount; 1234 1491 xdifference = programRect.width() / 1235 (double) m_ timeCount;1492 (double) m_gs.m_timeCount; 1236 1493 } 1237 1494 1238 1495 int arrow = 0; … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1242 1499 QRect tempRect; 1243 1500 bool isCurrent = false; 1244 1501 1245 for (int x = 0; x < m_ timeCount; ++x)1502 for (int x = 0; x < m_gs.m_timeCount; ++x) 1246 1503 { 1247 1504 ProgramInfo *pginfo = m_programInfos[row][x]; 1248 1505 if (!pginfo) … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1252 1509 if (pginfo->GetScheduledStartTime() != lastprog) 1253 1510 { 1254 1511 arrow = 0; 1255 if (pginfo->GetScheduledStartTime() < m_ firstTime.addSecs(-300))1512 if (pginfo->GetScheduledStartTime() < m_gs.m_firstTime.addSecs(-300)) 1256 1513 arrow = arrow + 1; 1257 if (pginfo->GetScheduledEndTime() > m_ lastTime.addSecs(2100))1514 if (pginfo->GetScheduledEndTime() > m_gs.m_lastTime.addSecs(2100)) 1258 1515 arrow = arrow + 2; 1259 1516 1260 1517 if (pginfo->spread != -1) … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1263 1520 } 1264 1521 else 1265 1522 { 1266 for (int z = x + 1; z < m_ timeCount; ++z)1523 for (int z = x + 1; z < m_gs.m_timeCount; ++z) 1267 1524 { 1268 1525 ProgramInfo *test = m_programInfos[row][z]; 1269 1526 if (test && (test->GetScheduledStartTime() == … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1284 1541 } 1285 1542 } 1286 1543 1287 if (m_ verticalLayout)1544 if (m_gs.m_verticalLayout) 1288 1545 { 1289 1546 tempRect = QRect((int)(row * ydifference), 1290 1547 (int)(x * xdifference), … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1305 1562 if (tempRect.bottom() + 2 >= programRect.bottom()) 1306 1563 tempRect.setBottom(programRect.bottom()); 1307 1564 1308 if (m_ currentRow == (int)row && (m_currentCol >= x) &&1309 (m_ currentCol < (x + spread)))1565 if (m_gs.m_currentRow == (int)row && (m_gs.m_currentCol >= x) && 1566 (m_gs.m_currentCol < (x + spread))) 1310 1567 isCurrent = true; 1311 1568 else 1312 1569 isCurrent = false; … … void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) 1349 1606 recStat = 0; 1350 1607 1351 1608 QString title = (pginfo->GetTitle() == kUnknownTitle) ? 1352 1609 GuideGrid::tr("Unknown", "Unknown program title") : 1353 1610 pginfo->GetTitle(); 1354 m_ guideGrid->SetProgramInfo(1611 m_result.push_back(UIGuideElement( 1355 1612 row, cnt, tempRect, title, 1356 1613 pginfo->GetCategory(), arrow, recFlag, 1357 recStat, isCurrent) ;1614 recStat, isCurrent)); 1358 1615 1359 1616 cnt++; 1360 1617 } 1361 1618 1362 1619 lastprog = pginfo->GetScheduledStartTime(); 1363 1620 } 1621 1364 1622 } 1365 1623 1366 1624 void GuideGrid::customEvent(QEvent *event) … … void GuideGrid::customEvent(QEvent *event) 1374 1632 { 1375 1633 LoadFromScheduler(m_recList); 1376 1634 fillProgramInfos(); 1377 updateInfo();1378 1635 } 1379 1636 else if (message == "STOP_VIDEO_REFRESH_TIMER") 1380 1637 { … … void GuideGrid::customEvent(QEvent *event) 1513 1770 else 1514 1771 ScheduleCommon::customEvent(event); 1515 1772 } 1773 else if (event->type() == UpdateGuideEvent::kEventType) 1774 { 1775 UpdateGuideEvent *uge = static_cast<UpdateGuideEvent*>(event); 1776 if (uge->m_closure) 1777 { 1778 uge->m_closure->ExecuteUI(); 1779 delete uge->m_closure; 1780 uge->m_closure = NULL; 1781 } 1782 } 1516 1783 } 1517 1784 1518 1785 void GuideGrid::updateDateText(void) … … void GuideGrid::updateDateText(void) 1524 1791 (MythDate::kDateFull | MythDate::kSimplify))); 1525 1792 } 1526 1793 1794 void GuideGrid::updateProgramsUI(unsigned int firstRow, int numRows, 1795 int progPast, 1796 const QVector<ProgramList*> &proglists, 1797 const QVector<struct UIGuideElement> &elements) 1798 { 1799 for (int i = 0; i < numRows; ++i) 1800 { 1801 int row = i + firstRow; 1802 m_guideGrid->ResetRow(row); 1803 if (m_programs[row] != proglists[i]) 1804 { 1805 delete m_programs[row]; 1806 m_programs[row] = proglists[i]; 1807 } 1808 } 1809 m_guideGrid->SetProgPast(progPast); 1810 for (int i = 0; i < elements.size(); ++i) 1811 { 1812 UIGuideElement r = elements[i]; 1813 m_guideGrid->SetProgramInfo(r.m_row, r.m_col, r.m_area, r.m_title, 1814 r.m_category, r.m_arrow, r.m_recType, 1815 r.m_recStat, r.m_selected); 1816 } 1817 for (int i = firstRow; i < firstRow + numRows; ++i) 1818 { 1819 for (int j = 0; j < MAX_DISPLAY_TIMES; ++j) 1820 m_programInfos[i][j] = m_programInfos[i][j]; 1821 if (i == m_currentRow) 1822 updateInfo(); 1823 } 1824 m_guideGrid->SetRedraw(); 1825 } 1826 1527 1827 void GuideGrid::updateChannels(void) 1528 1828 { 1529 m_channelList->Reset(); 1829 m_threadPool.start(new GuideHelper(this, new GuideUpdateChannels(this, m_currentStartChannel)), 1830 "GuideHelper"); 1831 } 1530 1832 1833 void GuideGrid::updateChannelsNonUI(QVector<ChannelInfo *> &chinfos, 1834 QVector<bool> &unavailables) 1835 { 1531 1836 ChannelInfo *chinfo = GetChannelInfo(m_currentStartChannel); 1532 1837 1533 1838 if (m_player) … … void GuideGrid::updateChannels(void) 1575 1880 unavailable = (alt == m_channelInfoIdx[chanNumber]); 1576 1881 } 1577 1882 } 1883 chinfos.push_back(chinfo); 1884 unavailables.push_back(unavailable); 1885 } 1886 } 1578 1887 1888 void GuideGrid::updateChannelsUI(const QVector<ChannelInfo *> &chinfos, 1889 const QVector<bool> &unavailables) 1890 { 1891 m_channelList->Reset(); 1892 for (int i = 0; i < chinfos.size(); ++i) 1893 { 1894 ChannelInfo *chinfo = chinfos[i]; 1895 bool unavailable = unavailables[i]; 1579 1896 MythUIButtonListItem *item = 1580 1897 new MythUIButtonListItem(m_channelList, 1581 1898 chinfo ? chinfo->GetFormatted(ChannelInfo::kChannelShort) : QString()); … … void GuideGrid::updateInfo(void) 1660 1977 QString rating = QString::number(pginfo->GetStars(10)); 1661 1978 ratingState->DisplayState(rating); 1662 1979 } 1980 m_guideGrid->SetRedraw(); 1663 1981 } 1664 1982 1665 1983 void GuideGrid::toggleGuideListing() … … void GuideGrid::cursorLeft() 1809 2127 } 1810 2128 else 1811 2129 { 1812 fillProgramRowInfos(m_currentRow); 1813 m_guideGrid->SetRedraw(); 1814 updateInfo(); 2130 fillProgramRowInfos(m_currentRow, true); 1815 2131 } 1816 2132 } 1817 2133 … … void GuideGrid::cursorRight() 1837 2153 } 1838 2154 else 1839 2155 { 1840 fillProgramRowInfos(m_currentRow); 1841 m_guideGrid->SetRedraw(); 1842 updateInfo(); 2156 fillProgramRowInfos(m_currentRow, true); 1843 2157 } 1844 2158 } 1845 2159 … … void GuideGrid::cursorDown() 1854 2168 } 1855 2169 else 1856 2170 { 1857 fillProgramRowInfos(m_currentRow); 1858 m_guideGrid->SetRedraw(); 1859 updateInfo(); 1860 updateChannels(); 2171 fillProgramRowInfos(m_currentRow, true); 1861 2172 } 1862 2173 } 1863 2174 … … void GuideGrid::cursorUp() 1872 2183 } 1873 2184 else 1874 2185 { 1875 fillProgramRowInfos(m_currentRow); 1876 m_guideGrid->SetRedraw(); 1877 updateInfo(); 1878 updateChannels(); 2186 fillProgramRowInfos(m_currentRow, true); 1879 2187 } 1880 2188 } 1881 2189 … … void GuideGrid::moveLeftRight(MoveVector movement) 1907 2215 1908 2216 fillTimeInfos(); 1909 2217 fillProgramInfos(); 1910 m_guideGrid->SetRedraw();1911 updateInfo();1912 2218 updateDateText(); 1913 2219 } 1914 2220 … … void GuideGrid::moveUpDown(MoveVector movement) 1933 2239 } 1934 2240 1935 2241 fillProgramInfos(); 1936 m_guideGrid->SetRedraw();1937 updateInfo();1938 2242 updateChannels(); 1939 2243 } 1940 2244 … … void GuideGrid::moveToTime(QDateTime datetime) 1947 2251 1948 2252 fillTimeInfos(); 1949 2253 fillProgramInfos(); 1950 m_guideGrid->SetRedraw();1951 updateInfo();1952 2254 updateDateText(); 1953 2255 } 1954 2256 … … void GuideGrid::quickRecord() 2016 2318 QuickRecord(pginfo); 2017 2319 LoadFromScheduler(m_recList); 2018 2320 fillProgramInfos(); 2019 updateInfo();2020 2321 } 2021 2322 2022 2323 void GuideGrid::editRecSchedule() … … void GuideGrid::GoTo(int start, int cur_row) 2163 2464 m_currentRow = cur_row % m_channelCount; 2164 2465 updateChannels(); 2165 2466 fillProgramInfos(); 2166 updateInfo();2167 2467 updateJumpToChannel(); 2168 2468 } 2169 2469 -
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