MythTV  master
mythuiguidegrid.cpp
Go to the documentation of this file.
1 
2 #include "mythuiguidegrid.h"
3 
4 // ANSI C headers
5 #include <cmath>
6 
7 // C++ headers
8 #include <algorithm>
9 using namespace std;
10 
11 // Qt headers
12 #include <QFile>
13 #include <QDomElement>
14 
15 // myth
16 #include "mythfontproperties.h"
17 #include "mythuihelper.h"
18 #include "x11colors.h"
19 #include "mythlogging.h"
20 #include "mythimage.h"
21 #include "mythuitype.h"
22 #include "mythuiimage.h"
23 #include "mythmainwindow.h"
24 #include "mythdb.h"
25 
26 #define LOC QString("MythUIGuideGrid: ")
27 
28 MythUIGuideGrid::MythUIGuideGrid(MythUIType *parent, const QString &name)
29  : MythUIType(parent, name)
30 {
31  m_font = new MythFontProperties();
32 
33  QMap<QString, QString> catColors;
34  parseDefaultCategoryColors(catColors);
35  SetCategoryColors(catColors);
36 }
37 
39 {
41 
42  m_allData = new QList<UIGTCon *>[m_rowCount];
43 
45 }
46 
48 {
49  for (int i = 0; i < m_rowCount; i++)
50  ResetRow(i);
51 
52  delete [] m_allData;
53 
54  delete m_font;
55  m_font = nullptr;
56 
57  // The m_recImages and m_arrowImages images are now children of
58  // the MythGuiGuideGrid widget and should be automatically deleted
59  // when it is deleted.
60 }
61 
63  const QString &filename, QDomElement &element, bool showWarnings)
64 {
65  if (element.tagName() == "layout")
66  {
67  QString layout = getFirstText(element).toLower();
68  m_verticalLayout = (layout == "vertical");
69  }
70  else if (element.tagName() == "channels")
71  {
72  m_channelCount = getFirstText(element).toInt();
75  }
76  else if (element.tagName() == "timeslots")
77  {
78  m_timeCount = getFirstText(element).toInt();
79  m_timeCount = max(m_timeCount, 1);
81  }
82  else if (element.tagName() == "solidcolor")
83  {
84  QString color = getFirstText(element);
85  m_solidColor = QColor(color);
86  }
87  else if (element.tagName() == "selector")
88  {
89  m_selType = element.attribute("type");
90  QString lineColor = element.attribute("linecolor", "");
91  QString fillColor = element.attribute("fillcolor", "");
92 
93  if (!lineColor.isEmpty())
94  {
95  m_drawSelLine = QPen(QColor(lineColor));
96  m_drawSelLine.setWidth(2);
97  }
98  else
99  {
100  m_drawSelLine = QPen(Qt::NoPen);
101  }
102 
103  if (!fillColor.isEmpty())
104  {
105  m_drawSelFill = QBrush(QColor(fillColor));
106  }
107  else
108  {
109  m_drawSelFill = QBrush(Qt::NoBrush);
110  }
111  }
112  else if (element.tagName() == "recordingcolor")
113  {
114  QString color = getFirstText(element);
115  m_recordingColor = QColor(color);
116  }
117  else if (element.tagName() == "conflictingcolor")
118  {
119  QString color = getFirstText(element);
120  m_conflictingColor = QColor(color);
121  }
122  else if (element.tagName() == "categoryalpha")
123  {
124  m_categoryAlpha = getFirstText(element).toInt();
126  m_categoryAlpha = min(m_categoryAlpha, 255);
127  }
128  else if (element.tagName() == "showcategories")
129  {
130  m_drawCategoryText = parseBool(element);
131  }
132  else if (element.tagName() == "showcategorycolors")
133  {
134  m_drawCategoryColors = parseBool(element);
135  }
136  else if (element.tagName() == "cutdown")
137  {
138  m_cutdown = parseBool(element);
139  }
140  else if (element.tagName() == "multiline")
141  {
142  SetMultiLine(parseBool(element));
143  }
144  else if (element.tagName() == "textoffset")
145  {
146  m_textOffset = parsePoint(element);
147  }
148  else if (element.tagName() == "font")
149  {
150  QString fontname = getFirstText(element);
151  MythFontProperties *font = GetFont(fontname);
152 
153  if (!font)
154  font = GetGlobalFontMap()->GetFont(fontname);
155 
156  if (font)
157  {
158  MythFontProperties fontcopy = *font;
159  int screenHeight = GetMythMainWindow()->GetUIScreenRect().height();
160  fontcopy.Rescale(screenHeight);
161  int fontStretch = GetMythUI()->GetFontStretch();
162  fontcopy.AdjustStretch(fontStretch);
163  *m_font = fontcopy;
164  }
165  else
166  LOG(VB_GENERAL, LOG_ERR, LOC + "Unknown font: " + fontname);
167  }
168  else if (element.tagName() == "recordstatus")
169  {
170  int inttype = 0;
171  QString typ = element.attribute("type");
172  QString img = element.attribute("image");
173 
174  if (typ == "SingleRecord")
175  inttype = 1;
176  else if (typ == "TimeslotRecord")
177  inttype = 2;
178  else if (typ == "ChannelRecord")
179  inttype = 3;
180  else if (typ == "AllRecord")
181  inttype = 4;
182  else if (typ == "WeekslotRecord")
183  inttype = 5;
184  else if (typ == "FindOneRecord")
185  inttype = 6;
186  else if (typ == "OverrideRecord")
187  inttype = 7;
188 
189  LoadImage(inttype, img);
190  }
191  else if (element.tagName() == "arrow")
192  {
193  QString dir = element.attribute("direction");
194  QString image = element.attribute("image");
195 
196  if (dir == "left")
197  SetArrow(0, image);
198  else if (dir == "right")
199  SetArrow(1, image);
200  else if (dir == "up")
201  SetArrow(2, image);
202  else if (dir == "down")
203  SetArrow(3, image);
204  }
205  else
206  {
207  return MythUIType::ParseElement(filename, element, showWarnings);
208  }
209 
210  return true;
211 }
212 
214 {
215  auto *gg = dynamic_cast<MythUIGuideGrid *>(base);
216 
217  if (!gg)
218  {
219  LOG(VB_GENERAL, LOG_ERR, LOC + "bad parsing");
220  return;
221  }
222 
223  m_channelCount = gg->m_channelCount;
224  m_timeCount = gg->m_timeCount;
225  m_verticalLayout = gg->m_verticalLayout;
226  m_categoryAlpha = gg->m_categoryAlpha;
227  m_textOffset = gg->m_textOffset;
228  m_justification = gg->m_justification;
229  m_multilineText = gg->m_multilineText;
230  *m_font = *gg->m_font;
231  m_solidColor = gg->m_solidColor;
232 
233  m_selType = gg->m_selType;
234  m_drawSelLine = gg->m_drawSelLine;
235  m_drawSelFill = gg->m_drawSelFill;
236 
237  m_recordingColor = gg->m_recordingColor;
238  m_conflictingColor = gg->m_conflictingColor;
239 
240  m_fillType = gg->m_fillType;
241  m_cutdown = gg->m_cutdown;
242  m_drawCategoryColors = gg->m_drawCategoryColors;
243  m_drawCategoryText = gg->m_drawCategoryText;
244 
245  MythUIType::CopyFrom(base);
246 }
247 
249 {
250  auto *gg = new MythUIGuideGrid(parent, objectName());
251  gg->CopyFrom(this);
252 }
253 
254 QColor MythUIGuideGrid::calcColor(const QColor &color, int alphaMod)
255 {
256  QColor newColor(color);
257  newColor.setAlpha((int)(color.alpha() *(alphaMod / 255.0)));
258  return newColor;
259 }
260 
285 void MythUIGuideGrid::DrawSelf(MythPainter *p, int xoffset, int yoffset,
286  int alphaMod, QRect clipRect)
287 {
288  p->SetClipRect(clipRect);
289  for (int i = 0; i < m_rowCount; i++)
290  {
291  QList<UIGTCon *>::iterator it = m_allData[i].begin();
292 
293  for (; it != m_allData[i].end(); ++it)
294  {
295  UIGTCon *data = *it;
296 
297  if (data->m_recStat == 0)
298  drawBackground(p, xoffset, yoffset, data, alphaMod);
299  else if (data->m_recStat == 1)
300  drawBox(p, xoffset, yoffset, data, m_recordingColor, alphaMod);
301  else
302  drawBox(p, xoffset, yoffset, data, m_conflictingColor, alphaMod);
303  drawText(p, xoffset, yoffset, data, alphaMod);
304  }
305  }
306 
307  drawCurrent(p, xoffset, yoffset, &m_selectedItem, alphaMod);
308  // Redraw the current selection's text in case it was clobbered by the above call.
309  drawText(p, xoffset, yoffset, &m_selectedItem, alphaMod);
310 
311  for (int i = 0; i < m_rowCount; i++)
312  {
313  QList<UIGTCon *>::iterator it = m_allData[i].begin();
314 
315  for (; it != m_allData[i].end(); ++it)
316  {
317  UIGTCon *data = *it;
318  drawRecDecoration(p, xoffset, yoffset, data, alphaMod);
319  }
320  }
321 }
322 
341 void MythUIGuideGrid::drawCurrent(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, int alphaMod)
342 {
343  int breakin = 2;
344  QRect area = data->m_drawArea;
345  area.translate(m_Area.x(), m_Area.y()); // Adjust within parent
346  area.translate(xoffset, yoffset); // Convert to global coordinates
347  area.adjust(breakin, breakin, -breakin, -breakin);
348  int status = data->m_recStat;
349 
350  if (m_selType == "roundbox")
351  {
352  QPen pen = m_drawSelLine;
353 
354  if (status == 1)
355  pen.setColor(m_recordingColor);
356  else if (status == 2)
357  pen.setColor(m_conflictingColor);
358 
359  p->DrawRoundRect(area, 10, m_drawSelFill, pen, alphaMod);
360  }
361  else if (m_selType == "highlight")
362  {
363  QBrush brush = m_drawSelFill;
364  QPen pen = m_drawSelLine;
365 
366  if (m_drawCategoryColors && data->m_categoryColor.isValid())
367  brush.setColor(calcColor(data->m_categoryColor, m_categoryAlpha));
368  else
369  brush.setColor(calcColor(m_solidColor, m_categoryAlpha));
370 
371  if (status == 1)
372  pen.setColor(m_recordingColor);
373  else if (status == 2)
374  pen.setColor(m_conflictingColor);
375 
376  brush.setColor(brush.color().lighter());
377  p->DrawRect(area, brush, pen, alphaMod);
378  }
379  else
380  {
381  // default to "box" selection type
382  QPen pen = m_drawSelLine;
383 
384  if (status == 1)
385  pen.setColor(m_recordingColor);
386  else if (status == 2)
387  pen.setColor(m_conflictingColor);
388 
389  p->DrawRect(area, m_drawSelFill, pen, alphaMod);
390  }
391 }
392 
411 void MythUIGuideGrid::drawRecDecoration(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, int alphaMod)
412 {
413  int breakin = 1;
414  QRect area = data->m_drawArea;
415  area.translate(m_Area.x(), m_Area.y()); // Adjust within parent
416  area.translate(xoffset, yoffset); // Convert to global coordinates
417  area.adjust(breakin, breakin, -breakin, -breakin);
418 
419  // draw arrows
420  if (data->m_arrow != GridTimeNormal)
421  {
422  if (data->m_arrow & GridTimeStartsBefore)
423  {
424  if (m_verticalLayout)
425  {
426  if (m_arrowImages[2]) { // UP
427  MythUIImage *arrow = m_arrowImages[2];
428  MythRect arrowarea = arrow->GetArea();
429  arrow->DrawSelf(p, area.center().x() - (arrowarea.width() / 2),
430  area.top(), alphaMod, area);
431  }
432  }
433  else
434  {
435  if (m_arrowImages[0]) { // LEFT
436  MythUIImage *arrow = m_arrowImages[0];
437  MythRect arrowarea = arrow->GetArea();
438  arrow->DrawSelf(p, area.left(),
439  area.center().y() - (arrowarea.height() / 2),
440  alphaMod, area);
441  }
442  }
443  }
444 
445  if (data->m_arrow & GridTimeEndsAfter)
446  {
447  if (m_verticalLayout)
448  {
449  if (m_arrowImages[3]) { // BOTTOM
450  MythUIImage *arrow = m_arrowImages[3];
451  MythRect arrowarea = arrow->GetArea();
452  arrow->DrawSelf(p, area.center().x() - (arrowarea.width() / 2),
453  area.top() + area.height() - arrowarea.height(),
454  alphaMod, area);
455  }
456  }
457  else
458  {
459  if (m_arrowImages[1]) { // RIGHT
460  MythUIImage *arrow = m_arrowImages[1];
461  MythRect arrowarea = arrow->GetArea();
462  arrow->DrawSelf(p,
463  area.right() - arrowarea.width(),
464  area.center().y() - (arrowarea.height() / 2),
465  alphaMod, area);
466  }
467  }
468  }
469  }
470 
471  // draw recording status
472  if (data->m_recType != 0 && m_recImages[data->m_recType])
473  {
474  MythUIImage *image = m_recImages[data->m_recType];
475  MythRect imagearea = image->GetArea();
476  image->DrawSelf(p, area.right() - imagearea.width(),
477  area.bottom() - imagearea.height(),
478  alphaMod, area);
479  }
480 }
481 
500 void MythUIGuideGrid::drawBox(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, const QColor &color, int alphaMod)
501 {
502  int breakin = 1;
503  QRect area = data->m_drawArea;
504  area.translate(m_Area.x(), m_Area.y()); // Adjust within parent
505  area.translate(xoffset, yoffset); // Convert to global coordinates
506  area.adjust(breakin, breakin, -breakin, -breakin);
507 
508  static const QPen kNoPen(Qt::NoPen);
509  p->DrawRect(area, QBrush(calcColor(color, m_categoryAlpha)), kNoPen, alphaMod);
510 }
511 
530 void MythUIGuideGrid::drawBackground(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, int alphaMod)
531 {
532  QColor overColor;
533  QRect overArea;
534 
535  int breakin = 1;
536  QRect area = data->m_drawArea;
537  area.translate(m_Area.x(), m_Area.y()); // Adjust within parent
538  QColor fillColor;
539 
540  if (m_drawCategoryColors && data->m_categoryColor.isValid())
541  fillColor = calcColor(data->m_categoryColor, m_categoryAlpha);
542  else
543  fillColor = calcColor(m_solidColor, m_categoryAlpha);
544 
545  // These calculations are in the parents local coordinates
546  if (m_verticalLayout)
547  {
548  if (m_progPastCol && area.top() < m_progPastCol)
549  {
550  if (area.bottom() < m_progPastCol)
551  {
552  fillColor = fillColor.darker();
553  area.adjust(breakin, breakin, -breakin, -breakin);
554  }
555  else
556  {
557  overColor = fillColor.darker();
558  int first = m_progPastCol - area.top();
559  int second = area.height() - first;
560  overArea = area;
561  overArea.setHeight(first);
562  area.translate(0, first);
563  area.setHeight(second);
564 
565  area.adjust(0, -breakin, -breakin, -breakin);
566  overArea.adjust(0, breakin, -breakin, -breakin);
567  }
568  }
569  else
570  area.adjust(breakin, breakin, -breakin, -breakin);
571  }
572  else
573  {
574  if (m_progPastCol && area.left() < m_progPastCol)
575  {
576  if (area.right() < m_progPastCol)
577  {
578  fillColor = fillColor.darker();
579  area.adjust(breakin, breakin, -breakin, -breakin);
580  }
581  else
582  {
583  overColor = fillColor.darker();
584  int first = m_progPastCol - area.left();
585  int second = area.width() - first;
586  overArea = area;
587  overArea.setWidth(first);
588  area.translate(first, 0);
589  area.setWidth(second);
590 
591  area.adjust(0, breakin, -breakin, -breakin);
592  overArea.adjust(breakin, breakin, 0, -breakin);
593  }
594  }
595  else
596  area.adjust(breakin, breakin, -breakin, -breakin);
597  }
598 
599  if (area.width() <= 1)
600  area.setWidth(2);
601 
602  if (area.height() <= 1)
603  area.setHeight(2);
604 
605  static const QPen kNoPen(Qt::NoPen);
606  area.translate(xoffset, yoffset); // Convert to global coordinates
607  p->DrawRect(area, QBrush(fillColor), kNoPen, alphaMod);
608 
609  if (overArea.width() > 0) {
610  overArea.translate(xoffset, yoffset); // Convert to global coordinates
611  p->DrawRect(overArea, QBrush(overColor), kNoPen, alphaMod);
612  }
613 }
614 
631 void MythUIGuideGrid::drawText(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, int alphaMod)
632 {
633  QString msg = data->m_title;
634 
635  if (m_drawCategoryText && !data->m_category.isEmpty())
636  msg += QString(" (%1)").arg(data->m_category);
637 
638  QRect area = data->m_drawArea;
639  area.translate(m_Area.x(), m_Area.y()); // Adjust within parent
640  area.translate(xoffset, yoffset); // Convert to global coordinates
641  area.adjust(m_textOffset.x(), m_textOffset.y(),
642  -m_textOffset.x(), -m_textOffset.y());
643 
644  if (m_verticalLayout)
645  {
646  if ((data->m_arrow & GridTimeStartsBefore) && m_arrowImages[2])
647  area.setTop(area.top() + m_arrowImages[2]->GetArea().height());
648 
649  if ((data->m_arrow & GridTimeEndsAfter) && m_arrowImages[3])
650  area.setBottom(area.bottom() - m_arrowImages[3]->GetArea().height());
651  }
652  else
653  {
654  if ((data->m_arrow & GridTimeStartsBefore) && m_arrowImages[0])
655  area.setLeft(area.left() + m_arrowImages[0]->GetArea().width());
656 
657  if ((data->m_arrow & GridTimeEndsAfter) && m_arrowImages[1])
658  area.setRight(area.right() - m_arrowImages[1]->GetArea().width());
659  }
660 
661  if (area.width() <= 0 || area.height() <= 0)
662  return;
663 
664  p->DrawText(area, msg, m_justification, *m_font, alphaMod, area);
665 }
666 
667 QPoint MythUIGuideGrid::GetRowAndColumn(QPoint position)
668 {
669  for (int i = 0; i < m_rowCount; i++)
670  {
671  QList<UIGTCon *>::iterator it = m_allData[i].begin();
672 
673  for (int col = 0; it != m_allData[i].end(); ++it, ++col)
674  {
675  UIGTCon *data = *it;
676 
677  if (data->m_drawArea.contains(position))
678  {
679  return {col, i};
680  }
681  }
682  }
683  return {-1,-1};
684 }
685 
686 void MythUIGuideGrid::SetProgramInfo(int row, int col, const QRect &area,
687  const QString &title, const QString &genre,
688  int arrow, int recType, int recStat,
689  bool selected)
690 {
691  (void)col;
692  auto *data = new UIGTCon(area, title, genre, arrow, recType, recStat);
693  m_allData[row].append(data);
694 
696  {
697  data->m_categoryColor = m_categoryColors[data->m_category.toLower()];
698 
699  if (!data->m_categoryColor.isValid())
700  data->m_categoryColor = m_categoryColors["none"];
701  }
702 
703  if (selected)
704  m_selectedItem = *data;
705 }
706 
707 bool MythUIGuideGrid::parseDefaultCategoryColors(QMap<QString, QString> &catColors)
708 {
709  QFile f;
710  QStringList searchpath = GetMythUI()->GetThemeSearchPath();
711 
712  for (QStringList::const_iterator ii = searchpath.begin();
713  ii != searchpath.end(); ++ii)
714  {
715  f.setFileName(*ii + "categories.xml");
716 
717  if (f.open(QIODevice::ReadOnly))
718  break;
719  }
720 
721 #ifndef Q_OS_ANDROID // Android does not get a file handle for assets file system
722  if (f.handle() == -1)
723  {
724  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Unable to open '%1'")
725  .arg(f.fileName()));
726  return false;
727  }
728 #endif
729 
730  QDomDocument doc;
731  QString errorMsg;
732  int errorLine = 0;
733  int errorColumn = 0;
734 
735  if (!doc.setContent(&f, false, &errorMsg, &errorLine, &errorColumn))
736  {
737  LOG(VB_GENERAL, LOG_ERR, LOC +
738  QString("Parsing colors: %1 at line: %2 column: %3")
739  .arg(f.fileName()).arg(errorLine).arg(errorColumn) +
740  QString("\n\t\t\t%1").arg(errorMsg));
741  f.close();
742  return false;
743  }
744 
745  f.close();
746 
747  QDomElement element = doc.documentElement();
748 
749  for (QDomNode child = element.firstChild(); !child.isNull();
750  child = child.nextSibling())
751  {
752  QDomElement info = child.toElement();
753 
754  if (!info.isNull() && info.tagName() == "catcolor")
755  {
756  QString cat = info.attribute("category");
757  QString col = info.attribute("color");
758 
759  catColors[cat.toLower()] = col;
760  }
761  }
762 
763  return true;
764 }
765 
766 void MythUIGuideGrid::SetCategoryColors(const QMap<QString, QString> &catC)
767 {
768  for (QMap<QString, QString>::const_iterator it = catC.begin();
769  it != catC.end(); ++it)
770  {
771  m_categoryColors[it.key()] = createColor(*it);
772  }
773 }
774 
775 void MythUIGuideGrid::LoadImage(int recType, const QString &file)
776 {
777  auto *uiimage = new MythUIImage(file, this, "guidegrid image");
778  uiimage->m_imageProperties.m_isThemeImage = true;
779  uiimage->SetVisible(false);
780  uiimage->Load(false);
781 
782  MythUIImage *tmp = m_recImages[recType];
783  m_recImages[recType] = uiimage;
784  delete tmp;
785 }
786 
787 void MythUIGuideGrid::SetArrow(int direction, const QString &file)
788 {
789  auto *uiimage = new MythUIImage(file, this, "guidegrid arrow");
790  uiimage->m_imageProperties.m_isThemeImage = true;
791  uiimage->SetVisible(false);
792  uiimage->Load(false);
793 
794  MythUIImage *tmp = m_arrowImages[direction];
795  m_arrowImages[direction] = uiimage;
796  delete tmp;
797 }
798 
800 {
801  for (int i = 0; i < m_rowCount; i++)
802  ResetRow(i);
803 }
804 
806 {
807  while (!m_allData[row].empty())
808  {
809  delete m_allData[row].back();
810  m_allData[row].pop_back();
811  }
812 }
813 
815 {
816  if (m_verticalLayout)
817  m_progPastCol = m_Area.y() + (m_Area.height() * ppast / 100);
818  else
819  m_progPastCol = m_Area.x() + (m_Area.width() * ppast / 100);
820 
821  SetRedraw();
822 }
823 
824 void MythUIGuideGrid::SetMultiLine(bool multiline)
825 {
826  m_multilineText = multiline;
827 
828  if (m_multilineText)
829  m_justification |= Qt::TextWordWrap;
830  else
831  m_justification &= ~Qt::TextWordWrap;
832 }
void SetCategoryColors(const QMap< QString, QString > &catColors)
void SetRedraw(void)
Definition: mythuitype.cpp:295
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
void ResetRow(int row)
void drawBackground(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, int alphaMod)
Draws the background for a GuideGrid item that will not be recorded.
static guint32 * tmp
Definition: goom_core.c:35
#define GridTimeEndsAfter
The base class on which all widgets and screens are based.
Definition: mythuitype.h:63
void SetProgPast(int ppast)
MythUIImage * m_arrowImages[ARROWIMAGESIZE]
static MythPoint parsePoint(const QString &text, bool normalize=true)
MythUIImage * m_recImages[RECSTATUSSIZE]
FontMap * GetGlobalFontMap(void)
void drawCurrent(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, int alphaMod)
Draws selection indication for a GuideGrid item.
QStringList GetThemeSearchPath(void)
void LoadImage(int, const QString &file)
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
Definition: mythuitype.cpp:863
void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect) override
Draws an entire GuideGrid.
static QString getFirstText(QDomElement &element)
void drawBox(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, const QColor &color, int alphaMod)
Draws the background for a GuideGrid item to be recorded.
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:17
void AdjustStretch(int stretch)
MythRect m_Area
Definition: mythuitype.h:249
int GetFontStretch(void) const
#define GridTimeNormal
MythUIHelper * GetMythUI()
#define GridTimeStartsBefore
bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings) override
Parse the xml definition of this widget setting the state of the object accordingly.
void drawRecDecoration(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, int alphaMod)
Draws decoration items for a GuideGrid item.
MythMainWindow * GetMythMainWindow(void)
static bool parseDefaultCategoryColors(QMap< QString, QString > &catColors)
MythFontProperties * GetFont(const QString &text) const
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
QColor createColor(const QString &color)
Definition: x11colors.cpp:14
QList< UIGTCon * > * m_allData
MythFontProperties * GetFont(const QString &text)
#define MAX_DISPLAY_TIMES
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
#define LOC
void SetArrow(int, const QString &file)
void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect) override
void SetMultiLine(bool multiline)
void drawText(MythPainter *p, int xoffset, int yoffset, UIGTCon *data, int alphaMod)
Draws text strings for a GuideGrid item.
#define MAX_DISPLAY_CHANS
void SetProgramInfo(int row, int col, const QRect &area, const QString &title, const QString &genre, int arrow, int recType, int recStat, bool selected)
QPoint GetRowAndColumn(QPoint position)
void Finalize(void) override
Perform any post-xml parsing initialisation tasks.
static bool parseBool(const QString &text)
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
MythUIGuideGrid(MythUIType *parent, const QString &name)
QMap< QString, QColor > m_categoryColors
MythFontProperties * m_font
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
void CreateCopy(MythUIType *parent) override
Copy the state of this widget to the one given, it must be of the same type.
static QColor calcColor(const QColor &color, int alpha)