MythTV master
teletextscreen.cpp
Go to the documentation of this file.
1#include <algorithm>
2
3#include <QFontMetrics>
4#include <QPainter>
5
14
17
18#define LOC QString("TeletextScreen: ")
19
20const QColor TeletextScreen::kColorBlack = QColor( 0, 0, 0,255);
21const QColor TeletextScreen::kColorRed = QColor(255, 0, 0,255);
22const QColor TeletextScreen::kColorGreen = QColor( 0,255, 0,255);
23const QColor TeletextScreen::kColorYellow = QColor(255,255, 0,255);
24const QColor TeletextScreen::kColorBlue = QColor( 0, 0,255,255);
25const QColor TeletextScreen::kColorMagenta = QColor(255, 0,255,255);
26const QColor TeletextScreen::kColorCyan = QColor( 0,255,255,255);
27const QColor TeletextScreen::kColorWhite = QColor(255,255,255,255);
30
33
34static constexpr std::array<const std::array<const uint8_t,16>,1+8+8> lang_chars
35{{
36 { 0, 0x23,0x24,0x40,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,0x7b,0x7c,0x7d,0x7e },
37
38 // for latin-1 font
39 // English (100%)
40 { 0, 0xa3,0x24,0x40,0xab,0xbd,0xbb,0xac,0x23,0xad,0xbc,0xa6,0xbe,0xf7 }, // £$@«½»¬#­¼¦¾÷
41 // German (100%)
42 { 0, 0x23,0x24,0xa7,0xc4,0xd6,0xdc,0x5e,0x5f,0xb0,0xe4,0xf6,0xfc,0xdf }, // #$§ÄÖÜ^_°äöüß
43 // Swedish/Finnish/Hungarian (100%)
44 { 0, 0x23,0xa4,0xc9,0xc4,0xd6,0xc5,0xdc,0x5f,0xe9,0xe4,0xf6,0xe5,0xfc }, // #¤ÉÄÖÅÜ_éäöåü
45 // Italian (100%)
46 { 0, 0xa3,0x24,0xe9,0xb0,0xe7,0xbb,0xac,0x23,0xf9,0xe0,0xf2,0xe8,0xec }, // £$é°ç»¬#ùàòèì
47 // French (100%)
48 { 0, 0xe9,0xef,0xe0,0xeb,0xea,0xf9,0xee,0x23,0xe8,0xe2,0xf4,0xfb,0xe7 }, // éïàëêùî#èâôûç
49 // Portuguese/Spanish (100%)
50 { 0, 0xe7,0x24,0xa1,0xe1,0xe9,0xed,0xf3,0xfa,0xbf,0xfc,0xf1,0xe8,0xe0 }, // ç$¡áéíóú¿üñèà
51 // Czech/Slovak (60%)
52 { 0, 0x23,0x75,0x63,0x74,0x7a,0xfd,0xed,0x72,0xe9,0xe1,0x65,0xfa,0x73 }, // #uctzýíréáeús
53 // reserved (English mapping)
54 { 0, 0xa3,0x24,0x40,0xab,0xbd,0xbb,0xac,0x23,0xad,0xbc,0xa6,0xbe,0xf7 }, // £$@«½»¬#­¼¦¾÷
55
56 // for latin-2 font
57 // Polish (100%)
58 { 0, 0x23,0xf1,0xb1,0xaf,0xa6,0xa3,0xe6,0xf3,0xea,0xbf,0xb6,0xb3,0xbc }, // #ñ±¯¦£æóê¿¶³¼
59 // German (100%)
60 { 0, 0x23,0x24,0xa7,0xc4,0xd6,0xdc,0x5e,0x5f,0xb0,0xe4,0xf6,0xfc,0xdf }, // #$§ÄÖÜ^_°äöüß
61 // Estonian (100%)
62 { 0, 0x23,0xf5,0xa9,0xc4,0xd6,0xae,0xdc,0xd5,0xb9,0xe4,0xf6,0xbe,0xfc }, // #õ©ÄÖ®ÜÕ¹äö¾ü
63 // Lettish/Lithuanian (90%)
64 { 0, 0x23,0x24,0xa9,0xeb,0xea,0xae,0xe8,0xfc,0xb9,0xb1,0x75,0xbe,0x69 }, // #$©ëê®èü¹±u¾i
65 // French (90%)
66 { 0, 0xe9,0x69,0x61,0xeb,0xec,0x75,0xee,0x23,0x65,0xe2,0xf4,0x75,0xe7 }, // éiaëìuî#eâôuç
67 // Serbian/Croation/Slovenian (100%)
68 { 0, 0x23,0xcb,0xc8,0xc6,0xae,0xd0,0xa9,0xeb,0xe8,0xe6,0xae,0xf0,0xb9 }, // #ËÈÆ®Ð©ëèæ®ð¹
69 // Czech/Slovak (100%)
70 { 0, 0x23,0xf9,0xe8,0xbb,0xbe,0xfd,0xed,0xf8,0xe9,0xe1,0xec,0xfa,0xb9 }, // #ù軾ýíøéáìú¹
71 // Rumanian (95%)
72 { 0, 0x23,0xa2,0xde,0xc2,0xaa,0xc3,0xce,0x69,0xfe,0xe2,0xba,0xe3,0xee }, // #¢ÞªÃÎiþâºãî
73}};
74
75static QChar cvt_char(char ch, int lang)
76{
77 for (int j = 0; j < 14; j++)
78 {
79 int c = ch & 0x7F;
80 if (c == lang_chars[0][j])
81 ch = lang_chars[lang + 1][j];
82 }
83 return QLatin1Char(ch);
84}
85
86TeletextScreen::TeletextScreen(MythPlayer* Player, MythPainter *Painter, const QString& Name, int FontStretch)
87 : MythScreenType(static_cast<MythScreenType*>(nullptr), Name),
88 m_player(Player),
89 m_fontStretch(FontStretch)
90{
91 m_painter = Painter;
92}
93
95{
97}
98
100{
101 if (m_player)
103 return m_player && m_teletextReader;
104}
105
107{
109 for (const auto & img : std::as_const(m_rowImages))
110 delete img;
111 m_rowImages.clear();
112 SetRedraw();
113}
114
115QImage* TeletextScreen::GetRowImage(int row, QRect &rect)
116{
117 int y = row & ~1;
118 rect.translate(0, -(y * m_rowHeight));
119 if (!m_rowImages.contains(y))
120 {
121 auto* img = new QImage(m_safeArea.width(), m_rowHeight * 2,
122 QImage::Format_ARGB32);
123 if (img)
124 {
125 img->fill(0);
126 m_rowImages.insert(y, img);
127 }
128 else
129 {
130 return nullptr;
131 }
132 }
133 return m_rowImages.value(y);
134}
135
137{
138 for (auto it = m_rowImages.begin(); it != m_rowImages.end(); ++it)
139 {
141 if (!image || !it.value())
142 continue;
143
144 int row = it.key();
145 image->Assign(*(it.value()));
146 auto *uiimage = new MythUIImage(this, QString("ttrow%1").arg(row));
147 if (uiimage)
148 {
149 uiimage->SetImage(image);
150 uiimage->SetArea(MythRect(0, row * m_rowHeight, m_safeArea.width(), m_rowHeight * 2));
151 }
152 image->DecrRef();
153 }
154
155 QRegion visible;
156 for (const auto *img : std::as_const(m_childrenList))
157 visible = visible.united(img->GetArea());
158
159 if (visible.isEmpty())
160 return;
161
162 QRect bounding = visible.boundingRect();
163 bounding = bounding.translated(m_safeArea.topLeft());
164 bounding = m_safeArea.intersected(bounding);
165 int left = m_safeArea.left() - bounding.left();
166 int top = m_safeArea.top() - bounding.top();
167 SetArea(MythRect(bounding));
168
169 for (MythUIType *img : std::as_const(m_childrenList))
170 img->SetArea(MythRect(img->GetArea().translated(left, top)));
171}
172
174{
175 if (!InitialiseFont() || !m_displaying)
176 return;
177
179 {
180 static const float kTextPadding = 0.96F;
181 QRect oldsafe = m_safeArea;
183 m_colWidth = (int)((float)m_safeArea.width() / (float)kTeletextColumns);
184 m_rowHeight = (int)((float)m_safeArea.height() / (float)kTeletextRows);
185
186 if (oldsafe != m_safeArea)
187 {
189
190 int max_width = (int)((float)m_colWidth * kTextPadding);
191 m_fontHeight = (int)((float)m_rowHeight * kTextPadding);
192 max_width = std::min(max_width, m_colWidth - 2);
193 m_fontHeight = std::min(m_fontHeight, m_rowHeight - 2);
194 gTTFont->GetFace()->setPixelSize(m_fontHeight);
195
196 m_fontStretch = 200;
197 bool ok = false;
198 while (!ok && m_fontStretch > 50)
199 {
200 gTTFont->GetFace()->setStretch(m_fontStretch);
201 QFontMetrics font(*(gTTFont->GetFace()));
202 if (font.averageCharWidth() <= max_width || m_fontStretch < 50)
203 ok = true;
204 else
205 m_fontStretch -= 10;
206 }
207 }
208 }
209 else
210 {
211 return;
212 }
213
215 return;
216
217 ClearScreen();
218
220
221 if (!ttpage)
222 {
223 // no page selected so show the header and a list of available pages
224 DrawHeader({}, 0);
227 return;
228 }
229
231
232 int a = 0;
233 if ((ttpage->subtitle) ||
235 {
236 a = 1; // when showing subtitles we don't want to see the teletext
237 // header line, so we skip that line...
240 }
241 else
242 {
247 }
248
249 for (int y = kTeletextRows - a; y >= 2; y--)
250 DrawLine(ttpage->data[y-1], y, ttpage->lang);
251
254}
255
256bool TeletextScreen::KeyPress(const QString& Key, bool& Exit)
257{
259 return m_teletextReader->KeyPress(Key, Exit);
260 return false;
261}
262
263void TeletextScreen::SetPage(int page, int subpage)
264{
266 m_teletextReader->SetPage(page, subpage);
267}
268
270{
271 m_displaying = display;
272 if (!m_displaying)
273 ClearScreen();
274}
275
277{
280}
281
282void TeletextScreen::DrawHeader(const tt_line_array& page, int lang)
283{
284 if (!m_displaying)
285 return;
286
287 if (!page.empty())
288 DrawLine(page, 1, lang);
289
290 DrawStatus();
291}
292
293static QColor ttcolortoqcolor(int ttcolor)
294{
295 QColor color;
296
297 switch (ttcolor & ~kTTColorTransparent)
298 {
299 case kTTColorBlack: color = TeletextScreen::kColorBlack; break;
300 case kTTColorRed: color = TeletextScreen::kColorRed; break;
301 case kTTColorGreen: color = TeletextScreen::kColorGreen; break;
302 case kTTColorYellow: color = TeletextScreen::kColorYellow; break;
303 case kTTColorBlue: color = TeletextScreen::kColorBlue; break;
305 case kTTColorCyan: color = TeletextScreen::kColorCyan; break;
306 case kTTColorWhite: color = TeletextScreen::kColorWhite; break;
307 }
308
309 return color;
310}
311
312static QString TTColorToString(int ttcolor)
313{
314 switch (ttcolor & ~kTTColorTransparent)
315 {
316 case kTTColorBlack: return "Black";
317 case kTTColorRed: return "Red";
318 case kTTColorGreen: return "Green";
319 case kTTColorYellow: return "Yellow";
320 case kTTColorBlue: return "Blue";
321 case kTTColorMagenta: return "Magenta";
322 case kTTColorCyan: return "Cyan";
323 case kTTColorWhite: return "White";
324 default: return "Unknown";
325 }
326}
327
329{
330 LOG(VB_VBI, LOG_DEBUG, QString("SetForegroundColor(%1)")
331 .arg(TTColorToString(ttcolor)));
332
334}
335
337{
338 LOG(VB_VBI, LOG_DEBUG, QString("SetBackgroundColor(%1)")
339 .arg(TTColorToString(ttcolor)));
340
341 m_bgColor = ttcolortoqcolor(ttcolor);
342 m_bgColor.setAlpha((ttcolor & kTTColorTransparent) ?
343 0x00 : gTTBackgroundAlpha);
344}
345
346void TeletextScreen::DrawLine(const tt_line_array& page, uint row, int lang)
347{
348 unsigned char last_ch = ' ';
349
350 uint fgcolor = kTTColorWhite;
351 uint bgcolor = kTTColorBlack;
352
354 {
355 bgcolor = kTTColorTransparent;
356
357 bool isBlank = true;
358 for (uint i = (row == 1 ? 8 : 0); i < (uint) kTeletextColumns; i++)
359 {
360 unsigned char ch = page[i] & 0x7F;
361 if (ch != ' ')
362 {
363 isBlank = false;
364 break;
365 }
366 }
367
368 if (isBlank)
369 return;
370 }
371
372 SetForegroundColor(fgcolor);
373 SetBackgroundColor(bgcolor);
374
375 bool mosaic = false;
376 [[maybe_unused]] bool seperation = false;
377 bool conceal = false;
378 [[maybe_unused]] bool flash = false;
379 bool doubleheight = false;
380 [[maybe_unused]] bool blink = false;
381 bool hold = false;
382 bool endbox = false;
383 bool startbox = false;
384 bool withinbox = false;
385 uint flof_link_count = 0;
386 uint old_bgcolor = bgcolor;
387
388 if (row == 1)
389 {
390 for (uint x = 0; x < 8; x++)
391 DrawBackground(x, 1);
392 }
393
394 for (uint x = (row == 1 ? 8 : 0); x < (uint)kTeletextColumns; ++x)
395 {
396 if (startbox)
397 {
398 old_bgcolor = bgcolor;
399 if (kTTColorTransparent & bgcolor)
400 bgcolor = bgcolor & ~kTTColorTransparent;
401 startbox = false;
402 withinbox = true;
403 }
404
405 if (endbox)
406 {
407 bgcolor = old_bgcolor;
408 endbox = false;
409 withinbox = false;
410 }
411
412 SetForegroundColor(fgcolor);
413 SetBackgroundColor(bgcolor);
414
415 unsigned char ch = page[x] & 0x7F;
416 bool reserved = false;
417 switch (ch)
418 {
419 case 0x00: case 0x01: case 0x02: case 0x03:
420 case 0x04: case 0x05: case 0x06: case 0x07: // alpha + foreground color
421 fgcolor = ch & 7;
422 mosaic = false;
423 conceal = false;
424 // increment FLOF/FastText count if menu item detected
425 flof_link_count += (row == 25) ? 1 : 0;
426 break;
427 case 0x08: // flash
428 // XXX
429 break;
430 case 0x09: // steady
431 flash = false;
432 break;
433 case 0x0a: // end box
434 endbox = true;
435 break;
436 case 0x0b: // start box
437 if (x < kTeletextColumns - 1 && ((page[x + 1] & 0x7F) == 0x0b))
438 startbox = true;
439 break;
440 case 0x0c: // normal height
441 doubleheight = false;
442 break;
443 case 0x0d: // double height
444 doubleheight = (row < (kTeletextRows-1)) && (x < (kTeletextColumns - 1));
445 break;
446
447 case 0x10: case 0x11: case 0x12: case 0x13:
448 case 0x14: case 0x15: case 0x16: case 0x17: // graphics + foreground color
449 fgcolor = ch & 7;
450 mosaic = true;
451 conceal = false;
452 break;
453 case 0x18: // conceal display
454 conceal = true;
455 break;
456 case 0x19: // contiguous graphics
457 seperation = false;
458 break;
459 case 0x1a: // separate graphics
460 seperation = true;
461 break;
462 case 0x1c: // black background
463 bgcolor = kTTColorBlack;
464 break;
465 case 0x1d: // new background
466 bgcolor = fgcolor;
467 break;
468 case 0x1e: // hold graphics
469 hold = true;
470 break;
471 case 0x1f: // release graphics
472 hold = false;
473 break;
474 case 0x0e: // SO (reserved, double width)
475 case 0x0f: // SI (reserved, double size)
476 case 0x1b: // ESC (reserved)
477 reserved = true;
478 break;
479
480 default:
481 if ((ch >= 0x80) && (ch <=0x9f)) // these aren't used
482 ch = ' '; // BAD_CHAR;
483 else
484 {
485 if (conceal && !m_teletextReader->RevealHidden())
486 ch = ' ';
487 }
488 break;
489 }
490
491 // Extra processing for control characters
492 if (ch < 0x20)
493 ch = (hold && mosaic && !reserved) ? last_ch : ' ';
494
495 // Hide FastText/FLOF menu characters if not available
496 if (flof_link_count && (flof_link_count <= 6))
497 {
499
500 if (ttpage)
501 {
502 bool has_flof = ttpage->floflink[flof_link_count - 1] != 0;
503 ch = (has_flof) ? ch : ' ';
504 }
505 }
506
507 uint newfgcolor = fgcolor;
508 uint newbgcolor = bgcolor;
509
510 SetForegroundColor(newfgcolor);
511 SetBackgroundColor(newbgcolor);
512 if ((row != 0) || (x > 7))
513 {
516
517 if (withinbox || !m_teletextReader->IsSubtitle())
518 {
519 DrawBackground(x, row);
520 if (doubleheight && row < (uint)kTeletextRows)
521 DrawBackground(x, row + 1);
522
523 if ((mosaic) && (ch < 0x40 || ch > 0x5F))
524 {
525 SetBackgroundColor(newfgcolor);
526 DrawMosaic(x, row, ch, doubleheight);
527 }
528 else
529 {
530 QChar c2 = cvt_char(ch, lang);
531 DrawCharacter(x, row, c2, doubleheight);
532 }
533 }
534 }
535 }
536}
537
538void TeletextScreen::DrawCharacter(int x, int y, QChar ch, bool doubleheight)
539{
540 QString line = ch;
541 if (line == " ")
542 return;
543
544 int row = y;
545 x *= m_colWidth;
546 y *= m_rowHeight;
547 int height = m_rowHeight * (doubleheight ? 2 : 1);
548 QRect rect(x, y, m_colWidth, height);
549
550 if (doubleheight)
551 {
552 gTTFont->GetFace()->setPixelSize(m_fontHeight * 2);
553 gTTFont->GetFace()->setStretch(m_fontStretch / 2);
554 }
555
556 QImage* image = GetRowImage(row, rect);
557 if (image)
558 {
559 QPainter painter(image);
560 painter.setFont(gTTFont->face());
561 painter.setPen(gTTFont->color());
562 painter.drawText(rect, Qt::AlignCenter, line);
563 painter.end();
564 }
565
566 if (row & 1)
567 {
568 row++;
569 rect = QRect(x, y + m_rowHeight, m_colWidth, height);
570 rect.translate(0, -m_rowHeight);
571 image = GetRowImage(row, rect);
572 if (image)
573 {
574 QPainter painter(image);
575 painter.setFont(gTTFont->face());
576 painter.setPen(gTTFont->color());
577 painter.drawText(rect, Qt::AlignCenter, line);
578 painter.end();
579 }
580 }
581
582 if (doubleheight)
583 {
584 gTTFont->GetFace()->setPixelSize(m_fontHeight);
585 gTTFont->GetFace()->setStretch(m_fontStretch);
586 }
587}
588
590{
591 int row = y;
592 x *= m_colWidth;
593 y *= m_rowHeight;
594 DrawRect(row, QRect(x, y, m_colWidth, m_rowHeight));
595}
596
597void TeletextScreen::DrawRect(int row, QRect rect)
598{
599 QImage* image = GetRowImage(row, rect);
600 if (!image)
601 return;
602
603 QBrush bgfill = QBrush(m_bgColor, Qt::SolidPattern);
604 QPainter painter(image);
605 painter.setBrush(bgfill);
606 painter.setPen(QPen(Qt::NoPen));
607 painter.drawRect(rect);
608 painter.end();
609}
610
611void TeletextScreen::DrawMosaic(int x, int y, int code, bool doubleheight)
612{
613 int row = y;
614 x *= m_colWidth;
615 y *= m_rowHeight;
616
617 int dx = (int)round((double)m_colWidth / 2) + 1;
618 int dy = (int)round((double)m_rowHeight / 3) + 1;
619 dy = (doubleheight) ? (2 * dy) : dy;
620
621 if (code & 0x10)
622 DrawRect(row, QRect(x, y + (2*dy), dx, dy));
623 if (code & 0x40)
624 DrawRect(row, QRect(x + dx, y + (2*dy), dx, dy));
625 if (code & 0x01)
626 DrawRect(row, QRect(x, y, dx, dy));
627 if (code & 0x02)
628 DrawRect(row, QRect(x + dx, y, dx, dy));
629 if (code & 0x04)
630 DrawRect(row, QRect(x, y + dy, dx, dy));
631 if (code & 0x08)
632 DrawRect(row, QRect(x + dx, y + dy, dx, dy));
633}
634
636{
639
641 for (int i = 0; i < 40; ++i)
642 DrawBackground(i, 0);
643
644 DrawCharacter(1, 0, 'P', false);
645 DrawCharacter(2, 0, QChar(m_teletextReader->GetPageInput(0)), false);
646 DrawCharacter(3, 0, QChar(m_teletextReader->GetPageInput(1)), false);
647 DrawCharacter(4, 0, QChar(m_teletextReader->GetPageInput(2)), false);
648
650
651 if (!ttpage)
652 {
653 QString str = QObject::tr("Page Not Available",
654 "Requested Teletext page not available");
655 for (int i = 0; (i < 30) && i < str.length(); i++)
656 DrawCharacter(i+10, 0, str[i], false);
657
658 return;
659 }
660
661 QString str = m_teletextReader->GetPage();
662 if (str.isEmpty())
663 return;
664
666 for (int x = 0; x < 11; x++)
667 {
670 else
672
673 DrawBackground((x * 3) + 7, 0);
674
675 if (str[x * 3] == '*')
676 {
677 str[x * 3] = ' ';
679 }
680
681 DrawBackground((x * 3) + 8, 0);
682 DrawBackground((x * 3) + 9, 0);
683
684 DrawCharacter((x * 3) + 7, 0, str[x * 3], false);
685 DrawCharacter((x * 3) + 8, 0, str[(x * 3) + 1], false);
686 DrawCharacter((x * 3) + 9, 0, str[(x * 3) + 2], false);
687 }
688}
689
691{
692 static bool s_initialised = false;
693 //QString font = gCoreContext->GetSetting("DefaultSubtitleFont", "FreeMono");
694 if (s_initialised)
695 {
696 return true;
697#if 0
698 if (gTTFont->face().family() == font)
699 return true;
700 delete gTTFont;
701#endif // 0
702 }
703
704 auto *mythfont = new MythFontProperties();
706 if (mythfont)
707 {
708 QFont newfont(font);
709 mythfont->SetFace(newfont);
710 gTTFont = mythfont;
711 }
712 else
713 {
714 return false;
715 }
716
718
719 s_initialised = true;
720 LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Loaded main subtitle font '%1'")
721 .arg(font));
722 return true;
723}
QColor color(void) const
QFont face(void) const
void SetColor(const QColor &color)
void Assign(const QImage &img)
Definition: mythimage.cpp:77
int DecrRef(void) override
Decrements reference count and deletes on 0.
Definition: mythimage.cpp:52
MythImage * GetFormatImage()
Returns a blank reference counted image in the format required for the Draw functions for this painte...
MythVideoOutput * GetVideoOutput(void)
Definition: mythplayer.h:163
virtual TeletextReader * GetTeletextReader(uint=0)
Definition: mythplayer.h:195
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:18
Screen in which all other widgets are contained and rendered.
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
The base class on which all widgets and screens are based.
Definition: mythuitype.h:86
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:595
void SetRedraw(void)
Definition: mythuitype.cpp:298
void DeleteAllChildren(void)
Delete all child widgets.
Definition: mythuitype.cpp:207
MythPainter * m_painter
Definition: mythuitype.h:298
QList< MythUIType * > m_childrenList
Definition: mythuitype.h:255
QRect GetSafeRect()
Returns a QRect describing an area of the screen on which it is 'safe' to render the On Screen Displa...
static int GetTeletextBackgroundAlpha(void)
static QString GetTeletextFontName(void)
void SetShowHeader(bool show)
bool IsSubtitle(void) const
bool RevealHidden(void) const
void SetHeaderChanged(bool changed)
TeletextSubPage * FindSubPage(void)
void SetPage(int page, int subpage)
tt_line_array GetHeader(void)
void SetSubPage(int subpage)
bool PageChanged(void) const
bool KeyPress(const QString &Key, bool &Exit)
int GetPageInput(uint num) const
QString GetPage(void)
void SetIsSubtitle(bool sub)
void SetPageChanged(bool changed)
bool IsTransparent(void) const
MythPlayer * m_player
void DrawLine(const tt_line_array &page, uint row, int lang)
static void SetForegroundColor(int color)
static const QColor kColorRed
static const QColor kColorMagenta
static const QColor kColorGreen
void SetPage(int page, int subpage)
static bool InitialiseFont()
bool KeyPress(const QString &Key, bool &Exit)
static const QColor kColorBlack
static const int kTeletextRows
void DrawHeader(const tt_line_array &page, int lang)
~TeletextScreen() override
TeletextScreen(MythPlayer *Player, MythPainter *Painter, const QString &Name, int FontStretch)
void Pulse() override
Pulse is called 70 times a second to trigger a single frame of an animation.
bool Create() override
void DrawRect(int row, QRect rect)
void OptimiseDisplayedArea()
QHash< int, QImage * > m_rowImages
void DrawMosaic(int x, int y, int code, bool doubleheight)
void SetDisplaying(bool display)
void Reset() override
Reset the widget to it's original state, should not reset changes made by the theme.
void DrawBackground(int x, int y)
void DrawCharacter(int x, int y, QChar ch, bool doubleheight=false)
void SetBackgroundColor(int color)
TeletextReader * m_teletextReader
static const QColor kColorYellow
static const QColor kColorWhite
static const QColor kColorCyan
static const int kTeletextColumns
QImage * GetRowImage(int row, QRect &rect)
static const QColor kColorBlue
int subpagenum
the wanted subpage
int flags
misc flags
int lang
language code
std::array< int, 6 > floflink
FastText links (FLOF)
bool subtitle
page is subtitle page
std::array< tt_line_array, 25 > data
page data
unsigned int uint
Definition: compat.h:60
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
bool isBlank(unsigned char median, float stddev, unsigned char maxmedian, float maxstddev)
@ kTTColorRed
@ kTTColorWhite
@ kTTColorGreen
@ kTTColorYellow
@ kTTColorMagenta
@ kTTColorBlue
@ kTTColorTransparent
@ kTTColorBlack
@ kTTColorCyan
static constexpr uint8_t TP_NEWSFLASH
static constexpr uint8_t TP_SUBTITLE
std::array< uint8_t, 40 > tt_line_array
static constexpr uint8_t TP_SUPPRESS_HEADER
#define LOC
static QString TTColorToString(int ttcolor)
static constexpr std::array< const std::array< const uint8_t, 16 >, 1+8+8 > lang_chars
static MythFontProperties * gTTFont
static QChar cvt_char(char ch, int lang)
static QColor ttcolortoqcolor(int ttcolor)
static int gTTBackgroundAlpha