7#include <QCoreApplication>
50#define LOC QString("GuideGrid: ")
51#define LOC_ERR QString("GuideGrid, Error: ")
52#define LOC_WARN QString("GuideGrid, Warning: ")
56static constexpr std::chrono::milliseconds
kUpdateMS { 60s };
61static constexpr int64_t
kOneDay { 24 * 60LL * 60 };
66 int start_chan_idx,
int cur_chan_idx,
uint rows_disp) :
68 m_entry(std::move(start_entry)),
69 m_previousStartChannelIndex(start_chan_idx),
70 m_previousCurrentChannelIndex(cur_chan_idx),
71 m_rowsDisplayed(rows_disp),
72 m_timer(new QTimer(this))
97 QObject::deleteLater();
103 QStringList::const_iterator it;
104 for (it = actions.begin(); it != actions.end(); ++it)
140 QString txt = e->text();
151 if (!
m_entry.isEmpty() && (txt==
"_" || txt==
"-" || txt==
"#" || txt==
"."))
193 QVector<int> channums,
196 QDateTime currentStartTime,
197 QDateTime currentEndTime,
198 uint currentStartChannel,
199 int currentRow,
int currentCol,
200 int channelCount,
int timeCount,
202 QDateTime firstTime, QDateTime lastTime)
246 QVector<ProgramList*> proglists)
276 for (
unsigned int i = 0; i <
m_numRows; ++i)
351 (QEvent::Type) QEvent::registerEventType();
359 QMutexLocker locker(&
s_lock);
364 QThread::currentThread()->setPriority(QThread::IdlePriority);
369 QCoreApplication::postEvent(
m_guide,
379 QMutexLocker locker(&
s_lock);
386 QMutexLocker locker(&
s_lock);
391 QMutexLocker locker(&
s_lock);
394 if (!
s_wait.wait(locker.mutex(), 15000UL))
411 const QDateTime &startTime,
412 TV *player,
bool embedVideo,
413 bool allowFinder,
int changrpid)
421 0,
true,
"", (changrpid<0) ? 0 : changrpid);
424 if (channels.empty() && changrpid != -1)
426 LOG(VB_GENERAL, LOG_WARNING,
LOC +
427 QString(
"Channelgroup '%1' is empty, changing to 'All Programs'")
433 if (channels.empty())
438 message = tr(
"You don't have any channels defined in the database."
439 "\n\t\t\tThe program guide will have nothing to show you.");
443 message = tr(
"Channel group '%1' doesn't have any channels defined."
444 "\n\t\t\tThe program guide will have nothing to show you.")
448 LOG(VB_GENERAL, LOG_WARNING,
LOC + message);
452 else if (allowFinder)
461 QString actualChannum = channum;
462 if (chanid == 0 && actualChannum.isEmpty())
466 chanid = defaultChanid;
468 if (chanid == 0 && actualChannum.isEmpty())
471 if (!inputIDs.empty())
476 auto *gg =
new GuideGrid(mainStack, chanid, actualChannum, startTime,
477 player, embedVideo, allowFinder, changrpid);
480 mainStack->
AddScreen(gg, (player ==
nullptr));
486 uint chanid, QString channum,
const QDateTime &startTime,
487 TV *player,
bool embedVideo,
488 bool allowFinder,
int changrpid)
490 m_selectRecThreshold(
gCoreContext->GetDurSetting<std::chrono::minutes>(
"SelChangeRecThreshold", 16min)),
491 m_allowFinder(allowFinder),
492 m_startChanID(chanid),
493 m_startChanNum(std::move(channum)),
496 m_embedVideo(embedVideo),
497 m_channelOrdering(
gCoreContext->GetSetting(
"ChannelOrdering",
"channum")),
498 m_updateTimer(new QTimer(this)),
499 m_threadPool(
"GuideGridHelperPool"),
500 m_changrpid(changrpid),
509 if (startTime.isValid() &&
540 QString windowName =
"programguide";
543 windowName =
"programguide-video";
560 LOG(VB_GENERAL, LOG_ERR,
561 QString(
"Cannot load screen '%1'").arg(windowName));
600 chanNum = std::max(chanNum, 0);
675 if (!actions.empty())
681 const QString& chanNum = actions[0];
683 (void)chanNum.toInt(&isNum);
705 for (
int i = 0; i < actions.size() && !handled; ++i)
707 const QString&
action = actions[i];
737 else if (
action ==
"PAGEUP")
744 else if (
action ==
"PAGEDOWN")
773 else if (
action ==
"NEXTFAV")
785 else if (
action ==
"MENU")
797 auto secsTillStart = pginfo
823 else if (
action ==
"EDIT")
827 else if (
action ==
"CUSTOMEDIT")
831 else if (
action ==
"DELETE")
835 else if (
action ==
"UPCOMING")
839 else if (
action ==
"PREVRECORDED")
858 else if (
action ==
"CHANUPDATE")
870 else if (
action ==
"CYCLEAUDIOCHAN")
902 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Guide Gesture no event");
906 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture event %1")
915 QPoint position =
event->GetPosition();
928 QString name =
object->objectName();
929 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click name %1").arg(name));
931 if (name.startsWith(
"channellist"))
933 auto* channelList = qobject_cast<MythUIButtonList*>(
object);
937 handled = channelList->gestureEvent(event);
938 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click channel list %1").arg(handled));
941 else if (name.startsWith(
"guidegrid"))
943 auto* guidegrid = qobject_cast<MythUIGuideGrid*>(
object);
949 QPoint rowCol = guidegrid->GetRowAndColumn(position - guidegrid->GetArea().topLeft());
951 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click gg %1,%2 (%3,%4)")
957 if ((rowCol.y() >= 0) && (rowCol.x() >= 0))
968 auto secsTillStart = pginfo
974 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click gg EditRec"));
978 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click gg enter"));
985 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click gg not live"));
1098 return std::ranges::any_of(selection,
1099 [selection](
const auto & chan){
return TV::IsTunable(chan.m_chanId); } );
1104 QString label = tr(
"Guide Options");
1107 auto *menuPopup =
new MythDialogBox(label, popupStack,
"guideMenuPopup");
1109 if (menuPopup->Create())
1111 menuPopup->SetReturnEvent(
this,
"guidemenu");
1114 menuPopup->AddButton(tr(
"Change to Channel"));
1116 menuPopup->AddButton(tr(
"Watch This Channel"));
1118 menuPopup->AddButton(tr(
"Record This"));
1120 menuPopup->AddButton(tr(
"Recording Options"),
nullptr,
true);
1122 menuPopup->AddButton(tr(
"Program Details"));
1124 menuPopup->AddButton(tr(
"Jump to Time"),
nullptr,
true);
1126 menuPopup->AddButton(tr(
"Reverse Channel Order"));
1128 menuPopup->AddButton(tr(
"Channel Search"));
1132 menuPopup->AddButton(tr(
"Choose Channel Group"));
1135 menuPopup->AddButton(tr(
"Add To Channel Group"),
nullptr,
true);
1137 menuPopup->AddButton(tr(
"Remove from Channel Group"));
1150 QString label = tr(
"Recording Options");
1153 auto *menuPopup =
new MythDialogBox(label, popupStack,
"recMenuPopup");
1155 if (menuPopup->Create())
1157 menuPopup->SetReturnEvent(
this,
"recmenu");
1162 menuPopup->AddButton(tr(
"Edit Recording Status"));
1163 menuPopup->AddButton(tr(
"Edit Schedule"));
1164 menuPopup->AddButton(tr(
"Show Upcoming"));
1165 menuPopup->AddButton(tr(
"Previously Recorded"));
1166 menuPopup->AddButton(tr(
"Custom Edit"));
1169 menuPopup->AddButton(tr(
"Delete Rule"));
1194 return ((
GuideGrid*)
this)->GetChannelInfo(chan_idx, sel);
1217 "WHERE program.chanid = :CHANID AND "
1218 " program.endtime >= :STARTTS AND "
1219 " program.starttime <= :ENDTS AND "
1220 " program.starttime >= :STARTLIMITTS AND "
1221 " program.manualid = 0 ";
1223 bindings[
":STARTTS"] = starttime;
1224 bindings[
":STARTLIMITTS"] = starttime.addDays(-1);
1226 bindings[
":CHANID"] = chanid;
1240 for (
auto & pi : *proglist)
1246 uint chan_idx,
bool with_same_channum)
const
1255 for (
uint i = 0; i < cnt; ++i)
1266 if (with_same_channum != same_channum)
1272 if (with_same_channum)
1281 if (proglist.
empty() ||
1282 proglist.
size() != ch_proglist.
size())
1286 for (
size_t j = 0; j < proglist.
size(); ++j)
1288 isAlt &= proglist[j]->IsSameTitleTimeslotAndChannel(*ch_proglist[j]);
1304static constexpr uint64_t
MKKEY(uint64_t IDX, uint64_t
SEL)
1305 {
return (IDX << 32) | SEL; }
1317 std::vector<uint64_t> sel;
1318 sel.push_back(
MKKEY(idx, si) );
1324 selected.push_back(*ch);
1330 if (proglist.
empty())
1336 if (ci && (i != si) &&
1339 sel.push_back(
MKKEY(idx, i) );
1346 if (ci && (i != si) &&
1349 sel.push_back(
MKKEY(idx, i) );
1358 sel.push_back(
MKKEY(idx, i) );
1362 for (
size_t i = 1; i < sel.size(); ++i)
1367 if (!ci || proglist.
size() != ch_proglist.
size())
1371 for (
size_t j = 0; j < proglist.
size(); ++j)
1373 isAlt &= proglist[j]->IsSameTitleTimeslotAndChannel(*ch_proglist[j]);
1406 using uint_list_t = std::vector<unsigned int>;
1407 QMap<QString,uint_list_t> channum_to_index_map;
1408 QMap<QString,uint_list_t> callsign_to_index_map;
1410 for (
size_t i = 0; i < channels.size(); ++i)
1415 chan = channels.size() - i - 1;
1418 bool ndup = !channum_to_index_map[channels[chan].m_chanNum].empty();
1419 bool cdup = !callsign_to_index_map[channels[chan].m_callSign].empty();
1436 for (
auto & channel : channels)
1438 const uint_list_t &ndups = channum_to_index_map[channel.m_chanNum];
1439 for (
unsigned int ndup : ndups)
1446 const uint_list_t &cdups = callsign_to_index_map[channel.m_callSign];
1447 for (
unsigned int cdup : cdups)
1454 if (gotostartchannel)
1462 LOG(VB_GENERAL, LOG_ERR,
"GuideGrid: "
1463 "\n\t\t\tYou don't have any channels defined in the database."
1464 "\n\t\t\tGuide grid will have nothing to show you.");
1509 if (exact || channum.isEmpty())
1513 QVector<int> idxList;
1519 idxList.push_back(i);
1524 result = idxList[result];
1539 int mins = starttime.time().minute();
1540 mins = 5 * (mins / 5);
1546 infomap[
"starttime"] = timeStr;
1554 item->SetTextFromMap(infomap);
1574 QString querystr =
"WHERE program.chanid = :CHANID "
1575 " AND program.endtime >= :STARTTS "
1576 " AND program.starttime <= :ENDTS "
1577 " AND program.starttime >= :STARTLIMITTS "
1578 " AND program.manualid = 0 ";
1581 bindings[
":STARTTS"] = starttime;
1582 bindings[
":STARTLIMITTS"] = starttime.addDays(-1);
1594 bool allRows =
false;
1595 unsigned int numRows = 1;
1603 QVector<int> chanNums;
1604 QVector<ProgramList*> proglists;
1606 for (
unsigned int i = 0; i < numRows; ++i)
1608 unsigned int row = i + firstRow;
1627 chanNum = std::max(chanNum, 0);
1630 if (useExistingData)
1632 chanNums.push_back(chanNum);
1633 proglists.push_back(proglist);
1637 for (
unsigned int i = numRows;
1648 GuideStatus gs(firstRow, chanNums.size(), chanNums,
1659 const QDateTime& start,
1686 progPast = played * 100 / length;
1691 auto program = proglist->
begin();
1692 std::vector<ProgramInfo*> unknownlist;
1694 bool unknown =
false;
1698 if (program != proglist->
end() &&
1699 (ts >= (*program)->GetScheduledEndTime()))
1704 if ((program == proglist->
end()) ||
1705 (ts < (*program)->GetScheduledStartTime()))
1718 GuideGrid::tr(
"Unknown",
"Unknown program title"),
1720 unknownlist.push_back(proginfo);
1728 if (proginfo && proginfo == *program)
1734 proginfo = *program;
1748 for (
auto & pi : unknownlist)
1754 double ydifference = 0.0;
1755 double xdifference = 0.0;
1759 ydifference = programRect.width() /
1761 xdifference = programRect.height() /
1766 ydifference = programRect.height() /
1768 xdifference = programRect.width() /
1777 bool isCurrent =
false;
1810 for (
int z = x + 1; z < x + spread; ++z)
1823 tempRect = QRect((
int)(row * ydifference),
1824 (
int)(x * xdifference),
1826 (
int)(xdifference * pginfo->
m_spread));
1830 tempRect = QRect((
int)(x * xdifference),
1831 (
int)(row * ydifference),
1832 (
int)(xdifference * pginfo->
m_spread),
1837 if (tempRect.right() + 2 >= programRect.width())
1838 tempRect.setRight(programRect.width());
1839 if (tempRect.bottom() + 2 >= programRect.bottom())
1840 tempRect.setBottom(programRect.bottom());
1883 GuideGrid::tr(
"Unknown",
"Unknown program title") :
1886 row, cnt, tempRect, title,
1888 recStat, isCurrent);
1901 auto *me =
dynamic_cast<MythEvent *
>(event);
1905 const QString& message = me->
Message();
1907 if (message ==
"SCHEDULE_CHANGE")
1918 QString resultid = dce->GetId();
1919 QString resulttext = dce->GetResultText();
1920 int buttonnum = dce->GetResult();
1922 if (resultid ==
"deleterule")
1927 if ((buttonnum > 0) && !record->Delete())
1928 LOG(VB_GENERAL, LOG_ERR,
"Failed to delete recording rule");
1934 else if (resulttext == tr(
"Watch This Channel"))
1940 else if (resultid ==
"guidemenu")
1942 if (resulttext == tr(
"Record This"))
1946 else if (resulttext == tr(
"Change to Channel"))
1950 else if (resulttext == tr(
"Program Details"))
1954 else if (resulttext == tr(
"Reverse Channel Order"))
1960 else if (resulttext == tr(
"Channel Search"))
1964 else if (resulttext == tr(
"Add To Channel Group"))
1969 else if (resulttext == tr(
"Remove from Channel Group"))
1973 else if (resulttext == tr(
"Choose Channel Group"))
1977 else if (resulttext == tr(
"Recording Options"))
1981 else if (resulttext == tr(
"Jump to Time"))
1986 else if (resultid ==
"recmenu")
1988 if (resulttext == tr(
"Edit Recording Status"))
1992 else if (resulttext == tr(
"Edit Schedule"))
1996 else if (resulttext == tr(
"Show Upcoming"))
2000 else if (resulttext == tr(
"Previously Recorded"))
2004 else if (resulttext == tr(
"Custom Edit"))
2008 else if (resulttext == tr(
"Delete Rule"))
2014 else if (resultid ==
"channelgrouptogglemenu")
2018 if (changroupid > 0)
2021 else if (resultid ==
"channelgroupmenu")
2025 int changroupid = -1;
2027 if (resulttext == QObject::tr(
"All Channels"))
2037 QString changrpname;
2049 LOG(VB_GENERAL, LOG_INFO,
LOC +
2050 QString(
"Change active channel group to %1 %2")
2055 else if (resultid ==
"jumptotime")
2057 QDateTime datetime = dce->GetData().toDateTime();
2068 if (uge && uge->m_updater)
2071 delete uge->m_updater;
2072 uge->m_updater =
nullptr;
2088 const QVector<ProgramList*> &proglists,
2090 const std::list<GuideUIElement> &elements)
2092 for (
unsigned int i = 0; i < numRows; ++i)
2094 unsigned int row = i + firstRow;
2103 for (
const auto & r : elements)
2106 r.m_category, r.m_arrow, r.m_recType,
2107 r.m_recStat, r.m_selected);
2109 for (
unsigned int i = firstRow; i < firstRow + numRows; ++i)
2126 QVector<bool> &unavailables)
2130 for (
unsigned int y = 0; (y < (
unsigned int)
m_channelCount) && chinfo; ++y)
2140 bool unavailable =
false;
2141 bool try_alt =
false;
2160 unavailable =
false;
2166 if (unavailable && chinfo &&
2173 chinfos.push_back(chinfo);
2174 unavailables.push_back(unavailable);
2179 const QVector<bool> &unavailables)
2182 for (
int i = 0; i < chinfos.size(); ++i)
2185 bool unavailable = unavailables[i];
2189 QString state =
"available";
2191 state = (
m_changrpid == -1) ?
"unavailable" :
"favunavailable";
2193 state = (
m_changrpid == -1) ?
"available" :
"favourite";
2195 item->SetFontState(state);
2196 item->DisplayState(state,
"chanstatus");
2201 chinfo->
ToMap(infomap);
2202 item->SetTextFromMap(infomap);
2204 if (!chinfo->
m_icon.isEmpty())
2209 item->SetImage(iconurl,
"channelicon");
2232 chanNum = std::max(chanNum, 0);
2239 if (!chinfo->
m_icon.isEmpty())
2249 chinfo->
ToMap(infoMap);
2250 pginfo->
ToMap(infoMap);
2256 infoMap[
"title"] = tr(
"Unknown",
"Unknown program title");
2257 infoMap[
"titlesubtitle"] = tr(
"Unknown",
"Unknown program title");
2315 if (channels.empty())
2317 QString message = tr(
"You don't have any channel groups defined");
2322 if (okPopup->Create())
2330 QString label = tr(
"Select Channel Group");
2333 auto *menuPopup =
new MythDialogBox(label, popupStack,
"menuPopup");
2335 if (menuPopup->Create())
2337 if (mode == 0 || mode == 2)
2340 menuPopup->SetReturnEvent(
this,
"channelgrouptogglemenu");
2345 menuPopup->SetReturnEvent(
this,
"channelgroupmenu");
2346 menuPopup->AddButton(QObject::tr(
"All Channels"));
2349 for (
auto & channel : channels)
2351 menuPopup->AddButton(channel.m_name);
2379 chanNum = std::max(chanNum, 0);
2545 if (!datetime.isValid())
2557 if (newStartChannel < 0)
2612 if (!record->LoadByProgram(pginfo))
2618 QString message = tr(
"Delete '%1' %2 rule?")
2625 okPopup->SetReturnEvent(
this,
"deleterule");
2626 okPopup->SetData(QVariant::fromValue(record));
2628 if (okPopup->Create())
2696 QRegion r1 = QRegion(
m_area);
2719 QString message = tr(
"Jump to a specific date and time in the guide");
2726 if (timedlg->Create())
2728 timedlg->SetReturnEvent(
this,
"jumptotime");
2737#include "moc_guidegrid.cpp"
std::vector< ChannelGroupItem > ChannelGroupList
std::vector< ChannelInfo > ChannelInfoList
static QString GetStartChannel(uint inputid)
static bool NotInChannelGroupList(const ChannelGroupList &groupList, int grpid)
static bool InChannelGroupList(const ChannelGroupList &groupList, int grpid)
static QString GetChannelGroupName(int grpid)
static int GetNextChannelGroup(const ChannelGroupList &sorted, int grpid)
static ChannelGroupList GetChannelGroups(bool includeEmpty=true)
static bool ToggleChannel(uint chanid, int changrpid, bool delete_chan)
static ChannelGroupList GetManualChannelGroups(bool includeEmpty=true)
static int GetChannelGroupId(const QString &changroupname)
void ToMap(InfoMap &infoMap)
QString GetFormatted(ChannelFormat format) const
static int GetNearestChannel(const ChannelInfoList &list, const QString &channum)
static ChannelInfoList LoadChannels(uint startIndex, uint count, uint &totalAvailable, bool ignoreHidden=true, OrderBy orderBy=kChanOrderByChanNum, GroupBy groupBy=kChanGroupByChanid, uint sourceID=0, uint channelGroupID=0, bool liveTVOnly=false, const QString &callsign="", const QString &channum="", bool ignoreUntunable=true)
Load channels from database into a list of ChannelInfo objects.
static ChannelInfoList GetChannels(uint sourceid, bool visible_only, const QString &group_by=QString(), uint channel_groupid=0)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static const Type kEventType
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
void moveToTime(const QDateTime &datetime)
void moveUpDown(MoveVector movement)
MythUIText * m_jumpToText
ChannelGroupList m_changrplist
db_chan_list_list_t m_channelInfos
ProgInfoGuideArray m_programInfos
void PlayerExiting(TV *Player)
MythUIImage * m_channelImage
MythUIButtonList * m_channelList
void GoTo(int start, int cur_row) override
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
MythUIButtonList * m_timeList
ChannelGroupList m_channelGroupListManual
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
ProgramList GetProgramList(uint chanid) const
ProgramList * getProgramListFromProgram(int chanNum)
void updateChannelsUI(const QVector< ChannelInfo * > &chinfos, const QVector< bool > &unavailables)
QRecursiveMutex m_jumpToChannelLock
QDateTime GetCurrentStartTime(void) const
void ShowMenu(void) override
MythUIText * m_changroupname
int GetStartChannelOffset(int row=-1) const
void updateChannelsNonUI(QVector< ChannelInfo * > &chinfos, QVector< bool > &unavailables)
void updateProgramsUI(unsigned int firstRow, unsigned int numRows, int progPast, const QVector< ProgramList * > &proglists, const ProgInfoGuideArray &programInfos, const std::list< GuideUIElement > &elements)
void setStartChannel(int newStartChannel)
QMap< uint, uint > m_channelInfoIdx
void SetJumpToChannel(JumpToChannel *ptr) override
JumpToChannel * m_jumpToChannel
uint GetCurrentStartChannel(void) const
uint m_currentStartChannel
bool Create(void) override
std::vector< ProgramList * > m_programs
int FindChannel(uint chanid, const QString &channum, bool exact=true) const override
void updateJumpToChannel(void)
void updateChannels(void)
GuideGrid(MythScreenStack *parentStack, uint chanid, QString channum, const QDateTime &startTime, TV *player=nullptr, bool embedVideo=false, bool allowFinder=true, int changrpid=-1)
QString m_channelOrdering
void aboutToShow() override
uint GetChannelCount(void) const
void fillChannelInfos(bool gotostartchannel=true)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
ChannelInfo * GetChannelInfo(uint chan_idx, int sel=-1)
void toggleGuideListing()
void ToggleMute(bool CycleChannels)
QDateTime m_currentEndTime
void ShowJumpToTime(void)
void ShowRecordingMenu(void)
uint GetAlternateChannelIndex(uint chan_idx, bool with_same_channum) const
static void HideTVWindow(void)
void fillProgramRowInfos(int row, bool useExistingData)
void ChannelGroupMenu(int mode=0)
void fillProgramInfos(bool useExistingData=false)
void updateDateText(void)
ChannelInfoList GetSelection(void) const
void customEvent(QEvent *event) override
MythUIText * m_longdateText
QDateTime m_originalStartTime
QDateTime m_currentStartTime
void toggleChannelFavorite(int grpid=-1)
void aboutToHide() override
void ChangeVolume(bool Up, int NewVolume=-1)
static void RunProgramGuide(uint startChanId, const QString &startChanNum, const QDateTime &startTime, TV *player=nullptr, bool embedVideo=false, bool allowFinder=true, int changrpid=-1)
std::chrono::minutes m_selectRecThreshold
void moveLeftRight(MoveVector movement)
MythUIGuideGrid * m_guideGrid
GuideHelper(GuideGrid *guide, GuideUpdaterBase *updater)
static QWaitCondition s_wait
static bool IsLoading(GuideGrid *guide)
static void Wait(GuideGrid *guide)
GuideUpdaterBase * m_updater
static QHash< GuideGrid *, uint > s_loading
const bool m_verticalLayout
const QDateTime m_firstTime
const uint m_currentStartChannel
const QVector< int > m_chanNums
const MythRect m_ggProgramRect
const int m_ggChannelCount
const unsigned int m_firstRow
GuideStatus(unsigned int firstRow, unsigned int numRows, QVector< int > channums, const MythRect &gg_programRect, int gg_channelCount, QDateTime currentStartTime, QDateTime currentEndTime, uint currentStartChannel, int currentRow, int currentCol, int channelCount, int timeCount, bool verticalLayout, QDateTime firstTime, QDateTime lastTime)
const QDateTime m_currentStartTime
const unsigned int m_numRows
const QDateTime m_currentEndTime
const QDateTime m_lastTime
void ExecuteUI(void) override
QVector< ChannelInfo * > m_chinfos
bool ExecuteNonUI(void) override
QVector< bool > m_unavailables
GuideUpdateChannels(GuideGrid *guide, uint startChan)
uint m_currentStartChannel
const QDateTime m_currentStartTime
const QDateTime m_firstTime
const MythRect m_ggProgramRect
GuideUpdateProgramRow(GuideGrid *guide, const GuideStatus &gs, QVector< ProgramList * > proglists)
const QDateTime m_currentEndTime
const int m_ggChannelCount
bool ExecuteNonUI(void) override
const QVector< int > m_chanNums
ProgInfoGuideArray m_programInfos
const uint m_currentStartChannel
~GuideUpdateProgramRow() override=default
void ExecuteUI(void) override
const bool m_verticalLayout
const unsigned int m_firstRow
const QDateTime m_lastTime
const unsigned int m_numRows
void fillProgramRowInfosWith(int row, const QDateTime &start, ProgramList *proglist)
QVector< ProgramList * > m_proglists
std::list< GuideUIElement > m_result
virtual ~GuideUpdaterBase()=default
virtual bool ExecuteNonUI(void)=0
GuideUpdaterBase(GuideGrid *guide)
virtual void ExecuteUI(void)=0
virtual void SetJumpToChannel(JumpToChannel *ptr)=0
virtual void GoTo(int start, int cur_row)=0
virtual int FindChannel(uint chanid, const QString &channum, bool exact=true) const =0
virtual void deleteLater(void)
JumpToChannel(JumpToChannelListener *parent, QString start_entry, int start_chan_idx, int cur_chan_idx, uint rows_disp)
JumpToChannelListener * m_listener
int m_previousStartChannelIndex
int m_previousCurrentChannelIndex
static const uint kJumpToChannelTimeout
bool ProcessEntry(const QStringList &actions, const QKeyEvent *e)
QString GetEntry(void) const
QSqlQuery wrapper that fetches a DB connection from the connection pool.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
void setMaxThreadCount(int maxThreadCount)
void start(QRunnable *runnable, const QString &debugName, int priority=0)
Dialog asking for user confirmation.
void SaveSetting(const QString &key, int newValue)
QString GetMasterHostPrefix(const QString &storageGroup=QString(), const QString &path=QString())
int GetNumSetting(const QString &key, int defaultval=0)
bool GetBoolSetting(const QString &key, bool defaultval=false)
Basic menu dialog, message and a list of options.
This class is used as a container for messages.
const QString & Message() const
static const Type kMythEventMessage
A custom event that represents a mouse gesture.
Gesture GetGesture() const
QWidget * GetPaintWindow()
MythScreenStack * GetMainStack()
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythScreenStack * GetStack(const QString &Stackname)
void addListener(QObject *listener)
Add a listener to the observable.
void removeListener(QObject *listener)
Remove a listener to the observable.
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
MythPoint topLeft(void) const
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
void LoadInBackground(const QString &message="")
virtual void aboutToShow(void)
virtual void aboutToHide(void)
void BuildFocusList(void)
MythScreenStack * GetScreenStack() const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
virtual void SetTextFromMap(const InfoMap &infoMap)
int getChannelCount(void) const
bool isVerticalLayout(void) const
void SetProgramInfo(int row, int col, QRect area, const QString &title, const QString &genre, int arrow, int recType, int recStat, bool selected)
void SetProgPast(int ppast)
int getTimeCount(void) const
Image widget, displays a single image or multiple images in sequence.
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
void Reset(void) override
Reset the image back to the default defined in the theme.
This widget is used for grouping other widgets for display when a particular named state is called.
bool DisplayState(const QString &name)
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
virtual void SetText(const QString &text)
The base class on which all widgets and screens are based.
MythUIType * GetChildAt(QPoint p, bool recursive=true, bool focusable=true) const
Return the first MythUIType at the given coordinates.
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Holds information on recordings and videos.
float GetStars(void) const
uint GetRecordingRuleID(void) const
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
void SetScheduledEndTime(const QDateTime &dt)
QString GetTitle(void) const
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
virtual void ToMap(InfoMap &progMap, bool showrerecord=false, uint star_range=10, uint date_format=0) const
Converts ProgramInfo into QString QHash containing each field in ProgramInfo converted into localized...
RecStatus::Type GetRecordingStatus(void) const
QString GetCategory(void) const
RecordingType GetRecordingRuleType(void) const
Internal representation of a recording rule, mirrors the record table.
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
virtual int IncrRef(void)
Increments reference count.
virtual void EditScheduled(void)
Creates a dialog for editing the recording schedule.
virtual void EditRecording(bool may_watch_now=false)
Creates a dialog for editing the recording status, blocking until user leaves dialog.
virtual void ShowDetails(void) const
Show the Program Details screen.
void customEvent(QEvent *event) override
virtual void EditCustom(void)
Creates a dialog for creating a custom recording rule.
virtual void QuickRecord(void)
Create a kSingleRecord or bring up recording dialog.
virtual void ShowUpcoming(void) const
Show the upcoming recordings for this title.
virtual void ShowChannelSearch(void) const
Show the channel search.
virtual void ShowPrevious(void) const
Show the previous recordings for this recording rule.
void ChangeMuteState(bool CycleChannels=false)
void RequestEmbedding(bool Embed, const QRect &Rect={}, const QStringList &Data={})
void VolumeChange(bool Up, int NewVolume=-1)
static void SetActiveChannelGroupId(int channelgroupid)
PlayerContext * GetPlayerContext()
Return a pointer to TV::m_playerContext.
void GetPlayerReadLock() const
void PlaybackExiting(TV *Player)
static bool StartTV(ProgramInfo *TVRec, uint Flags, const ChannelInfoList &Selection=ChannelInfoList())
Start playback of media.
static bool IsTunable(uint ChanId)
void ReturnPlayerLock() const
void UpdateChannelList(int GroupID)
update the channel list with channels from the selected channel group
void ChangeChannel(const ChannelInfoList &Options)
GuideUpdaterBase * m_updater
static const Type kEventType
UpdateGuideEvent(GuideUpdaterBase *updater)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
static ProgramList * CopyProglist(ProgramList *proglist)
static constexpr int64_t kFiveMinutes
static constexpr int64_t kEightHours
static constexpr int64_t kThirtyMinutes
static constexpr uint64_t MKKEY(uint64_t IDX, uint64_t SEL)
static bool SelectionIsTunable(const ChannelInfoList &selection)
const QString kUnknownTitle
QWaitCondition epgIsVisibleCond
static bool has_action(const QString &action, const QStringList &actions)
static constexpr int64_t kFourMinutes
static constexpr int64_t kOneDay
static constexpr std::chrono::milliseconds kUpdateMS
std::array< std::array< ProgramInfo *, MAX_DISPLAY_TIMES >, MAX_DISPLAY_CHANS > ProgInfoGuideArray
std::vector< ChannelInfo > db_chan_list_t
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
A C++ ripoff of the stroke library for MythTV.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
QHash< QString, QString > InfoMap
static constexpr const char * ACTION_LEFT
static constexpr const char * ACTION_DOWN
static constexpr const char * ACTION_RIGHT
static constexpr const char * ACTION_SELECT
static constexpr const char * ACTION_UP
static constexpr int MAX_DISPLAY_TIMES
static constexpr uint8_t GridTimeNormal
static constexpr int MAX_DISPLAY_CHANS
static constexpr uint8_t GridTimeEndsAfter
static constexpr uint8_t GridTimeStartsBefore
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
@ kDateFull
Default local time.
@ kTime
Default local time.
@ kDateShort
Default local time.
std::chrono::seconds secsInFuture(const QDateTime &future)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
def rating(profile, smoonURL, gate)
void RunProgramFinder(TV *player, bool embedVideo, bool allowEPG)
bool LoadFromProgram(ProgramList &destination, const QString &where, const QString &groupBy, const QString &orderBy, const MSqlBindings &bindings, const ProgramList &schedList)
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
AutoDeleteDeque< ProgramInfo * > ProgramList
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
@ kState_WatchingLiveTV
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
#define ACTION_TOGGLEPGORDER
#define ACTION_CHANNELSEARCH
#define ACTION_TOGGLERECORD
#define ACTION_VOLUMEDOWN
std::vector< uint > RemoteRequestFreeInputList(uint excluded_input)
VERBOSE_PREAMBLE Most true