8#include <QCoreApplication>
11#include <QRegularExpression>
29#define LOC QString("MythUIButtonList(%1): ").arg(objectName())
34 , m_shadowListName(
std::move(shadow))
44 const QRect area,
bool showArrow,
47 m_showArrow(showArrow), m_showScrollBar(showScrollBar)
100void MythUIButtonList::SetDrawFromBottom(
bool draw)
102 m_drawFromBottom = draw;
160 int width = area.width();
168 width += ((area.x() * 2) - 1);
190 int height = area.height();
198 height += ((area.y() * 2) - 1);
221 buttonIdx += button_shift;
225 QString name = QString(
"buttonlist button %1").arg(
m_maxVisible);
228 button->ConnectDependants(
true);
240 if (selectedIdx >= 0)
258 selectedIdx = buttonIdx;
267 int &first_item,
int &last_item,
268 int &selected_column,
int &skip_cols,
269 bool grow_left,
bool grow_right,
270 int **col_widths,
int &row_height,
271 int total_height,
int split_height,
272 int &col_cnt,
bool &wrapped)
279 bool underflow =
false;
281 int selectedIdx = -1;
282 int button_shift = 0;
286 if (last_item + 1 >
m_itemCount || last_item < 0 || first_item < 0)
296 selectedIdx, button_shift);
301 selectedIdx, button_shift);
304 if (buttonstate ==
nullptr)
306 LOG(VB_GENERAL, LOG_ERR, QString(
"Failed to query buttonlist state: %1")
322 bool hsplit = vsplit && grow_left && grow_right;
327 left_width = right_width = (width / 2);
351 if (total_height > 0 &&
352 ((vsplit ? split_height : total_height) +
355 LOG(VB_GUI, LOG_DEBUG,
356 QString(
"%1 Height exceeded %2 + (%3) + %4 = %5 which is > %6")
357 .arg(vsplit ?
"Centering" :
"Total")
361 first_button += button_shift;
362 last_button += button_shift;
366 LOG(VB_GUI, LOG_DEBUG, QString(
"Added button item %1 width %2 height %3")
367 .arg(grow_right ? last_item : first_item)
368 .arg(width).arg(row_height));
370 int initial_first_button = first_button;
371 int initial_last_button = last_button;
372 int initial_first_item = first_item;
373 int initial_last_item = last_item;
413 if (last_item + 1 < end)
417 selectedIdx, button_shift);
419 if (buttonstate ==
nullptr)
425 if (*col_widths && width < (*col_widths)[col_idx])
426 width = (*col_widths)[col_idx];
429 if ((hsplit ? right_width : left_width + right_width) +
432 int total = hsplit ? right_width : left_width + right_width;
433 LOG(VB_GUI, LOG_DEBUG,
434 QString(
"button on right would exceed width: "
435 "%1+(%2)+%3 == %4 which is > %5")
450 row_height = std::max(row_height, height);
452 LOG(VB_GUI, LOG_DEBUG,
453 QString(
"Added button item %1 "
454 "R.width %2 height %3 total width %4+%5"
456 .arg(last_item).arg(width).arg(height)
457 .arg(left_width).arg(right_width).arg(max_width));
488 if (first_item > end)
490 buttonstate =
PrepareButton(first_button - 1, first_item - 1,
491 selectedIdx, button_shift);
493 if (buttonstate ==
nullptr)
499 if (*col_widths && width < (*col_widths)[col_idx])
500 width = (*col_widths)[col_idx];
503 if ((hsplit ? left_width : left_width + right_width) +
506 int total = hsplit ? left_width : left_width + right_width;
507 LOG(VB_GUI, LOG_DEBUG,
508 QString(
"button on left would exceed width: "
509 "%1+(%2)+%3 == %4 which is > %5")
524 row_height = std::max(row_height, height);
526 LOG(VB_GUI, LOG_DEBUG,
527 QString(
"Added button item %1 "
528 "L.width %2 height %3 total width %4+%5"
530 .arg(first_item).arg(width).arg(height)
531 .arg(left_width).arg(right_width).arg(max_width));
548 if (total_height > 0 &&
549 ((vsplit ? split_height : total_height) +
552 LOG(VB_GUI, LOG_DEBUG,
553 QString(
"%1 Height exceeded %2 + (%3) + %4 = %5 which is > %6")
554 .arg(vsplit ?
"Centering" :
"Total")
558 first_button = initial_first_button + button_shift;
559 last_button = initial_last_button + button_shift;
560 first_item = initial_first_item;
561 last_item = initial_last_item;
565 if (*col_widths ==
nullptr)
571 *col_widths =
new int[
static_cast<size_t>(col_cnt)];
573 for (col_idx = 0; col_idx < col_cnt; ++col_idx)
574 (*col_widths)[col_idx] = 0;
579 first_button += button_shift;
580 last_button += button_shift;
588 begin = first_button;
589 end = first_button + col_cnt;
593 end = last_button + 1;
594 begin = end - col_cnt;
597 for (buttonIdx = begin, col_idx = 0;
598 buttonIdx < end; ++buttonIdx, ++col_idx)
607 (*col_widths)[col_idx] = std::max((*col_widths)[col_idx], width);
610 if (selectedIdx == buttonIdx)
611 selected_column = col_idx;
618 if (total_height && underflow && col_cnt <
m_columns)
628 int &first_item,
int &last_item,
629 int &selected_column,
int &selected_row,
630 int &skip_cols,
int **col_widths,
631 QList<int> & row_heights,
632 int &top_height,
int &bottom_height,
664 if (last_item + 1 < end)
668 first_item, ++last_item, selected_column,
669 skip_cols,
false,
true, col_widths, height,
670 top_height + bottom_height, bottom_height,
676 if (selected_row == -1 && selected_column != -1)
677 selected_row = row_heights.size();
679 row_heights.push_back(height);
710 if (first_item > end)
714 --first_item, last_item, selected_column,
715 skip_cols,
true,
false, col_widths, height,
716 top_height + bottom_height, top_height,
722 if (selected_row == -1 && selected_column != -1)
723 selected_row = row_heights.size();
724 else if (selected_row != -1)
727 row_heights.push_front(height);
747 int first_button = 0;
749 int start_button = 0;
754 int *col_widths =
nullptr;
756 int selected_column = -1;
757 int selected_row = -1;
758 bool wrapped =
false;
759 bool grow_left =
true;
762 int bottom_height = 0;
764 QList<int> row_heights;
769 LOG(VB_GUI, LOG_DEBUG, QString(
"DistributeButtons: "
770 "selected item %1 total items %2")
791 first_item = last_item = start_item;
809 first_item = last_item = 0;
838 first_button = last_button = start_button;
843 first_item, last_item, selected_column,
844 skip_cols, grow_left,
true, &col_widths,
845 height, 0, 0, col_cnt, wrapped))
860 first_item = last_item = start_item;
866#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
869 start_button = std::max(
m_buttonList.size() / 2,
static_cast<qsizetype
>(0));
877 first_button = last_button = start_button;
880 selected_column = selected_row = -1;
883 first_item, last_item, selected_column,
884 skip_cols, grow_left,
true, &col_widths,
885 height, 0, 0, col_cnt, wrapped))
892 if (selected_column != -1)
895 row_heights.push_back(height);
898 top_height = bottom_height = (height / 2);
900 bottom_height = height;
907 first_item, last_item,
908 selected_column, selected_row,
909 skip_cols, &col_widths, row_heights,
910 top_height, bottom_height, wrapped))
914 col_widths =
nullptr;
920 m_rows = row_heights.size();
922 LOG(VB_GUI, LOG_DEBUG,
923 QString(
"%1 rows, %2 columns fit inside parent area %3x%4")
927 if (col_widths ==
nullptr)
931 int left_spacing = 0;
932 int right_spacing = 0;
934 int bottom_spacing = 0;
943 status_msg =
"Row heights: ";
945 for (
int row = 0; row <
m_rows; ++row)
950 if (row == selected_row)
953 top_height += (row_heights[row] / 2);
954 bottom_height += ((row_heights[row] / 2) + (row_heights[row] % 2));
970 status_msg += QString(
"%1").arg(row_heights[row]);
972 if (row == selected_row)
982 top_spacing = bottom_spacing = 0;
989 top_spacing = bottom_spacing =
1005 if (!
m_topRows || top_spacing > bottom_spacing)
1006 top_spacing = bottom_spacing;
1008 bottom_spacing = top_spacing;
1015 (top_height + bottom_height)) /
1021 top_height += (top_spacing *
m_topRows);
1035 y += std::max(bottom_height - top_height, 0);
1036 total = std::max(top_height, bottom_height) * 2;
1040 total = top_height + bottom_height;
1050 (top_height + bottom_height), 0);
1054 status_msg += QString(
" spacing top %1 bottom %2 fixed %3 offset %4")
1055 .arg(top_spacing).arg(bottom_spacing)
1058 LOG(VB_GUI, LOG_DEBUG, status_msg);
1064 int right_width = 0;
1067 status_msg =
"Col widths: ";
1069 for (
int col = 0; col <
m_columns; ++col)
1074 if (col == selected_column)
1077 left_width += (col_widths[col] / 2);
1078 right_width += ((col_widths[col] / 2) + (col_widths[col] % 2));
1094 status_msg += QString(
"%1").arg(col_widths[col]);
1096 if (col == selected_column)
1106 left_spacing = right_spacing = 0;
1113 left_spacing = right_spacing =
1130 left_spacing = right_spacing;
1132 right_spacing = left_spacing;
1139 (left_width + right_width)) /
1159 x_init += std::max(right_width - left_width, 0);
1160 total = std::max(left_width, right_width) * 2;
1164 total = left_width + right_width;
1174 (left_width + right_width), 0);
1176 min_rect.
setX(x_init);
1178 status_msg += QString(
" spacing left %1 right %2 fixed %3 offset %4")
1179 .arg(left_spacing).arg(right_spacing)
1181 LOG(VB_GUI, LOG_DEBUG, status_msg);
1189 int buttonIdx = first_button - skip_cols;
1194 int vertical_spacing = top_spacing;
1196 for (
int row = 0; row <
m_rows; ++row)
1199 int horizontal_spacing = left_spacing;
1201 for (
int col = 0; col <
m_columns && buttonIdx <= last_button; ++col)
1203 if (buttonIdx >= first_button)
1211 MythRect area = buttonstate->GetArea();
1214 if (alignment & Qt::AlignHCenter)
1216 else if (alignment & Qt::AlignRight)
1224 if (alignment & Qt::AlignVCenter)
1226 else if (alignment & Qt::AlignBottom)
1237 if (col == selected_column)
1239 horizontal_spacing = right_spacing;
1240 if (row == selected_row)
1244 x += col_widths[col] + horizontal_spacing;
1248 if (row == selected_row)
1249 vertical_spacing = bottom_spacing;
1251 y += row_heights[row] + vertical_spacing;
1253 min_rect.
setWidth(x - min_rect.x());
1259 for (buttonIdx = 0; buttonIdx < first_button; ++buttonIdx)
1263 for (buttonIdx =
m_maxVisible - 1; buttonIdx > last_button; --buttonIdx)
1279 delete[] col_widths;
1338 QList<MythUIButtonListItem *>::iterator it =
m_itemList.begin() +
1364 for (
int i = 0; i < button; ++i)
1367 bool seenSelected =
false;
1382 if (!realButton || !buttonItem)
1385 bool selected =
false;
1389 seenSelected =
true;
1438 QMap<int, MythUIButtonListItem*>::const_iterator i =
m_buttonToItem.constBegin();
1442 i.value()->setVisible(
false);
1494 if (listPosition >= 0 && listPosition <=
m_itemList.count())
1531 QMap<int, MythUIButtonListItem*>::iterator it =
m_buttonToItem.begin();
1534 if (it.value() == item)
1582 if (item->GetData() == data)
1637 return item->
GetText().toInt();
1680 QListIterator<MythUIButtonListItem *> it(
m_itemList);
1682 if (!it.findNext(item))
1685 return it.previous();
1724 if (item->GetData() == data)
1746 QString name(
"buttonlist button 0");
1749 button->ConnectDependants(
true);
1789 for (; pos >= 0; --pos)
1798 if (buttonstate ==
nullptr)
1800 LOG(VB_GENERAL, LOG_ERR,
1801 "PageUp: Failed to query buttonlist state");
1806 (buttonstate->GetArea().width() / 2) >= max_width)
1842 for (; pos >= 0; pos -= dec)
1851 if (buttonstate ==
nullptr)
1853 LOG(VB_GENERAL, LOG_ERR,
1854 "PageUp: Failed to query buttonlist state");
1859 (buttonstate->GetArea().height() / 2) >= max_height)
1895 for (; pos < num_items; ++pos)
1904 if (buttonstate ==
nullptr)
1906 LOG(VB_GENERAL, LOG_ERR,
1907 "PageDown: Failed to query buttonlist state");
1912 (buttonstate->GetArea().width() / 2) >= max_width)
1922 return num_items - 1;
1948 for (; pos < num_items; pos += inc)
1959 LOG(VB_GENERAL, LOG_ERR,
1960 "PageDown: Failed to query buttonlist state");
1965 (buttonstate->GetArea().height() / 2) >= max_height)
1975 return num_items - 1;
2079 for (
uint i = 0; i < amount; ++i)
2113 if (m_selPosition < 0 || m_selPosition >=
m_itemList.size() ||
2158 if (m_selPosition < 0 || m_selPosition >=
m_itemList.size() ||
2297 for (
uint i = 0; i < amount; ++i)
2335 bool found_it =
false;
2336 int selectedPosition = 0;
2337 QList<MythUIButtonListItem *>::iterator it =
m_itemList.begin();
2341 if ((*it)->GetText() == position_name)
2371 bool dolast =
false;
2410 QMutableListIterator<MythUIButtonListItem *> it(
m_itemList);
2412 while (it.hasNext())
2413 it.next()->setChecked(state);
2440 LOG(VB_GENERAL, LOG_ERR, QString(
"(%1) Statetype buttonitem is "
2441 "required in mythuibuttonlist: %2")
2453 if (buttonActiveState)
2454 buttonItemArea = buttonActiveState->
GetArea();
2477 QString name = QString(
"buttonlist button %1").arg(i);
2480 button->ConnectDependants(
true);
2503 if (buttonSelectedState)
2539 QStringList actions;
2540 bool handled =
false;
2544 for (
const QString&
action : std::as_const(actions))
2553 QKeySequence a(key);
2557#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
2559 Qt::KeyboardModifiers modifiers = Qt::NoModifier;
2560 QStringList parts = key.split(
'+');
2561 for (
int j = 0; j < parts.count(); ++j)
2563 if (parts[j].toUpper() ==
"CTRL")
2564 modifiers |= Qt::ControlModifier;
2565 if (parts[j].toUpper() ==
"SHIFT")
2566 modifiers |= Qt::ShiftModifier;
2567 if (parts[j].toUpper() ==
"ALT")
2568 modifiers |= Qt::AltModifier;
2569 if (parts[j].toUpper() ==
"META")
2570 modifiers |= Qt::MetaModifier;
2573 int keyCode = a[0].key();
2574 Qt::KeyboardModifiers modifiers = a[0].keyboardModifiers();
2577 QCoreApplication::postEvent(
2579 new QKeyEvent(QEvent::KeyPress, keyCode, modifiers, key));
2580 QCoreApplication::postEvent(
2582 new QKeyEvent(QEvent::KeyRelease, keyCode, modifiers, key));
2588 for (
int i = 0; i < actions.size() && !handled; ++i)
2590 const QString&
action = actions[i];
2600 else if (
action ==
"DOWN")
2607 else if (
action ==
"RIGHT")
2623 else if (
action ==
"LEFT")
2639 else if (
action ==
"PAGEUP")
2643 else if (
action ==
"PAGEDOWN")
2647 else if (
action ==
"PAGETOP")
2651 else if (
action ==
"PAGEMIDDLE")
2655 else if (
action ==
"PAGEBOTTOM")
2659 else if (
action ==
"SELECT")
2666 else if (
action ==
"SEARCH")
2684 bool handled =
false;
2691 QPoint position =
event->GetPosition() -
2703 QString name =
object->objectName();
2705 if (name ==
"upscrollarrow")
2709 else if (name ==
"downscrollarrow")
2713 else if (name.startsWith(
"buttonlist button"))
2715 int pos = name.section(
' ', 2, 2).toInt();
2790 (QEvent::Type) QEvent::registerEventType();
2798 int cur = npe->m_start;
2799 for (; cur < npe->m_start + npe->m_pageSize && cur <
GetCount(); ++cur)
2801 const int loginterval = (cur < 1000 ? 100 : 500);
2802 if (cur > 200 && cur % loginterval == 0)
2803 LOG(VB_GUI, LOG_INFO,
2804 QString(
"Build background buttonlist item %1").arg(cur));
2894 const QString &
filename, QDomElement &element,
bool showWarnings)
2896 if (element.tagName() ==
"buttonarea")
2898 else if (element.tagName() ==
"layout")
2902 if (layout ==
"grid")
2904 else if (layout ==
"horizontal")
2909 else if (element.tagName() ==
"arrange")
2913 if (arrange ==
"fill")
2915 else if (arrange ==
"spread")
2917 else if (arrange ==
"stack")
2923 else if (element.tagName() ==
"align")
2928 else if (element.tagName() ==
"shadowalign")
2933 else if (element.tagName() ==
"scrollstyle")
2937 if (layout ==
"center")
2939 else if (layout ==
"groupcenter")
2941 else if (layout ==
"free")
2944 else if (element.tagName() ==
"wrapstyle")
2948 if (wrapstyle ==
"captive")
2950 else if (wrapstyle ==
"none")
2952 else if (wrapstyle ==
"selection")
2954 else if (wrapstyle ==
"flowing")
2956 else if (wrapstyle ==
"items")
2959 else if (element.tagName() ==
"showarrow")
2963 else if (element.tagName() ==
"showscrollbar")
2967 else if (element.tagName() ==
"spacing")
2972 else if (element.tagName() ==
"drawfrombottom")
2979 else if (element.tagName() ==
"shadowdrawfrombottom")
2986 else if (element.tagName() ==
"searchposition")
2990 else if (element.tagName() ==
"triggerevent")
2993 if (!trigger.isEmpty())
2995 QString
action = element.attribute(
"action",
"");
3002 QString context = element.attribute(
"context",
"");
3004 QStringList keys = keylist.split(
',', Qt::SkipEmptyParts);
3087 QString name = QString(
"buttonlist button %1").arg(i);
3119 if (lcddev ==
nullptr)
3123 QList<LCDMenuItem> menuItems;
3128 for (
int r = start; r < end; ++r)
3150 text +=
" ~ " + props.
text;
3158 text +=
" ~ " + item->
GetText();
3162 if (!text.isEmpty())
3163 menuItems.append(
LCDMenuItem(selected, state, text));
3168 if (!menuItems.isEmpty())
3185 QRect dialogArea = dlg->GetArea();
3188 x = (screenArea.width() - dialogArea.width()) / 2;
3191 y = (screenArea.height() - dialogArea.height()) / 2;
3193 dlg->SetPosition(x, y);
3208 return DoFind(
false,
true);
3213 return DoFind(
true,
true);
3218 return DoFind(
true,
false);
3230 int currPos = startPos;
3276 if (startPos == currPos)
3286 QString text, QString image,
3288 bool showArrow,
int listPosition)
3289 : m_parent(lbtype), m_text(
std::move(text)), m_imageFilename(
std::move(image)),
3290 m_checkable(checkable), m_state(state), m_showArrow(showArrow)
3293 LOG(VB_GENERAL, LOG_ERR,
"Cannot add a button to a non-existent list!");
3303 const QString &text,
3304 QVariant data,
int listPosition)
3307 LOG(VB_GENERAL, LOG_ERR,
"Cannot add a button to a non-existent list!");
3311 m_data = std::move(data);
3333 QMap<QString, MythImage*>::iterator it;
3343 const QString &state)
3345 if (!name.isEmpty())
3348 textprop.
text = text;
3362 const QString &state)
3364 InfoMap::const_iterator map_it = infoMap.begin();
3366 while (map_it != infoMap.end())
3369 textprop.
text = (*map_it);
3398 if (!result.isEmpty())
3413 if (!result.isEmpty())
3414 return {result,
""};
3422 bool startsWith)
const
3424 if (fieldList.isEmpty())
3427 return m_text.startsWith(searchStr, Qt::CaseInsensitive);
3428 return m_text.contains(searchStr, Qt::CaseInsensitive);
3430 if (fieldList ==
"**ALL**")
3434 if (
m_text.startsWith(searchStr, Qt::CaseInsensitive))
3439 if (
m_text.contains(searchStr, Qt::CaseInsensitive))
3443 QMap<QString, TextProperties>::const_iterator i =
m_strings.constBegin();
3449 if (i.value().text.startsWith(searchStr, Qt::CaseInsensitive))
3454 if (i.value().text.contains(searchStr, Qt::CaseInsensitive))
3463 QStringList fields = fieldList.split(
',', Qt::SkipEmptyParts);
3464 for (
int x = 0; x < fields.count(); ++x)
3466 if (
m_strings.contains(fields.at(x).trimmed()))
3470 if (
m_strings[fields.at(x)].text.startsWith(searchStr, Qt::CaseInsensitive))
3475 if (
m_strings[fields.at(x)].text.contains(searchStr, Qt::CaseInsensitive))
3486 const QString &name)
3488 if (!name.isEmpty())
3507 if (!name.isEmpty())
3509 QMap<QString, MythImage*>::iterator it =
m_images.find(name);
3548 if (!name.isEmpty())
3550 QMap<QString, MythImage*>::iterator it =
m_images.find(name);
3567 const QString &
filename,
const QString &name,
bool force_reload)
3569 bool do_update = force_reload;
3571 if (!name.isEmpty())
3604 if (!result.isEmpty())
3637 const QString &name)
3642 bool do_update =
false;
3643 InfoMap::iterator it =
m_states.find(name);
3650 else if (*it !=
state)
3679 if (!result.isEmpty())
3735 m_data = std::move(data);
3767 buttonimage->
Load();
3802 if (!buttonprogress)
3810 if (!buttonprogress)
3824 static const QRegularExpression re {R
"(%(([^\|%]+)?\||\|(.))?([\w#]+)(\|(.+?))?%)",
3825 QRegularExpression::DotMatchesEverythingOption};
3827 if (!newText.isEmpty() && newText.contains(re))
3829 QString tempString = newText;
3831 QRegularExpressionMatchIterator i = re.globalMatch(newText);
3832 while (i.hasNext()) {
3833 QRegularExpressionMatch match = i.next();
3834 QString key = match.captured(4).toLower().trimmed();
3835 QString replacement;
3838 if (!value.isEmpty())
3840 replacement = QString(
"%1%2%3%4")
3841 .arg(match.captured(2),
3847 tempString.replace(match.captured(0), replacement);
3850 newText = tempString;
3854 newText = textprop.
text;
3857 if (newText.isEmpty())
3932 else if (
state ==
"selectedinactive" &&
3933 button->
GetState(
"selectedshadow"))
3934 state =
"selectedshadow";
3941 LOG(VB_GUI, LOG_WARNING,
"Theme Error: Missing buttonlist state: disabled");
3947 LOG(VB_GUI, LOG_WARNING,
"Theme Error: Missing buttonlist state: inactive");
3955 LOG(VB_GENERAL, LOG_CRIT, QString(
"Theme Error: Missing buttonlist state: %1")
3960 buttonstate->Reset();
3962 QList<MythUIType *> descendants = buttonstate->GetAllDescendants();
3963 for (
MythUIType *obj : std::as_const(descendants))
3965 QString name = obj->objectName();
3966 if (name ==
"buttontext")
3968 else if (name ==
"buttonimage")
3970 else if (name ==
"buttonarrow")
3972 else if (name ==
"buttoncheck")
3974 else if (name ==
"buttonprogress1")
3976 else if (name ==
"buttonprogress2")
3980 if (!textprop.
text.isEmpty())
3991 if (!luState.isEmpty())
4016 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSearchListDialog'");
4036 QStringList actions;
4039 for (
int i = 0; i < actions.size() && !handled; ++i)
4041 const QString&
action = actions[i];
void switchToMenu(QList< LCDMenuItem > &menuItems, const QString &app_name="", bool popMenu=true)
int getLCDHeight(void) const
A custom event that represents a mouse gesture.
Gesture GetGesture() const
int DecrRef(void) override
Decrements reference count and deletes on 0.
int IncrRef(void) override
Increments reference count.
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)
static QString GetKey(const QString &Context, const QString &Action)
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
MythPoint topLeft(void) const
void setY(const QString &sY)
void setX(const QString &sX)
void setWidth(const QString &sWidth)
void setHeight(const QString &sHeight)
void CalculateArea(QRect parentArea)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Create a group of widgets.
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 SetImage(MythImage *img)
Should not be used unless absolutely necessary since it bypasses the image caching and threaded loade...
void Reset(void) override
Reset the image back to the default defined in the theme.
void Set(int start, int total, int used)
This widget is used for grouping other widgets for display when a particular named state is called.
MythUIType * GetState(const QString &name)
MythUIType * GetCurrentState()
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
bool DisplayState(const QString &name)
QString GetText(void) const
void SetText(const QString &text, bool moveCursor=true)
All purpose text widget, displays a text string.
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
QString GetTemplateText(void) const
void SetFontState(const QString &state)
virtual void SetText(const QString &text)
The base class on which all widgets and screens are based.
bool IsEnabled(void) const
void SetCanTakeFocus(bool set=true)
Set whether this widget can take focus.
virtual void SetVisible(bool visible)
QString GetXMLLocation(void) const
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
MythUIType * GetChildAt(QPoint p, bool recursive=true, bool focusable=true) const
Return the first MythUIType at the given coordinates.
virtual void SetMinArea(const MythRect &rect)
Set the minimum area based on the given size.
static int NormY(int height)
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
virtual MythRect GetFullArea(void) const
void SetPosition(int x, int y)
Convenience method, calls SetPosition(const MythPoint&) Override that instead to change functionality...
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
void DeleteChild(const QString &name)
Delete a named child of this UIType.
void DependChanged(bool isDefault)
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
static int NormX(int width)
NextButtonListPageEvent(int start, int pageSize)
static const Type kEventType
static MythRect parseRect(const QString &text, bool normalize=true)
static MythPoint parsePoint(const QString &text, bool normalize=true)
static int parseAlignment(const QString &text)
static bool CopyWindowFromBase(const QString &windowname, MythScreenType *win)
static QString getFirstText(QDomElement &element)
static bool parseBool(const QString &text)
A C++ ripoff of the stroke library for MythTV.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
QHash< QString, QString > InfoMap
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)