diff -rup mythtv.old/libs/libmyth/uitypes.cpp mythtv/libs/libmyth/uitypes.cpp
old
|
new
|
|
1 | | |
2 | 1 | #include <iostream> |
3 | 2 | #include <math.h> |
4 | 3 | |
… |
… |
void UIGuideType::Draw(QPainter *dr, int |
613 | 612 | { |
614 | 613 | for (data = allData[i].first(); data; data = allData[i].next()) |
615 | 614 | { |
616 | | if (data->recStat == 0) |
| 615 | if (data->unavStat && (data->recStat != 1)) |
| 616 | drawBox(dr, data, unavcolor); |
| 617 | else if (data->recStat == 0) |
617 | 618 | drawBackground(dr, data); |
618 | 619 | else if (data->recStat == 1) |
619 | 620 | drawBox(dr, data, reccolor); |
… |
… |
void UIGuideType::drawText(QPainter *dr, |
842 | 843 | |
843 | 844 | void UIGuideType::SetProgramInfo(int row, int col, const QRect &area, |
844 | 845 | const QString &title, const QString &genre, |
845 | | int arrow, int recType, int recStat, |
| 846 | int arrow, int recType, int recStat, bool unavStat, |
846 | 847 | bool selected) |
847 | 848 | { |
848 | 849 | (void)col; |
849 | | UIGTCon *data = new UIGTCon(area, title, genre, arrow, recType, recStat); |
| 850 | UIGTCon *data = new UIGTCon(area, title, genre, arrow, recType, recStat, unavStat); |
850 | 851 | |
851 | 852 | allData[row].append(data); |
852 | 853 | |
853 | 854 | if (drawCategoryColors) |
854 | 855 | { |
855 | 856 | data->categoryColor = categoryColors[data->category.lower()]; |
| 857 | |
856 | 858 | if (!data->categoryColor.isValid()) |
857 | 859 | data->categoryColor = categoryColors["none"]; |
858 | 860 | } |
diff -rup mythtv.old/libs/libmyth/uitypes.h mythtv/libs/libmyth/uitypes.h
old
|
new
|
class MPUBLIC UIGuideType : public UITyp |
232 | 232 | UIGuideType(const QString &name, int order); |
233 | 233 | ~UIGuideType(); |
234 | 234 | |
235 | | enum FillType { Alpha = 10, Dense, Eco, Solid }; |
| 235 | enum FillType { Alpha = 10, Dense, Eco, Solid, Unavailable }; |
236 | 236 | |
237 | 237 | void Draw(QPainter *dr, int drawlayer, int context); |
238 | 238 | |
… |
… |
class MPUBLIC UIGuideType : public UITyp |
246 | 246 | void SetNumRows(int numRows) { this->numRows = numRows; } |
247 | 247 | void SetWindow(MythDialog *win) { window = win; } |
248 | 248 | |
249 | | void SetRecordingColors(const QString &reccol, const QString &concol) |
250 | | { reccolor = QColor(reccol); concolor = QColor(concol); } |
| 249 | void SetRecordingColors(const QString &reccol, const QString &concol, |
| 250 | const QString &unavcol) |
| 251 | { reccolor = QColor(reccol); concolor = QColor(concol); |
| 252 | unavcolor = QColor(unavcol); } |
251 | 253 | void SetSelectorColor(const QString &col) { selcolor = QColor(col); } |
252 | 254 | void SetSolidColor(const QString &col) { solidcolor = QColor(col); } |
253 | 255 | void SetCategoryColors(const QMap<QString, QString> &catColors); |
… |
… |
class MPUBLIC UIGuideType : public UITyp |
259 | 261 | void LoadImage(int, const QString &file); |
260 | 262 | void SetProgramInfo(int row, int col, const QRect &area, |
261 | 263 | const QString &title, const QString &category, |
262 | | int arrow, int recType, int recStat, bool selected); |
| 264 | int arrow, int recType, int recStat, bool unavStat, |
| 265 | bool selected); |
263 | 266 | void ResetData(); |
264 | 267 | void ResetRow(int row); |
265 | 268 | void SetProgPast(int ppast); |
… |
… |
class MPUBLIC UIGuideType : public UITyp |
269 | 272 | class UIGTCon |
270 | 273 | { |
271 | 274 | public: |
272 | | UIGTCon() { arrow = recType = recStat = 0; }; |
| 275 | UIGTCon() { arrow = recType = recStat = 0; unavStat = false; }; |
273 | 276 | UIGTCon(const QRect &drawArea, const QString &title, |
274 | | const QString &category, int arrow, int recType, int recStat) |
| 277 | const QString &category, int arrow, int recType, |
| 278 | int recStat, bool unavStat) |
275 | 279 | { |
276 | 280 | this->drawArea = drawArea; |
277 | 281 | this->title = title; |
… |
… |
class MPUBLIC UIGuideType : public UITyp |
279 | 283 | this->arrow = arrow; |
280 | 284 | this->recType = recType; |
281 | 285 | this->recStat = recStat; |
| 286 | this->unavStat = unavStat; |
282 | 287 | } |
283 | 288 | |
284 | 289 | UIGTCon(const UIGTCon &o) |
… |
… |
class MPUBLIC UIGuideType : public UITyp |
290 | 295 | arrow = o.arrow; |
291 | 296 | recType = o.recType; |
292 | 297 | recStat = o.recStat; |
| 298 | unavStat = o.unavStat; |
293 | 299 | } |
294 | 300 | |
295 | 301 | QRect drawArea; |
… |
… |
class MPUBLIC UIGuideType : public UITyp |
299 | 305 | int arrow; |
300 | 306 | int recType; |
301 | 307 | int recStat; |
| 308 | bool unavStat; |
302 | 309 | }; |
303 | 310 | |
304 | 311 | void drawBackground(QPainter *dr, UIGTCon *data); |
… |
… |
class MPUBLIC UIGuideType : public UITyp |
331 | 338 | |
332 | 339 | QColor reccolor; |
333 | 340 | QColor concolor; |
| 341 | QColor unavcolor; |
334 | 342 | |
335 | 343 | int filltype; |
336 | 344 | bool cutdown; |
diff -rup mythtv.old/libs/libmyth/xmlparse.cpp mythtv/libs/libmyth/xmlparse.cpp
old
|
new
|
void XMLParse::parseGuideGrid(LayerSet * |
725 | 725 | QString selcolor = ""; |
726 | 726 | QString reccolor = ""; |
727 | 727 | QString concolor = ""; |
| 728 | QString unavcolor = ""; |
728 | 729 | QRect area; |
729 | 730 | QPoint textoff = QPoint(0, 0); |
730 | 731 | bool cutdown = true; |
… |
… |
void XMLParse::parseGuideGrid(LayerSet * |
799 | 800 | { |
800 | 801 | concolor = getFirstText(info); |
801 | 802 | } |
| 803 | else if (info.tagName() == "unavailablecolor") |
| 804 | { |
| 805 | unavcolor = getFirstText(info); |
| 806 | } |
802 | 807 | else if (info.tagName() == "multiline") |
803 | 808 | { |
804 | 809 | if (getFirstText(info).lower() == "yes") |
… |
… |
void XMLParse::parseGuideGrid(LayerSet * |
884 | 889 | guide->SetTextOffset(textoff); |
885 | 890 | if (concolor == "") |
886 | 891 | concolor = reccolor; |
887 | | guide->SetRecordingColors(reccolor, concolor); |
| 892 | guide->SetRecordingColors(reccolor, concolor, unavcolor); |
888 | 893 | guide->SetSelectorColor(selcolor); |
889 | 894 | for (int i = 1; i <= 7; i++) |
890 | 895 | guide->LoadImage(i, recImgs[i]); |
diff -rup mythtv.old/libs/libmythtv/guidegrid.cpp mythtv/libs/libmythtv/guidegrid.cpp
old
|
new
|
void GuideGrid::fillProgramRowInfos(unsi |
1054 | 1054 | QRect tempRect; |
1055 | 1055 | bool isCurrent = false; |
1056 | 1056 | |
| 1057 | bool channelsChanged = false; |
| 1058 | |
| 1059 | uint chanNumber = row + m_currentStartChannel; |
| 1060 | if (chanNumber >= m_channelInfos.size()) |
| 1061 | chanNumber -= m_channelInfos.size(); |
| 1062 | |
| 1063 | PixmapChannel *chinfo = GetChannelInfo(chanNumber); |
| 1064 | |
| 1065 | bool unavStat = isUnavailable(chinfo->chanid, chanNumber, channelsChanged); |
| 1066 | |
1057 | 1067 | for (int x = 0; x < DISPLAY_TIMES; x++) |
1058 | 1068 | { |
1059 | 1069 | proginfo = m_programInfos[row][x]; |
… |
… |
void GuideGrid::fillProgramRowInfos(unsi |
1150 | 1160 | |
1151 | 1161 | type->SetProgramInfo(row, cnt, tempRect, proginfo->title, |
1152 | 1162 | proginfo->category, arrow, recFlag, |
1153 | | recStat, isCurrent); |
| 1163 | recStat, unavStat, isCurrent); |
1154 | 1164 | |
1155 | 1165 | cnt++; |
1156 | 1166 | } |
… |
… |
void GuideGrid::paintEvent(QPaintEvent * |
1185 | 1195 | |
1186 | 1196 | if (r.intersects(channelRect) && paintChannels(&p)) |
1187 | 1197 | { |
| 1198 | chan_unavailable.clear(); |
1188 | 1199 | fillProgramInfos(); |
1189 | 1200 | update(programRect|curInfoRect|r); |
1190 | 1201 | qApp->unlock(); |
… |
… |
bool GuideGrid::paintChannels(QPainter * |
1328 | 1339 | UIImageType *itype = NULL; |
1329 | 1340 | container = theme->GetSet("chanbar"); |
1330 | 1341 | infocontainer = theme->GetSet("program_info"); |
| 1342 | |
1331 | 1343 | if (container) |
1332 | 1344 | type = (UIBarType *)container->GetType("chans"); |
1333 | 1345 | if (infocontainer) |
… |
… |
bool GuideGrid::paintChannels(QPainter * |
1346 | 1358 | if (chanNumber >= m_channelInfos.size()) |
1347 | 1359 | chanNumber -= m_channelInfos.size(); |
1348 | 1360 | if (chanNumber >= m_channelInfos.size()) |
1349 | | break; |
| 1361 | break; |
1350 | 1362 | |
1351 | 1363 | chinfo = GetChannelInfo(chanNumber); |
1352 | 1364 | |
1353 | | bool unavailable = false; |
1354 | | if (m_player && !m_player->IsTunable(chinfo->chanid, true)) |
1355 | | { |
1356 | | unavailable = true; |
| 1365 | bool unavailable = isUnavailable(chinfo->chanid, chanNumber, channelsChanged); |
1357 | 1366 | |
1358 | | // Try alternates with same channum if applicable |
1359 | | uint alt = GetAlternateChannelIndex(chanNumber, true); |
1360 | | if (alt != m_channelInfoIdx[chanNumber]) |
1361 | | { |
1362 | | unavailable = false; |
1363 | | m_channelInfoIdx[chanNumber] = alt; |
1364 | | chinfo = GetChannelInfo(chanNumber); |
1365 | | channelsChanged = true; |
1366 | | } |
| 1367 | if (channelsChanged) |
| 1368 | chinfo = GetChannelInfo(chanNumber); |
1367 | 1369 | |
1368 | | // Try alternates with different channum if applicable |
1369 | | if (unavailable && GetProgramList(chinfo->chanid).count()) |
1370 | | { |
1371 | | alt = GetAlternateChannelIndex(chanNumber, false); |
1372 | | unavailable = (alt == m_channelInfoIdx[chanNumber]); |
1373 | | } |
1374 | | } |
| 1370 | if (!chinfo || (chanNumber >= m_channelInfos.size())) |
| 1371 | break; |
1375 | 1372 | |
1376 | 1373 | if ((y == (unsigned int)2 && scrolltype != 1) || |
1377 | 1374 | ((signed int)y == m_currentRow && scrolltype == 1)) |
… |
… |
void GuideGrid::paintInfo(QPainter *p) |
1566 | 1563 | p->drawPixmap(pr.topLeft(), pix); |
1567 | 1564 | } |
1568 | 1565 | |
| 1566 | bool GuideGrid::isUnavailable(uint chanid, uint chanNumber, bool &channelsChanged) |
| 1567 | { |
| 1568 | if (chan_unavailable.contains(chanNumber)) |
| 1569 | return chan_unavailable[chanNumber]; |
| 1570 | |
| 1571 | bool unavailable = false; |
| 1572 | if (m_player && !m_player->IsTunable(chanid, true)) |
| 1573 | { |
| 1574 | unavailable = true; |
| 1575 | |
| 1576 | // Try alternates with same channum if applicable |
| 1577 | uint alt = GetAlternateChannelIndex(chanNumber, true); |
| 1578 | if (alt != m_channelInfoIdx[chanNumber]) |
| 1579 | { |
| 1580 | unavailable = false; |
| 1581 | m_channelInfoIdx[chanNumber] = alt; |
| 1582 | channelsChanged = true; |
| 1583 | } |
| 1584 | |
| 1585 | // Try alternates with different channum if applicable |
| 1586 | if (unavailable && GetProgramList(chanid).count()) |
| 1587 | { |
| 1588 | alt = GetAlternateChannelIndex(chanNumber, false); |
| 1589 | unavailable = (alt == m_channelInfoIdx[chanNumber]); |
| 1590 | } |
| 1591 | } |
| 1592 | |
| 1593 | chan_unavailable[chanNumber] = unavailable; |
| 1594 | |
| 1595 | return unavailable; |
| 1596 | } |
| 1597 | |
1569 | 1598 | void GuideGrid::toggleGuideListing() |
1570 | 1599 | { |
1571 | 1600 | showFavorites = (!showFavorites); |
… |
… |
void GuideGrid::showProgFinder() |
1900 | 1929 | |
1901 | 1930 | void GuideGrid::enter() |
1902 | 1931 | { |
| 1932 | bool channelsChanged = false; |
| 1933 | |
| 1934 | uint chanNumber = m_currentRow + m_currentStartChannel; |
| 1935 | if (chanNumber >= m_channelInfos.size()) |
| 1936 | chanNumber -= m_channelInfos.size(); |
| 1937 | |
| 1938 | PixmapChannel *chinfo = GetChannelInfo(chanNumber); |
| 1939 | |
| 1940 | if (isUnavailable(chinfo->chanid, chanNumber, channelsChanged)) |
| 1941 | return; |
| 1942 | |
1903 | 1943 | if (timeCheck) |
1904 | 1944 | { |
1905 | 1945 | timeCheck->stop(); |
diff -rup mythtv.old/libs/libmythtv/guidegrid.h mythtv/libs/libmythtv/guidegrid.h
old
|
new
|
class MPUBLIC GuideGrid : public MythDia |
109 | 109 | void paintPrograms(QPainter *); |
110 | 110 | void paintCurrentInfo(QPainter *); |
111 | 111 | void paintInfo(QPainter *); |
| 112 | |
| 113 | bool isUnavailable(uint chanid, uint chanNumber, bool &channelsChanged); |
112 | 114 | |
113 | 115 | void resizeImage(QPixmap *, QString); |
114 | 116 | void LoadWindow(QDomElement &); |
… |
… |
class MPUBLIC GuideGrid : public MythDia |
211 | 213 | bool jumpToChannelActive; |
212 | 214 | bool jumpToChannelHasRect; |
213 | 215 | QTimer *jumpToChannelTimer; |
| 216 | |
| 217 | QMap<uint,bool> chan_unavailable; |
214 | 218 | }; |
215 | 219 | |
216 | 220 | #endif |