Go to the documentation of this file.
7 #include <QCoreApplication>
51 #define LOC QString("GuideGrid: ")
52 #define LOC_ERR QString("GuideGrid, Error: ")
53 #define LOC_WARN QString("GuideGrid, Warning: ")
57 static constexpr std::chrono::milliseconds
kUpdateMS { 60s };
62 static constexpr int64_t
kOneDay { 24 * 60LL * 60 };
67 int start_chan_idx,
int cur_chan_idx,
uint rows_disp) :
69 m_entry(std::move(start_entry)),
70 m_previousStartChannelIndex(start_chan_idx),
71 m_previousCurrentChannelIndex(cur_chan_idx),
72 m_rowsDisplayed(rows_disp),
73 m_timer(new QTimer(this))
98 QObject::deleteLater();
104 QStringList::const_iterator it;
105 for (it = actions.begin(); it != actions.end(); ++it)
141 QString txt = e->text();
152 if (!
m_entry.isEmpty() && (txt==
"_" || txt==
"-" || txt==
"#" || txt==
"."))
194 QVector<int> channums,
197 QDateTime currentStartTime,
198 QDateTime currentEndTime,
199 uint currentStartChannel,
200 int currentRow,
int currentCol,
201 int channelCount,
int timeCount,
203 QDateTime firstTime, QDateTime lastTime)
247 QVector<ProgramList*> proglists)
277 for (
unsigned int i = 0; i <
m_numRows; ++i)
352 (QEvent::Type) QEvent::registerEventType();
360 QMutexLocker locker(&
s_lock);
365 QThread::currentThread()->setPriority(QThread::IdlePriority);
370 QCoreApplication::postEvent(
m_guide,
380 QMutexLocker locker(&
s_lock);
387 QMutexLocker locker(&
s_lock);
392 QMutexLocker locker(&
s_lock);
395 if (!
s_wait.wait(locker.mutex(), 15000UL))
412 const QDateTime &startTime,
413 TV *player,
bool embedVideo,
414 bool allowFinder,
int changrpid)
422 0,
true,
"", (changrpid<0) ? 0 : changrpid);
425 if (channels.empty() && changrpid != -1)
427 LOG(VB_GENERAL, LOG_WARNING,
LOC +
428 QString(
"Channelgroup '%1' is empty, changing to 'All Programs'")
434 if (channels.empty())
439 message = tr(
"You don't have any channels defined in the database."
440 "\n\t\t\tThe program guide will have nothing to show you.");
444 message = tr(
"Channel group '%1' doesn't have any channels defined."
445 "\n\t\t\tThe program guide will have nothing to show you.")
449 LOG(VB_GENERAL, LOG_WARNING,
LOC + message);
453 else if (allowFinder)
462 QString actualChannum = channum;
463 if (chanid == 0 && actualChannum.isEmpty())
467 chanid = defaultChanid;
469 if (chanid == 0 && actualChannum.isEmpty())
472 if (!inputIDs.empty())
477 auto *gg =
new GuideGrid(mainStack, chanid, actualChannum, startTime,
478 player, embedVideo, allowFinder, changrpid);
481 mainStack->
AddScreen(gg, (player ==
nullptr));
487 uint chanid, QString channum,
const QDateTime &startTime,
488 TV *player,
bool embedVideo,
489 bool allowFinder,
int changrpid)
491 m_selectRecThreshold(
gCoreContext->GetDurSetting<std::chrono::minutes>(
"SelChangeRecThreshold", 16min)),
492 m_allowFinder(allowFinder),
493 m_startChanID(chanid),
494 m_startChanNum(std::move(channum)),
497 m_embedVideo(embedVideo),
498 m_channelOrdering(
gCoreContext->GetSetting(
"ChannelOrdering",
"channum")),
499 m_updateTimer(new QTimer(this)),
500 m_threadPool(
"GuideGridHelperPool"),
501 m_changrpid(changrpid),
511 if (startTime.isValid() &&
542 QString windowName =
"programguide";
545 windowName =
"programguide-video";
562 LOG(VB_GENERAL, LOG_ERR,
563 QString(
"Cannot load screen '%1'").arg(windowName));
602 chanNum = std::max(chanNum, 0);
677 if (!actions.empty())
683 const QString& chanNum = actions[0];
685 (void)chanNum.toInt(&isNum);
707 for (
int i = 0; i < actions.size() && !handled; ++i)
709 const QString&
action = actions[i];
739 else if (
action ==
"PAGEUP")
746 else if (
action ==
"PAGEDOWN")
775 else if (
action ==
"NEXTFAV")
787 else if (
action ==
"MENU")
799 auto secsTillStart = (pginfo)
825 else if (
action ==
"EDIT")
829 else if (
action ==
"CUSTOMEDIT")
833 else if (
action ==
"DELETE")
837 else if (
action ==
"UPCOMING")
841 else if (
action ==
"PREVRECORDED")
860 else if (
action ==
"CHANUPDATE")
872 else if (
action ==
"CYCLEAUDIOCHAN")
904 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Guide Gesture no event");
908 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture event %1")
917 QPoint position =
event->GetPosition();
930 QString name =
object->objectName();
931 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click name %1").arg(name));
933 if (name.startsWith(
"channellist"))
935 auto* channelList = qobject_cast<MythUIButtonList*>(
object);
939 handled = channelList->gestureEvent(event);
940 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click channel list %1").arg(handled));
943 else if (name.startsWith(
"guidegrid"))
945 auto* guidegrid = qobject_cast<MythUIGuideGrid*>(
object);
951 QPoint rowCol = guidegrid->GetRowAndColumn(position - guidegrid->GetArea().topLeft());
953 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click gg %1,%2 (%3,%4)")
959 if ((rowCol.y() >= 0) && (rowCol.x() >= 0))
970 auto secsTillStart = (pginfo)
976 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click gg EditRec"));
980 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click gg enter"));
987 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Guide Gesture Click gg not live"));
1100 return std::any_of(selection.cbegin(), selection.cend(),
1101 [selection](
const auto & chan){ return TV::IsTunable(chan.m_chanId); } );
1106 QString label = tr(
"Guide Options");
1109 auto *menuPopup =
new MythDialogBox(label, popupStack,
"guideMenuPopup");
1111 if (menuPopup->Create())
1113 menuPopup->SetReturnEvent(
this,
"guidemenu");
1116 menuPopup->AddButton(tr(
"Change to Channel"));
1118 menuPopup->AddButton(tr(
"Watch This Channel"));
1120 menuPopup->AddButton(tr(
"Record This"));
1122 menuPopup->AddButton(tr(
"Recording Options"),
nullptr,
true);
1124 menuPopup->AddButton(tr(
"Program Details"));
1126 menuPopup->AddButton(tr(
"Jump to Time"),
nullptr,
true);
1128 menuPopup->AddButton(tr(
"Reverse Channel Order"));
1130 menuPopup->AddButton(tr(
"Channel Search"));
1134 menuPopup->AddButton(tr(
"Choose Channel Group"));
1137 menuPopup->AddButton(tr(
"Add To Channel Group"),
nullptr,
true);
1139 menuPopup->AddButton(tr(
"Remove from Channel Group"));
1152 QString label = tr(
"Recording Options");
1155 auto *menuPopup =
new MythDialogBox(label, popupStack,
"recMenuPopup");
1157 if (menuPopup->Create())
1159 menuPopup->SetReturnEvent(
this,
"recmenu");
1164 menuPopup->AddButton(tr(
"Edit Recording Status"));
1165 menuPopup->AddButton(tr(
"Edit Schedule"));
1166 menuPopup->AddButton(tr(
"Show Upcoming"));
1167 menuPopup->AddButton(tr(
"Previously Recorded"));
1168 menuPopup->AddButton(tr(
"Custom Edit"));
1171 menuPopup->AddButton(tr(
"Delete Rule"));
1196 return ((
GuideGrid*)
this)->GetChannelInfo(chan_idx, sel);
1219 "WHERE program.chanid = :CHANID AND "
1220 " program.endtime >= :STARTTS AND "
1221 " program.starttime <= :ENDTS AND "
1222 " program.starttime >= :STARTLIMITTS AND "
1223 " program.manualid = 0 ";
1225 bindings[
":STARTTS"] = starttime;
1226 bindings[
":STARTLIMITTS"] = starttime.addDays(-1);
1228 bindings[
":CHANID"] = chanid;
1242 for (
auto & pi : *proglist)
1248 uint chan_idx,
bool with_same_channum)
const
1257 for (
uint i = 0; i < cnt; ++i)
1268 if (with_same_channum != same_channum)
1274 if (with_same_channum)
1283 if (proglist.
empty() ||
1284 proglist.
size() != ch_proglist.
size())
1288 for (
size_t j = 0; j < proglist.
size(); ++j)
1290 isAlt &= proglist[j]->IsSameTitleTimeslotAndChannel(*ch_proglist[j]);
1306 static constexpr uint64_t
MKKEY(uint64_t IDX, uint64_t
SEL)
1307 {
return (IDX << 32) | SEL; }
1319 std::vector<uint64_t> sel;
1320 sel.push_back(
MKKEY(idx, si) );
1326 selected.push_back(*ch);
1332 if (proglist.
empty())
1338 if (ci && (i != si) &&
1341 sel.push_back(
MKKEY(idx, i) );
1348 if (ci && (i != si) &&
1351 sel.push_back(
MKKEY(idx, i) );
1360 sel.push_back(
MKKEY(idx, i) );
1364 for (
size_t i = 1; i < sel.size(); ++i)
1369 if (!ci || proglist.
size() != ch_proglist.
size())
1373 for (
size_t j = 0; j < proglist.
size(); ++j)
1375 isAlt &= proglist[j]->IsSameTitleTimeslotAndChannel(*ch_proglist[j]);
1408 using uint_list_t = std::vector<unsigned int>;
1409 QMap<QString,uint_list_t> channum_to_index_map;
1410 QMap<QString,uint_list_t> callsign_to_index_map;
1412 for (
size_t i = 0; i < channels.size(); ++i)
1417 chan = channels.size() - i - 1;
1420 bool ndup = !channum_to_index_map[channels[chan].m_chanNum].empty();
1421 bool cdup = !callsign_to_index_map[channels[chan].m_callSign].empty();
1438 for (
auto & channel : channels)
1440 const uint_list_t &ndups = channum_to_index_map[channel.m_chanNum];
1441 for (
unsigned int ndup : ndups)
1448 const uint_list_t &cdups = callsign_to_index_map[channel.m_callSign];
1449 for (
unsigned int cdup : cdups)
1456 if (gotostartchannel)
1464 LOG(VB_GENERAL, LOG_ERR,
"GuideGrid: "
1465 "\n\t\t\tYou don't have any channels defined in the database."
1466 "\n\t\t\tGuide grid will have nothing to show you.");
1511 if (exact || channum.isEmpty())
1515 QVector<int> idxList;
1521 idxList.push_back(i);
1526 result = idxList[result];
1541 int mins = starttime.time().minute();
1542 mins = 5 * (mins / 5);
1548 infomap[
"starttime"] = timeStr;
1556 item->SetTextFromMap(infomap);
1576 QString querystr =
"WHERE program.chanid = :CHANID "
1577 " AND program.endtime >= :STARTTS "
1578 " AND program.starttime <= :ENDTS "
1579 " AND program.starttime >= :STARTLIMITTS "
1580 " AND program.manualid = 0 ";
1583 bindings[
":STARTTS"] = starttime;
1584 bindings[
":STARTLIMITTS"] = starttime.addDays(-1);
1595 bool allRows =
false;
1596 unsigned int numRows = 1;
1604 QVector<int> chanNums;
1605 QVector<ProgramList*> proglists;
1607 for (
unsigned int i = 0; i < numRows; ++i)
1609 unsigned int row = i + firstRow;
1628 chanNum = std::max(chanNum, 0);
1631 if (useExistingData)
1633 chanNums.push_back(chanNum);
1634 proglists.push_back(proglist);
1638 for (
unsigned int i = numRows;
1649 GuideStatus gs(firstRow, chanNums.size(), chanNums,
1659 const QDateTime& start,
1682 progPast = played * 100 / length;
1687 auto program = proglist->
begin();
1688 std::vector<ProgramInfo*> unknownlist;
1689 bool unknown =
false;
1693 if (program != proglist->
end() &&
1694 (ts >= (*program)->GetScheduledEndTime()))
1699 if ((program == proglist->
end()) ||
1700 (ts < (*program)->GetScheduledStartTime()))
1713 GuideGrid::tr(
"Unknown",
"Unknown program title"),
1715 unknownlist.push_back(proginfo);
1723 if (proginfo && proginfo == *program)
1729 proginfo = *program;
1743 for (
auto & pi : unknownlist)
1749 double ydifference = 0.0;
1750 double xdifference = 0.0;
1754 ydifference = programRect.width() /
1756 xdifference = programRect.height() /
1761 ydifference = programRect.height() /
1763 xdifference = programRect.width() /
1772 bool isCurrent =
false;
1805 for (
int z = x + 1; z < x + spread; ++z)
1818 tempRect = QRect((
int)(row * ydifference),
1819 (
int)(x * xdifference),
1821 (
int)(xdifference * pginfo->
m_spread));
1825 tempRect = QRect((
int)(x * xdifference),
1826 (
int)(row * ydifference),
1827 (
int)(xdifference * pginfo->
m_spread),
1832 if (tempRect.right() + 2 >= programRect.width())
1833 tempRect.setRight(programRect.width());
1834 if (tempRect.bottom() + 2 >= programRect.bottom())
1835 tempRect.setBottom(programRect.bottom());
1878 GuideGrid::tr(
"Unknown",
"Unknown program title") :
1881 row, cnt, tempRect, title,
1883 recStat, isCurrent);
1896 auto *me =
dynamic_cast<MythEvent *
>(event);
1900 const QString& message = me->
Message();
1902 if (message ==
"SCHEDULE_CHANGE")
1913 QString resultid = dce->GetId();
1914 QString resulttext = dce->GetResultText();
1915 int buttonnum = dce->GetResult();
1917 if (resultid ==
"deleterule")
1922 if ((buttonnum > 0) && !record->Delete())
1923 LOG(VB_GENERAL, LOG_ERR,
"Failed to delete recording rule");
1929 else if (resulttext == tr(
"Watch This Channel"))
1935 else if (resultid ==
"guidemenu")
1937 if (resulttext == tr(
"Record This"))
1941 else if (resulttext == tr(
"Change to Channel"))
1945 else if (resulttext == tr(
"Program Details"))
1949 else if (resulttext == tr(
"Reverse Channel Order"))
1955 else if (resulttext == tr(
"Channel Search"))
1959 else if (resulttext == tr(
"Add To Channel Group"))
1964 else if (resulttext == tr(
"Remove from Channel Group"))
1968 else if (resulttext == tr(
"Choose Channel Group"))
1972 else if (resulttext == tr(
"Recording Options"))
1976 else if (resulttext == tr(
"Jump to Time"))
1981 else if (resultid ==
"recmenu")
1983 if (resulttext == tr(
"Edit Recording Status"))
1987 else if (resulttext == tr(
"Edit Schedule"))
1991 else if (resulttext == tr(
"Show Upcoming"))
1995 else if (resulttext == tr(
"Previously Recorded"))
1999 else if (resulttext == tr(
"Custom Edit"))
2003 else if (resulttext == tr(
"Delete Rule"))
2009 else if (resultid ==
"channelgrouptogglemenu")
2013 if (changroupid > 0)
2016 else if (resultid ==
"channelgroupmenu")
2020 int changroupid = -1;
2022 if (resulttext == QObject::tr(
"All Channels"))
2032 QString changrpname;
2039 else if (resultid ==
"jumptotime")
2041 QDateTime datetime = dce->GetData().toDateTime();
2052 if (uge && uge->m_updater)
2055 delete uge->m_updater;
2056 uge->m_updater =
nullptr;
2072 const QVector<ProgramList*> &proglists,
2074 const std::list<GuideUIElement> &elements)
2076 for (
unsigned int i = 0; i < numRows; ++i)
2078 unsigned int row = i + firstRow;
2087 for (
const auto & r : elements)
2090 r.m_category, r.m_arrow, r.m_recType,
2091 r.m_recStat, r.m_selected);
2093 for (
unsigned int i = firstRow; i < firstRow + numRows; ++i)
2110 QVector<bool> &unavailables)
2114 for (
unsigned int y = 0; (y < (
unsigned int)
m_channelCount) && chinfo; ++y)
2124 bool unavailable =
false;
2125 bool try_alt =
false;
2144 unavailable =
false;
2150 if (unavailable && chinfo &&
2157 chinfos.push_back(chinfo);
2158 unavailables.push_back(unavailable);
2163 const QVector<bool> &unavailables)
2166 for (
int i = 0; i < chinfos.size(); ++i)
2169 bool unavailable = unavailables[i];
2173 QString state =
"available";
2175 state = (
m_changrpid == -1) ?
"unavailable" :
"favunavailable";
2177 state = (
m_changrpid == -1) ?
"available" :
"favourite";
2179 item->SetFontState(state);
2180 item->DisplayState(state,
"chanstatus");
2185 chinfo->
ToMap(infomap);
2186 item->SetTextFromMap(infomap);
2188 if (!chinfo->
m_icon.isEmpty())
2193 item->SetImage(iconurl,
"channelicon");
2216 chanNum = std::max(chanNum, 0);
2223 if (!chinfo->
m_icon.isEmpty())
2233 chinfo->
ToMap(infoMap);
2234 pginfo->
ToMap(infoMap);
2240 infoMap[
"title"] = tr(
"Unknown",
"Unknown program title");
2241 infoMap[
"titlesubtitle"] = tr(
"Unknown",
"Unknown program title");
2299 if (channels.empty())
2301 QString message = tr(
"You don't have any channel groups defined");
2306 if (okPopup->Create())
2314 QString label = tr(
"Select Channel Group");
2317 auto *menuPopup =
new MythDialogBox(label, popupStack,
"menuPopup");
2319 if (menuPopup->Create())
2321 if (mode == 0 || mode == 2)
2324 menuPopup->SetReturnEvent(
this,
"channelgrouptogglemenu");
2329 menuPopup->SetReturnEvent(
this,
"channelgroupmenu");
2330 menuPopup->AddButton(QObject::tr(
"All Channels"));
2333 for (
auto & channel : channels)
2335 menuPopup->AddButton(channel.m_name);
2363 chanNum = std::max(chanNum, 0);
2529 if (!datetime.isValid())
2541 if (newStartChannel < 0)
2596 if (!record->LoadByProgram(pginfo))
2602 QString message = tr(
"Delete '%1' %2 rule?")
2609 okPopup->SetReturnEvent(
this,
"deleterule");
2610 okPopup->SetData(QVariant::fromValue(record));
2612 if (okPopup->Create())
2680 QRegion r1 = QRegion(
m_area);
2703 QString message = tr(
"Jump to a specific date and time in the guide");
2710 if (timedlg->Create())
2712 timedlg->SetReturnEvent(
this,
"jumptotime");
static bool has_action(const QString &action, const QStringList &actions)
void ShowMenu(void) override
MythUIGuideGrid * m_guideGrid
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
virtual ~GuideUpdaterBase()=default
uint GetChannelCount(void) const
bool ExecuteNonUI(void) override
void LoadInBackground(const QString &message="")
QSqlQuery wrapper that fetches a DB connection from the connection pool.
MythScreenStack * GetMainStack()
const uint m_currentStartChannel
void RequestEmbedding(bool Embed, const QRect &Rect={}, const QStringList &Data={})
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
void moveUpDown(MoveVector movement)
static constexpr const char * ACTION_DOWN
static void RunProgramGuide(uint startChanId, const QString &startChanNum, const QDateTime &startTime, TV *player=nullptr, bool embedVideo=false, bool allowFinder=true, int changrpid=-1)
virtual int FindChannel(uint chanid, const QString &channum, bool exact=true) const =0
static const Type kMythEventMessage
const QDateTime m_currentStartTime
Image widget, displays a single image or multiple images in sequence.
static QString GetChannelGroupName(int grpid)
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
MythUIText * m_changroupname
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Gesture GetGesture() const
MythUIType * GetChildAt(QPoint p, bool recursive=true, bool focusable=true) const
Return the first MythUIType at the given coordinates.
void ToMap(InfoMap &infoMap)
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.
void customEvent(QEvent *event) override
void ShowRecordingMenu(void)
GuideUpdaterBase(GuideGrid *guide)
ChannelGroupList m_channelGroupListManual
void ToggleMute(bool CycleChannels)
MythUIImage * m_channelImage
uint GetAlternateChannelIndex(uint chan_idx, bool with_same_channum) const
void RunProgramFinder(TV *player, bool embedVideo, bool allowEPG)
bool isVerticalLayout(void) const
QRecursiveMutex m_jumpToChannelLock
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
void SetProgPast(int ppast)
QDateTime m_currentEndTime
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void updateChannels(void)
static bool InChannelGroupList(const ChannelGroupList &groupList, int grpid)
void setStartChannel(int newStartChannel)
This class is used as a container for messages.
#define ACTION_TOGGLERECORD
virtual void ExecuteUI(void)=0
uint m_currentStartChannel
static const uint kJumpToChannelTimeout
static QWaitCondition s_wait
QString GetCategory(void) const
static constexpr const char * ACTION_LEFT
std::array< std::array< ProgramInfo *, MAX_DISPLAY_TIMES >, MAX_DISPLAY_CHANS > ProgInfoGuideArray
const int m_ggChannelCount
Internal representation of a recording rule, mirrors the record table.
int GetStartChannelOffset(int row=-1) const
static ChannelGroupList GetManualChannelGroups(bool includeEmpty=true)
void toggleChannelFavorite(int grpid=-1)
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
const unsigned int m_firstRow
void ChangeChannel(const ChannelInfoList &Options)
#define ACTION_TOGGLEPGORDER
void ShowJumpToTime(void)
const unsigned int m_numRows
MythUIButtonList * m_channelList
QVector< bool > m_unavailables
const int m_ggChannelCount
ProgInfoGuideArray m_programInfos
const QDateTime m_currentEndTime
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
GuideGrid(MythScreenStack *parentStack, uint chanid, QString channum, const QDateTime &startTime, TV *player=nullptr, bool embedVideo=false, bool allowFinder=true, int changrpid=-1)
const QDateTime m_firstTime
static constexpr int MAX_DISPLAY_TIMES
void PlayerExiting(TV *Player)
const QString kUnknownTitle
static ChannelGroupList GetChannelGroups(bool includeEmpty=true)
static constexpr int64_t kThirtyMinutes
virtual void deleteLater(void)
bool Create(void) override
void Reset(void) override
Reset the image back to the default defined in the theme.
UpdateGuideEvent(GuideUpdaterBase *updater)
static constexpr const char * ACTION_SELECT
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
static constexpr uint8_t GridTimeStartsBefore
int getChannelCount(void) const
void updateChannelsNonUI(QVector< ChannelInfo * > &chinfos, QVector< bool > &unavailables)
virtual void ShowDetails(void) const
Show the Program Details screen.
bool ExecuteNonUI(void) override
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
const QString & Message() const
VERBOSE_PREAMBLE Most true
static bool StartTV(ProgramInfo *TVRec, uint Flags, const ChannelInfoList &Selection=ChannelInfoList())
Start playback of media.
virtual void EditRecording(bool may_watch_now=false)
Creates a dialog for editing the recording status, blocking until user leaves dialog.
void aboutToShow() override
virtual void EditScheduled(void)
Creates a dialog for editing the recording schedule.
virtual bool ExecuteNonUI(void)=0
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
void aboutToHide() override
std::vector< ChannelInfo > db_chan_list_t
const bool m_verticalLayout
QHash< QString, QString > InfoMap
std::vector< ProgramList * > m_programs
void addListener(QObject *listener)
Add a listener to the observable.
QString GetFormatted(ChannelFormat format) const
void ExecuteUI(void) override
QDateTime m_currentStartTime
virtual void GoTo(int start, int cur_row)=0
std::chrono::minutes m_selectRecThreshold
GuideHelper(GuideGrid *guide, GuideUpdaterBase *updater)
std::chrono::seconds secsInFuture(const QDateTime &future)
virtual void ShowPrevious(void) const
Show the previous recordings for this recording rule.
void customEvent(QEvent *event) override
QDateTime m_originalStartTime
static bool SelectionIsTunable(const ChannelInfoList &selection)
std::vector< uint > RemoteRequestFreeInputList(uint excluded_input)
void fillChannelInfos(bool gotostartchannel=true)
const QVector< int > m_chanNums
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
const QVector< int > m_chanNums
virtual void EditCustom(void)
Creates a dialog for creating a custom recording rule.
RecStatus::Type GetRecordingStatus(void) const
const MythRect m_ggProgramRect
static constexpr std::chrono::milliseconds kUpdateMS
const QDateTime m_currentEndTime
MythUIText * m_longdateText
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
QVector< ChannelInfo * > m_chinfos
void SetScheduledEndTime(const QDateTime &dt)
Basic menu dialog, message and a list of options.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
QString GetTitle(void) const
void updateProgramsUI(unsigned int firstRow, unsigned int numRows, int progPast, const QVector< ProgramList * > &proglists, const ProgInfoGuideArray &programInfos, const std::list< GuideUIElement > &elements)
void BuildFocusList(void)
def rating(profile, smoonURL, gate)
void ExecuteUI(void) override
#define ACTION_CHANNELSEARCH
GuideUpdateProgramRow(GuideGrid *guide, const GuideStatus &gs, QVector< ProgramList * > proglists)
~GuideUpdateProgramRow() override=default
virtual void SetTextFromMap(const InfoMap &infoMap)
@ kDateShort
Default local time.
const QDateTime m_lastTime
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...
static bool IsTunable(uint ChanId)
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
uint GetCurrentStartChannel(void) const
@ kState_WatchingLiveTV
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
QWidget * GetPaintWindow()
db_chan_list_list_t m_channelInfos
void fillProgramRowInfosWith(int row, const QDateTime &start, ProgramList *proglist)
std::vector< ChannelGroupItem > ChannelGroupList
static ChannelInfoList GetChannels(uint sourceid, bool visible_only, const QString &group_by=QString(), uint channel_groupid=0)
MythUIButtonList * m_timeList
uint m_currentStartChannel
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
const unsigned int m_numRows
JumpToChannel(JumpToChannelListener *parent, QString start_entry, int start_chan_idx, int cur_chan_idx, uint rows_disp)
static constexpr int64_t kEightHours
static bool NotInChannelGroupList(const ChannelGroupList &groupList, int grpid)
int GetNumSetting(const QString &key, int defaultval=0)
MythScreenStack * GetScreenStack() const
A C++ ripoff of the stroke library for MythTV.
const QDateTime m_firstTime
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
static QHash< GuideGrid *, uint > s_loading
static constexpr uint8_t GridTimeNormal
GuideUpdaterBase * m_updater
The base class on which all widgets and screens are based.
static constexpr uint8_t GridTimeEndsAfter
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static constexpr const char * ACTION_UP
QString m_channelOrdering
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
bool GetBoolSetting(const QString &key, bool defaultval=false)
const bool m_verticalLayout
void moveLeftRight(MoveVector movement)
virtual void SetJumpToChannel(JumpToChannel *ptr)=0
static bool ToggleChannel(uint chanid, int changrpid, bool delete_chan)
void updateChannelsUI(const QVector< ChannelInfo * > &chinfos, const QVector< bool > &unavailables)
AutoDeleteDeque< ProgramInfo * > ProgramList
MythUIText * m_jumpToText
int getTimeCount(void) const
GuideUpdateChannels(GuideGrid *guide, uint startChan)
RecordingType GetRecordingRuleType(void) const
static int GetNextChannelGroup(const ChannelGroupList &sorted, int grpid)
void ReturnPlayerLock() const
int m_previousCurrentChannelIndex
bool ProcessEntry(const QStringList &actions, const QKeyEvent *e)
Holds information on recordings and videos.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void VolumeChange(bool Up, int NewVolume=-1)
QDateTime GetCurrentStartTime(void) const
static constexpr const char * ACTION_RIGHT
Dialog asking for user confirmation. Ok and optional Cancel button.
const MythRect m_ggProgramRect
MythPoint topLeft(void) const
static constexpr int64_t kOneDay
JumpToChannel * m_jumpToChannel
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
PlayerContext * GetPlayerContext()
Return a pointer to TV::m_playerContext.
void SetProgramInfo(int row, int col, QRect area, const QString &title, const QString &genre, int arrow, int recType, int recStat, bool selected)
static int GetChannelGroupId(const QString &changroupname)
std::list< GuideUIElement > m_result
static constexpr int64_t kFourMinutes
void fillProgramRowInfos(int row, bool useExistingData)
bool LoadFromProgram(ProgramList &destination, const QString &where, const QString &groupBy, const QString &orderBy, const MSqlBindings &bindings, const ProgramList &schedList)
void UpdateChannelList(int GroupID)
update the channel list with channels from the selected channel group
void PlaybackExiting(TV *Player)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static constexpr int MAX_DISPLAY_CHANS
void ChangeVolume(bool Up, int NewVolume=-1)
void ChangeMuteState(bool CycleChannels=false)
virtual void SetText(const QString &text)
QWaitCondition epgIsVisibleCond
static constexpr int64_t kFiveMinutes
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
virtual void ShowUpcoming(void) const
Show the upcoming recordings for this title.
GuideUpdaterBase * m_updater
void toggleGuideListing()
static const Type kEventType
virtual void QuickRecord(void)
Create a kSingleRecord or bring up recording dialog.
int m_previousStartChannelIndex
MythMainWindow * GetMythMainWindow(void)
ChannelInfoList GetSelection(void) const
QVector< ProgramList * > m_proglists
void updateDateText(void)
void ChannelGroupMenu(int mode=0)
static void HideTVWindow(void)
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
QMap< uint, uint > m_channelInfoIdx
MythScreenStack * GetStack(const QString &Stackname)
@ kDateFull
Default local time.
const uint m_currentStartChannel
virtual void ShowChannelSearch(void) const
Show the channel search.
virtual void aboutToHide(void)
void setMaxThreadCount(int maxThreadCount)
A custom event that represents a mouse gesture.
static ProgramList * CopyProglist(ProgramList *proglist)
const QDateTime m_lastTime
static const Type kEventType
void GetPlayerReadLock() const
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)
void SaveSetting(const QString &key, int newValue)
const unsigned int m_firstRow
QString GetMasterHostPrefix(const QString &storageGroup=QString(), const QString &path=QString())
#define ACTION_VOLUMEDOWN
@ kTime
Default local time.
JumpToChannelListener * m_listener
ProgInfoGuideArray m_programInfos
uint GetRecordingRuleID(void) const
static int GetNearestChannel(const ChannelInfoList &list, const QString &channum)
virtual void aboutToShow(void)
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
static bool IsLoading(GuideGrid *guide)
virtual int IncrRef(void)
Increments reference count.
void moveToTime(const QDateTime &datetime)
static void Wait(GuideGrid *guide)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
ProgramList GetProgramList(uint chanid) const
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
void fillProgramInfos(bool useExistingData=false)
ProgramList * getProgramListFromProgram(int chanNum)
void removeListener(QObject *listener)
Remove a listener to the observable.
QString GetEntry(void) const
ChannelInfo * GetChannelInfo(uint chan_idx, int sel=-1)
int FindChannel(uint chanid, const QString &channum, bool exact=true) const override
static QString GetStartChannel(uint inputid)
This widget is used for grouping other widgets for display when a particular named state is called....
void start(QRunnable *runnable, const QString &debugName, int priority=0)
const QDateTime m_currentStartTime
bool DisplayState(const QString &name)
static constexpr uint64_t MKKEY(uint64_t IDX, uint64_t SEL)
void updateJumpToChannel(void)
std::vector< ChannelInfo > ChannelInfoList
void GoTo(int start, int cur_row) override
float GetStars(void) const
void SetJumpToChannel(JumpToChannel *ptr) override
ChannelGroupList m_changrplist