14 #include <QWaitCondition>
15 #include <QApplication>
21 #include <QKeySequence>
22 #include <QInputMethodEvent>
66 #define LOC QString("MythMainWindow: ")
142 setObjectName(
"mainwindow");
159 installEventFilter(
this);
175 setUpdatesEnabled(
true);
178 Qt::BlockingQueuedConnection);
180 Qt::BlockingQueuedConnection);
323 if (widget->objectName() == Stackname)
330 if (Position >= 0 && Position < m_priv->m_stackList.size())
349 QVector<MythScreenType *> drawList;
350 (*it)->GetDrawOrder(drawList);
352 for (
auto *screen : qAsConst(drawList))
356 if (screen->NeedsRedraw())
358 QRegion topDirty = screen->GetDirtyArea();
359 screen->ResetNeedsRedraw();
370 widget->ScheduleInitIfNeeded();
397 QVector<MythScreenType *> redrawList;
398 (*it)->GetDrawOrder(redrawList);
400 for (
const auto *screen : qAsConst(redrawList))
402 if (screen->NeedsRedraw())
404 for (
const QRect& wrect: screen->GetDirtyArea())
406 bool foundThisRect =
false;
412 if (drect.contains(wrect))
414 foundThisRect =
true;
447 if (rect.width() == 0 || rect.height() == 0)
457 QVector<MythScreenType *> redrawList;
458 (*it)->GetDrawOrder(redrawList);
459 for (
auto *screen : qAsConst(redrawList))
460 screen->Draw(Painter, 0, 0, 255, rect);
471 return testAttribute(Qt::WA_PaintOnScreen) ? nullptr : QWidget::paintEngine();
476 if (
Event->spontaneous())
478 auto * key =
new QKeyEvent(QEvent::KeyPress,
m_priv->
m_escapekey, Qt::NoModifier);
479 QCoreApplication::postEvent(
this, key);
484 QWidget::closeEvent(
Event);
490 auto * active = QApplication::activeWindow();
493 winid = active->winId();
505 if (
auto * screen = display->GetCurrentScreen(); screen)
507 QPixmap image = screen->grabWindow(winid);
508 Image = image.toImage();
520 args << QString::number(Width);
521 args << QString::number(Height);
524 QCoreApplication::sendEvent(
this, &me);
536 if (Filename.isEmpty())
538 QString fpath =
GetMythDB()->GetSetting(
"ScreenShotPath",
"/tmp");
539 Filename = QString(
"%1/myth-screenshot-%2.png")
543 QString extension = Filename.section(
'.', -1, -1);
544 if (extension ==
"jpg")
549 LOG(VB_GENERAL, LOG_INFO, QString(
"Saving screenshot to %1 (%2x%3)")
550 .arg(Filename).arg(Image.width()).arg(Image.height()));
552 if (Image.save(Filename, extension.toLatin1(), 100))
554 LOG(VB_GENERAL, LOG_INFO,
"MythMainWindow::screenShot succeeded");
558 LOG(VB_GENERAL, LOG_INFO,
"MythMainWindow::screenShot Failed!");
569 Height = img.height();
570 img = img.scaled(Width, Height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
612 if (!updatesEnabled() && (
Event->type() == QEvent::UpdateRequest))
615 if (
Event->type() == QEvent::Show && !
Event->spontaneous())
625 if ((
Event->type() == QEvent::WindowActivate) || (
Event->type() == QEvent::WindowDeactivate))
628 return QWidget::event(
Event);
635 QApplication::setStyle(
"Windows");
648 Qt::WindowFlags flags = Qt::Window;
656 setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint);
660 LOG(VB_GENERAL, LOG_INFO,
"Using Frameless Window");
661 flags |= Qt::FramelessWindowHint;
666 flags |= Qt::MSWindowsOwnDC;
674 if (fullscreen && !inwindow)
676 LOG(VB_GENERAL, LOG_INFO,
"Using Full Screen Window");
681 setWindowState(Qt::WindowFullScreen);
687 setWindowState(Qt::WindowNoState);
691 flags |= Qt::WindowStaysOnTopHint;
693 setWindowFlags(flags);
709 if (!
GetMythDB()->GetBoolSetting(
"HideMouseCursor",
false))
710 setMouseTracking(
true);
718 LOG(VB_GENERAL, LOG_INFO,
"Destroying painter and painter window");
723 if (!warningmsg.isEmpty())
725 LOG(VB_GENERAL, LOG_WARNING, warningmsg);
730 LOG(VB_GENERAL, LOG_ERR,
"MythMainWindow failed to create a painter window.");
736 setAttribute(Qt::WA_NoSystemBackground);
737 setAutoFillBackground(
false);
739 setAttribute(Qt::WA_InputMethodEnabled);
747 static const QLatin1String EARLY_SHOW_PLATFORM_NAME_CHECK {
"android" };
749 static const QLatin1String EARLY_SHOW_PLATFORM_NAME_CHECK {
"egl" };
751 if (QGuiApplication::platformName().contains(EARLY_SHOW_PLATFORM_NAME_CHECK))
752 QCoreApplication::processEvents();
754 if (!
GetMythDB()->GetBoolSetting(
"HideMouseCursor",
false))
768 if (!warningmsg.isEmpty())
781 QtAndroid::hideSplashScreen();
790 "Down Arrow"),
"Down");
792 "Left Arrow"),
"Left");
794 "Right Arrow"),
"Right");
795 RegisterKey(
"Global",
"NEXT", QT_TRANSLATE_NOOP(
"MythControls",
796 "Move to next widget"),
"Tab");
797 RegisterKey(
"Global",
"PREVIOUS", QT_TRANSLATE_NOOP(
"MythControls",
798 "Move to preview widget"),
"Backtab");
800 "Select"),
"Return,Enter,Space");
801 RegisterKey(
"Global",
"BACKSPACE", QT_TRANSLATE_NOOP(
"MythControls",
802 "Backspace"),
"Backspace");
803 RegisterKey(
"Global",
"ESCAPE", QT_TRANSLATE_NOOP(
"MythControls",
805 RegisterKey(
"Global",
"MENU", QT_TRANSLATE_NOOP(
"MythControls",
806 "Pop-up menu"),
"M,Meta+Enter");
807 RegisterKey(
"Global",
"INFO", QT_TRANSLATE_NOOP(
"MythControls",
808 "More information"),
"I");
809 RegisterKey(
"Global",
"DELETE", QT_TRANSLATE_NOOP(
"MythControls",
811 RegisterKey(
"Global",
"EDIT", QT_TRANSLATE_NOOP(
"MythControls",
814 "Save screenshot"),
"");
816 "Play a media resource"),
"");
818 RegisterKey(
"Global",
"PAGEUP", QT_TRANSLATE_NOOP(
"MythControls",
820 RegisterKey(
"Global",
"PAGEDOWN", QT_TRANSLATE_NOOP(
"MythControls",
821 "Page Down"),
"PgDown");
822 RegisterKey(
"Global",
"PAGETOP", QT_TRANSLATE_NOOP(
"MythControls",
823 "Page to top of list"),
"");
824 RegisterKey(
"Global",
"PAGEMIDDLE", QT_TRANSLATE_NOOP(
"MythControls",
825 "Page to middle of list"),
"");
826 RegisterKey(
"Global",
"PAGEBOTTOM", QT_TRANSLATE_NOOP(
"MythControls",
827 "Page to bottom of list"),
"");
829 RegisterKey(
"Global",
"PREVVIEW", QT_TRANSLATE_NOOP(
"MythControls",
830 "Previous View"),
"Home");
831 RegisterKey(
"Global",
"NEXTVIEW", QT_TRANSLATE_NOOP(
"MythControls",
832 "Next View"),
"End");
834 RegisterKey(
"Global",
"HELP", QT_TRANSLATE_NOOP(
"MythControls",
836 RegisterKey(
"Global",
"EJECT", QT_TRANSLATE_NOOP(
"MythControls"
837 ,
"Eject Removable Media"),
"");
839 RegisterKey(
"Global",
"CUT", QT_TRANSLATE_NOOP(
"MythControls",
840 "Cut text from textedit"),
"Ctrl+X");
841 RegisterKey(
"Global",
"COPY", QT_TRANSLATE_NOOP(
"MythControls"
842 ,
"Copy text from textedit"),
"Ctrl+C");
843 RegisterKey(
"Global",
"PASTE", QT_TRANSLATE_NOOP(
"MythControls",
844 "Paste text into textedit"),
"Ctrl+V");
845 RegisterKey(
"Global",
"NEWLINE", QT_TRANSLATE_NOOP(
"MythControls",
846 "Insert newline into textedit"),
"Ctrl+Return");
847 RegisterKey(
"Global",
"UNDO", QT_TRANSLATE_NOOP(
"MythControls",
849 RegisterKey(
"Global",
"REDO", QT_TRANSLATE_NOOP(
"MythControls",
851 RegisterKey(
"Global",
"SEARCH", QT_TRANSLATE_NOOP(
"MythControls",
852 "Show incremental search dialog"),
"Ctrl+S");
866 "Turn the display on"),
"");
868 "Turn the display off"),
"");
870 RegisterKey(
"Global",
"SYSEVENT01", QT_TRANSLATE_NOOP(
"MythControls",
871 "Trigger System Key Event #1"),
"");
872 RegisterKey(
"Global",
"SYSEVENT02", QT_TRANSLATE_NOOP(
"MythControls",
873 "Trigger System Key Event #2"),
"");
874 RegisterKey(
"Global",
"SYSEVENT03", QT_TRANSLATE_NOOP(
"MythControls",
875 "Trigger System Key Event #3"),
"");
876 RegisterKey(
"Global",
"SYSEVENT04", QT_TRANSLATE_NOOP(
"MythControls",
877 "Trigger System Key Event #4"),
"");
878 RegisterKey(
"Global",
"SYSEVENT05", QT_TRANSLATE_NOOP(
"MythControls",
879 "Trigger System Key Event #5"),
"");
880 RegisterKey(
"Global",
"SYSEVENT06", QT_TRANSLATE_NOOP(
"MythControls",
881 "Trigger System Key Event #6"),
"");
882 RegisterKey(
"Global",
"SYSEVENT07", QT_TRANSLATE_NOOP(
"MythControls",
883 "Trigger System Key Event #7"),
"");
884 RegisterKey(
"Global",
"SYSEVENT08", QT_TRANSLATE_NOOP(
"MythControls",
885 "Trigger System Key Event #8"),
"");
886 RegisterKey(
"Global",
"SYSEVENT09", QT_TRANSLATE_NOOP(
"MythControls",
887 "Trigger System Key Event #9"),
"");
888 RegisterKey(
"Global",
"SYSEVENT10", QT_TRANSLATE_NOOP(
"MythControls",
889 "Trigger System Key Event #10"),
"");
892 RegisterKey(
"Browser",
"ZOOMIN", QT_TRANSLATE_NOOP(
"MythControls",
893 "Zoom in on browser window"),
".,>");
894 RegisterKey(
"Browser",
"ZOOMOUT", QT_TRANSLATE_NOOP(
"MythControls",
895 "Zoom out on browser window"),
",,<");
896 RegisterKey(
"Browser",
"TOGGLEINPUT", QT_TRANSLATE_NOOP(
"MythControls",
897 "Toggle where keyboard input goes to"),
"F1");
899 RegisterKey(
"Browser",
"MOUSEUP", QT_TRANSLATE_NOOP(
"MythControls",
900 "Move mouse pointer up"),
"2");
901 RegisterKey(
"Browser",
"MOUSEDOWN", QT_TRANSLATE_NOOP(
"MythControls",
902 "Move mouse pointer down"),
"8");
903 RegisterKey(
"Browser",
"MOUSELEFT", QT_TRANSLATE_NOOP(
"MythControls",
904 "Move mouse pointer left"),
"4");
905 RegisterKey(
"Browser",
"MOUSERIGHT", QT_TRANSLATE_NOOP(
"MythControls",
906 "Move mouse pointer right"),
"6");
907 RegisterKey(
"Browser",
"MOUSELEFTBUTTON", QT_TRANSLATE_NOOP(
"MythControls",
908 "Mouse Left button click"),
"5");
910 RegisterKey(
"Browser",
"PAGEDOWN", QT_TRANSLATE_NOOP(
"MythControls",
911 "Scroll down half a page"),
"9");
912 RegisterKey(
"Browser",
"PAGEUP", QT_TRANSLATE_NOOP(
"MythControls",
913 "Scroll up half a page"),
"3");
914 RegisterKey(
"Browser",
"PAGELEFT", QT_TRANSLATE_NOOP(
"MythControls",
915 "Scroll left half a page"),
"7");
916 RegisterKey(
"Browser",
"PAGERIGHT", QT_TRANSLATE_NOOP(
"MythControls",
917 "Scroll right half a page"),
"1");
919 RegisterKey(
"Browser",
"NEXTLINK", QT_TRANSLATE_NOOP(
"MythControls",
920 "Move selection to next link"),
"Z");
921 RegisterKey(
"Browser",
"PREVIOUSLINK", QT_TRANSLATE_NOOP(
"MythControls",
922 "Move selection to previous link"),
"Q");
923 RegisterKey(
"Browser",
"FOLLOWLINK", QT_TRANSLATE_NOOP(
"MythControls",
924 "Follow selected link"),
"Return,Space,Enter");
925 RegisterKey(
"Browser",
"HISTORYBACK", QT_TRANSLATE_NOOP(
"MythControls",
926 "Go back to previous page"),
"R,Backspace");
927 RegisterKey(
"Browser",
"HISTORYFORWARD", QT_TRANSLATE_NOOP(
"MythControls",
928 "Go forward to previous page"),
"F");
930 RegisterKey(
"Main Menu",
"EXITPROMPT", QT_TRANSLATE_NOOP(
"MythControls",
931 "Display System Exit Prompt"),
"Esc");
932 RegisterKey(
"Main Menu",
"EXIT", QT_TRANSLATE_NOOP(
"MythControls",
934 RegisterKey(
"Main Menu",
"STANDBYMODE",QT_TRANSLATE_NOOP(
"MythControls",
935 "Enter Standby Mode"),
"");
936 RegisterKey(
"Long Press",
"LONGPRESS1",QT_TRANSLATE_NOOP(
"MythControls",
937 "Up to 16 Keys that allow Long Press"),
"");
938 RegisterKey(
"Long Press",
"LONGPRESS2",QT_TRANSLATE_NOOP(
"MythControls",
939 "Up to 16 Keys that allow Long Press"),
"");
940 RegisterKey(
"Long Press",
"LONGPRESS3",QT_TRANSLATE_NOOP(
"MythControls",
941 "Up to 16 Keys that allow Long Press"),
"");
942 RegisterKey(
"Long Press",
"LONGPRESS4",QT_TRANSLATE_NOOP(
"MythControls",
943 "Up to 16 Keys that allow Long Press"),
"");
967 setFixedSize(Geometry.size());
968 setGeometry(Geometry);
972 m_painterWin->setGeometry(0, 0, Geometry.width(), Geometry.height());
1005 setUpdatesEnabled(Enable);
1010 QApplication::postEvent(
this,
new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority);
1026 widget->EnableEffects();
1028 widget->DisableEffects();
1047 if (screen && screen->objectName() != QString(
"mainmenu"))
1051 if (screen->objectName() == QString(
"video playback window"))
1053 auto *me =
new MythEvent(
"EXIT_TO_MENU");
1054 QCoreApplication::postEvent(screen, me);
1060 QCoreApplication::postEvent(
this, key);
1066 QCoreApplication::postEvent(
1089 callback(mediadevice);
1105 QStringList& Actions,
bool AllowJumps)
1112 !
Event->text().isEmpty() &&
1113 Event->modifiers() == Qt::NoModifier)
1139 QStringList localActions;
1143 keycontext && (keycontext->GetMapping(keynum, localActions)))
1162 QCoreApplication::postEvent(
1168 keycontext->GetMapping(keynum, Actions);
1170 if (Context !=
"Global")
1174 keycontextG->GetMapping(keynum, Actions);
1183 if (keycontext ==
nullptr)
1186 QMutableMapIterator<int, QStringList> it(keycontext->m_actionMap);
1187 while (it.hasNext())
1190 QStringList list = it.value();
1200 if (keycontext !=
nullptr)
1201 keycontext->m_actionMap.clear();
1207 if (keycontext ==
nullptr)
1210 if (keycontext ==
nullptr)
1215 QKeySequence keyseq(Key);
1216 for (
unsigned int i = 0; i < static_cast<uint>(keyseq.count()); i++)
1218 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1219 int keynum = keyseq[i];
1221 int keynum = keyseq[i].toCombined();
1224 QStringList dummyaction(
"");
1225 if (keycontext->GetMapping(keynum, dummyaction))
1227 LOG(VB_GENERAL, LOG_WARNING, QString(
"Key %1 is bound to multiple actions in context %2.")
1228 .arg(Key, Context));
1231 keycontext->AddMapping(keynum,
Action);
1233 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Binding: %1 to action: %2 (%3)")
1234 .arg(Key).arg(
Action).arg(Context));
1237 if (
Action ==
"ESCAPE" && Context ==
"Global" && i == 0)
1243 const QString& Description,
const QString& Key)
1245 QString keybind = Key;
1251 query.
prepare(
"SELECT keylist, description FROM keybindings WHERE "
1252 "context = :CONTEXT AND action = :ACTION AND "
1253 "hostname = :HOSTNAME ;");
1260 keybind = query.
value(0).toString();
1261 QString db_description = query.
value(1).toString();
1264 if (db_description != Description)
1266 LOG(VB_GENERAL, LOG_NOTICE,
1267 "Updating keybinding description...");
1269 "UPDATE keybindings "
1270 "SET description = :DESCRIPTION "
1271 "WHERE context = :CONTEXT AND "
1272 " action = :ACTION AND "
1273 " hostname = :HOSTNAME");
1275 query.
bindValue(
":DESCRIPTION", Description);
1288 const QString& inskey = keybind;
1290 query.
prepare(
"INSERT INTO keybindings (context, action, "
1291 "description, keylist, hostname) VALUES "
1292 "( :CONTEXT, :ACTION, :DESCRIPTION, :KEYLIST, "
1296 query.
bindValue(
":DESCRIPTION", Description);
1317 query.
prepare(
"SELECT keylist "
1319 "WHERE context = :CONTEXT AND "
1320 " action = :ACTION AND "
1321 " hostname = :HOSTNAME");
1329 return query.
value(0).toString();
1333 const QString&
Action)
const
1338 if (entry.contains(
Action))
1339 return entry.value(
Action);
1349 LOG(VB_GENERAL, LOG_ERR,
"Cannot clear ficticious jump point" + Destination);
1354 while (it.hasNext())
1369 LOG(VB_GENERAL, LOG_ERR,
"Cannot bind to ficticious jump point" + Destination);
1373 QKeySequence keyseq(Key);
1375 for (
unsigned int i = 0; i < static_cast<uint>(keyseq.count()); i++)
1377 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1378 int keynum = keyseq[i];
1380 int keynum = keyseq[i].toCombined();
1386 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Binding: %1 to JumpPoint: %2")
1387 .arg(keybind).arg(destination));
1394 LOG(VB_GENERAL, LOG_WARNING, QString(
"Key %1 is already bound to a jump point.")
1400 LOG(VB_GENERAL, LOG_DEBUG,
1401 QString(
"JumpPoint: %2 exists, no keybinding") .arg(destination));
1406 const QString& Key,
void (*Callback)(
void),
1407 bool Exittomain, QString LocalAction)
1409 QString keybind = Key;
1414 query.
prepare(
"SELECT keylist FROM jumppoints WHERE destination = :DEST and hostname = :HOST ;");
1419 keybind = query.
value(0).toString();
1423 const QString& inskey = keybind;
1425 query.
prepare(
"INSERT INTO jumppoints (destination, description, "
1426 "keylist, hostname) VALUES ( :DEST, :DESC, :KEYLIST, "
1437 JumpData jd = { Callback, Destination, Description, Exittomain, std::move(LocalAction) };
1445 QList<QString>::Iterator it;
1446 for (it = destinations.begin(); it != destinations.end(); ++it)
1457 QCoreApplication::postEvent(
1478 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Registering %1 as a media playback plugin.")
1484 LOG(VB_GENERAL, LOG_NOTICE, QString(
"%1 is already registered as a media playback plugin.")
1490 const QString& Plot,
const QString& Title,
1491 const QString& Subtitle,
1492 const QString& Director,
int Season,
1493 int Episode,
const QString& Inetref,
1494 std::chrono::minutes LenMins,
const QString& Year,
1495 const QString& Id,
bool UseBookmarks)
1497 QString lhandler(Handler);
1498 if (lhandler.isEmpty())
1499 lhandler =
"Internal";
1505 Director, Season, Episode,
1506 Inetref, LenMins, Year, Id,
1533 QCoreApplication::postEvent(
this,
event);
1541 auto * keyevent =
dynamic_cast<QKeyEvent*
>(*Event);
1544 int keycode = keyevent->key();
1549 QEvent *newevent =
nullptr;
1550 switch ((*Event)->type())
1552 case QEvent::KeyPress:
1565 newevent =
new QKeyEvent(QEvent::KeyPress, keycode,
1566 keyevent->modifiers() | Qt::MetaModifier, keyevent->nativeScanCode(),
1567 keyevent->nativeVirtualKey(), keyevent->nativeModifiers(),
1568 keyevent->text(),
false,1);
1570 NewEvent.reset(newevent);
1581 QStringList actions;
1588 LOG(VB_GUI, LOG_ERR, QString(
"TranslateKeyPress Long Press Invalid Response"));
1591 if (!actions.empty() && actions[0].startsWith(
"LONGPRESS"))
1600 case QEvent::KeyRelease:
1604 if (keyevent->isAutoRepeat())
1609 Qt::KeyboardModifiers modifier = Qt::NoModifier;
1613 modifier = Qt::MetaModifier;
1615 newevent =
new QKeyEvent(QEvent::KeyPress, keycode,
1616 keyevent->modifiers() | modifier, keyevent->nativeScanCode(),
1617 keyevent->nativeVirtualKey(), keyevent->nativeModifiers(),
1618 keyevent->text(),
false,1);
1620 NewEvent.reset(newevent);
1643 QScopedPointer<QEvent> newevent(
nullptr);
1647 switch (
Event->type())
1649 case QEvent::KeyPress:
1652 auto *
event =
dynamic_cast<QKeyEvent*
>(
Event);
1657 event =
static_cast<QKeyEvent*
>(
Event);
1664 switch (
event->nativeScanCode())
1667 keycode = Qt::Key_MediaPause;
1675 auto * key =
new QKeyEvent(QEvent::KeyPress, keycode,
event->modifiers());
1676 if (
auto * target =
GetTarget(*key); target)
1677 QCoreApplication::postEvent(target, key);
1679 QCoreApplication::postEvent(
this, key);
1685 QVector<MythScreenStack *>::const_reverse_iterator it;
1688 if (
auto * top = (*it)->GetTopScreen(); top)
1690 if (top->keyPressEvent(
event))
1694 if ((*it)->objectName() ==
"popup stack")
1700 case QEvent::InputMethod:
1703 auto *ie =
dynamic_cast<QInputMethodEvent*
>(
Event);
1705 return MythUIScreenBounds::eventFilter(Watched,
Event);
1706 QWidget *widget = QApplication::focusWidget();
1710 if (widget->isEnabled())
1711 QCoreApplication::instance()->notify(widget, ie);
1714 QVector<MythScreenStack *>::const_reverse_iterator it;
1724 if ((*it)->objectName() ==
"popup stack")
1729 case QEvent::MouseButtonPress:
1736 auto * mouseEvent =
dynamic_cast<QMouseEvent*
>(
Event);
1738 return MythUIScreenBounds::eventFilter(Watched,
Event);
1746 case QEvent::MouseButtonRelease:
1757 QPoint point { -1, -1 };
1758 auto * mouseevent =
dynamic_cast<QMouseEvent*
>(
Event);
1761 point = mouseevent->pos();
1769 return MythUIScreenBounds::eventFilter(Watched,
Event);
1771 QVector<MythScreenStack *>::const_reverse_iterator it;
1774 auto * screen = (*it)->GetTopScreen();
1775 if (!screen || !screen->ContainsPoint(point))
1778 if (screen->gestureEvent(gesture))
1787 if ((*it)->objectName() ==
"popup stack")
1794 bool handled =
false;
1798 QCoreApplication::postEvent(
this, gesture);
1802 QVector<MythScreenStack *>::const_reverse_iterator it;
1821 if ((*it)->objectName() ==
"popup stack")
1828 QCoreApplication::postEvent(
this, gesture);
1835 case QEvent::MouseMove:
1844 auto * mouseevent =
dynamic_cast<QMouseEvent*
>(
Event);
1846 return MythUIScreenBounds::eventFilter(Watched,
Event);
1856 auto * wheel =
dynamic_cast<QWheelEvent*
>(
Event);
1857 if (wheel ==
nullptr)
1858 return MythUIScreenBounds::eventFilter(Watched,
Event);
1859 int delta = wheel->angleDelta().y();
1863 auto *key =
new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier);
1864 if (
auto * target =
GetTarget(*key); target)
1865 QCoreApplication::postEvent(target, key);
1867 QCoreApplication::postEvent(
this, key);
1872 auto * key =
new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier);
1873 if (
auto * target =
GetTarget(*key); !target)
1874 QCoreApplication::postEvent(target, key);
1876 QCoreApplication::postEvent(
this, key);
1884 return MythUIScreenBounds::eventFilter(Watched,
Event);
1892 if (gesture ==
nullptr)
1895 if (
auto * screen = toplevel->GetTopScreen(); screen)
1896 screen->gestureEvent(gesture);
1897 LOG(VB_GUI, LOG_DEBUG, QString(
"Gesture: %1 (Button: %2)")
1898 .arg(gesture->GetName(), gesture->GetButtonName()));
1907 if (
event ==
nullptr)
1909 auto * key =
new QKeyEvent(QEvent::KeyPress,
event->getKeycode(), Qt::NoModifier);
1910 if (
auto * target =
GetTarget(*key); target)
1911 QCoreApplication::sendEvent(target, key);
1913 QCoreApplication::sendEvent(
this, key);
1936 QVector<MythScreenType*> screenList;
1937 widget->GetScreenList(screenList);
1938 for (
auto * screen : qAsConst(screenList))
1940 screen->mediaEvent(me);
1946 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Media Event: %1 - %2")
1947 .arg(device->getDevicePath()).arg(device->getStatus()));
1979 if (
event ==
nullptr)
1982 QString message =
event->
Message();
1985 if (
event->ExtraDataCount() == 1)
1987 else if (
event->ExtraDataCount() >= 11)
1990 if (
event->ExtraDataCount() >= 12)
1995 event->ExtraData(5).toInt(),
event->ExtraData(6).toInt(),
1996 event->ExtraData(7), std::chrono::minutes(
event->ExtraData(8).toInt()),
2002 LOG(VB_GENERAL, LOG_ERR,
"Failed to handle media");
2010 if (
event->ExtraDataCount() >= 2)
2012 width =
event->ExtraData(0).toInt();
2013 height =
event->ExtraData(1).toInt();
2014 if (
event->ExtraDataCount() == 3)
2022 state.insert(
"state",
"idle");
2023 state.insert(
"menutheme",
GetMythDB()->GetSetting(
"menutheme",
"defaultmenu"));
2024 state.insert(
"currentlocation",
GetMythUI()->GetCurrentLocation());
2027 else if (message ==
"CLEAR_SETTINGS_CACHE")
2041 LOG(VB_GENERAL, LOG_INFO, QString(
"Updating the frontend idle time to: %1 mins").arg(
m_idleTime.count()));
2045 LOG(VB_GENERAL, LOG_INFO,
"Frontend idle timeout is disabled");
2048 else if (message ==
"NOTIFICATION")
2065 if (
const QString& message =
event->Message(); !message.isEmpty())
2076 auto * target = QWidget::keyboardGrabber();
2079 if (
auto * widget = QApplication::focusWidget(); widget && widget->isEnabled())
2085 target = widget->topLevelWidget();
2101 if (
Show &&
GetMythDB()->GetBoolSetting(
"HideMouseCursor",
false))
2105 setCursor(
Show ? (Qt::ArrowCursor) : (Qt::BlankCursor));
2157 LOG(VB_GENERAL, LOG_NOTICE,
"Suspending idle timer");
2162 LOG(VB_GENERAL, LOG_NOTICE,
"Resuming idle timer");
2178 LOG(VB_GENERAL, LOG_NOTICE,
2179 QString(
"Entering standby mode after %1 minutes of inactivity").arg(
m_idleTime.count()));
2202 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Entering standby mode"));
2209 state.insert(
"state",
"standby");
2210 state.insert(
"menutheme",
GetMythDB()->GetSetting(
"menutheme",
"defaultmenu"));
2211 state.insert(
"currentlocation",
GetMythUI()->GetCurrentLocation());
2237 LOG(VB_GENERAL, LOG_NOTICE,
"Leaving standby mode");
2245 state.insert(
"state",
"idle");
2246 state.insert(
"menutheme",
GetMythDB()->GetSetting(
"menutheme",
"defaultmenu"));
2247 state.insert(
"currentlocation",
GetMythUI()->GetCurrentLocation());
2253 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Application State Changed to %1").arg(
State));
2256 case Qt::ApplicationState::ApplicationActive:
2259 case Qt::ApplicationState::ApplicationSuspended: