1#include "libmythbase/mythconfig.h"
14#if QT_VERSION >= QT_VERSION_CHECK(6,5,0)
15#include <QtSystemDetection>
18#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
19#include <QtAndroidExtras>
21#include <QCoreApplication>
23#define QAndroidJniObject QJniObject
26#include <QApplication>
34#include <QProcessEnvironment>
38#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
39#include <QtWebEngineQuick>
65#include "libmythbase/mythversion.h"
136#include <QScopedPointer>
139#if CONFIG_SYSTEMD_NOTIFY
140#include <systemd/sd-daemon.h>
141static inline void fe_sd_notify(
const char *str) { sd_notify(0, str); };
164static bool gLoaded =
false;
167static const QString
sLocation = QCoreApplication::translate(
"(Common)",
188 this, &RunSettingsCompletion::OnPasswordResultReady);
223 LOG(VB_GENERAL, LOG_WARNING,
224 "Aggressive Parental Controls Warning: "
225 "invalid password. An attempt to enter a "
226 "MythVideo settings screen was prevented.");
245 bool bookmarkPresent,
bool lastPlayPresent) :
248 m_bookmarked(bookmarkPresent),
249 m_lastPlayed(lastPlayPresent),
250 m_btnPlayBookmark(tr(
"Play from bookmark")),
251 m_btnClearBookmark(tr(
"Clear bookmark")),
252 m_btnPlayBegin(tr(
"Play from beginning")),
253 m_btnPlayLast(tr(
"Play from last played position")),
254 m_btnClearLast(tr(
"Clear last played position")) {
259 QString msg = tr(
"DVD/Video contains a bookmark");
261 m_videoDlg =
dynamic_cast<VideoDialog*
>(GetScreenStack()->GetTopScreen());
262 auto *popup =
new MythDialogBox(msg, GetScreenStack(),
"bookmarkdialog");
263 if (!popup->Create())
269 GetScreenStack()->AddScreen(popup);
271 popup->SetReturnEvent(
this,
"bookmarkdialog");
273 popup->AddButton(m_btnPlayLast);
275 popup->AddButton(m_btnPlayBookmark);
276 popup->AddButton(m_btnPlayBegin);
278 popup->AddButton(m_btnClearLast);
280 popup->AddButton(m_btnClearBookmark);
291 QString buttonText = dce->GetResultText();
293 if (dce->GetId() !=
"bookmarkdialog")
296 if (buttonText == m_btnPlayLast)
300 else if (buttonText == m_btnPlayBookmark)
304 else if (buttonText == m_btnPlayBegin)
308 else if (buttonText == m_btnClearBookmark)
310 m_pgi->SaveBookmark(0);
313 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
316 else if (buttonText == m_btnClearLast)
318 m_pgi->SaveLastPlayPos(0);
321 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
329 bool m_bookmarked {
false};
330 bool m_lastPlayed {
false};
341 QCoreApplication::processEvents();
352 LOG(VB_GENERAL, LOG_INFO,
"Shutting down UPnP client...");
385 ShowOkPopup(QCoreApplication::translate(
"(MythFrontendMain)",
386 "The ScreenSetupWizard cannot be used while "
387 "mythfrontend is operating in windowed mode."));
424 auto *mythcontrols =
new MythControls(mainStack,
"mythcontrols");
426 if (mythcontrols->Create())
551 if (viewsched->Create())
563 if (progRecPrior->Create())
575 if (chanRecPrior->Create())
587 if (custom->Create())
597 auto *pbb =
new PlaybackBox(mainStack,
"playbackbox");
601 if (!recGroup.isEmpty())
602 pbb->setInitialRecGroup(recGroup);
642 if (custom->Create())
654 if (mansched->Create())
665 QString msg = QCoreApplication::translate(
"(Common)",
"All tuners are currently busy.");
668 msg = QCoreApplication::translate(
"(Common)",
"There are no configured tuners.");
683 while (keylist.size() < 2)
706 auto *statusbox =
new StatusBox(mainStack);
708 if (statusbox->Create())
721 if (idlescreen->Create())
729 QString message = QCoreApplication::translate(
"(MythFrontendMain)",
730 "Loading videos ...");
736 "mythvideobusydialog");
738 if (busyPopup->Create())
750 video_list = saved->GetSaved();
751 LOG(VB_GENERAL, LOG_INFO,
752 QString(
"Reusing saved video list because MythVideo was resumed"
767 if (mythvideo->Create())
788 if (galleryView->Create())
791 galleryView->Start();
802 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for BluRay medium");
803 const QString bluray_mountpoint =
805 QDir bdtest(bluray_mountpoint +
"/BDMV");
811 QString
filename = QString(
"bd:/%1").arg(bluray_mountpoint);
814 0, 0,
"", 0min,
"",
"",
true);
823 LOG(VB_MEDIA, LOG_ERR,
"Could not access media monitor");
828 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for DVD medium");
829 const bool isDVD = mediaMonitor->
IsActive()
836 if (dvd_device.isEmpty())
842 QString command_string =
844 if ((command_string.indexOf(
"internal", 0, Qt::CaseInsensitive) > -1) ||
845 (command_string.length() < 1))
850#elif defined(Q_OS_WINDOWS)
857 command_string =
"Internal";
859 "",
"", 0, 0,
"", 0min,
"",
"",
true);
865 if (command_string.contains(
"%d"))
870 command_string = command_string.replace(
"%d", dvd_device);
887 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for audio CD medium");
891 if (!audioMedia.isEmpty())
893 for (
auto *medium : std::as_const(audioMedia))
895 if (medium->isUsable()) {
896 LOG(VB_MEDIA, LOG_DEBUG, QString(
"Found usable audio/mixed device %1").arg(medium->getDevicePath()));
925 LOG(VB_GENERAL, LOG_ERR,
926 "mythdvd main.o: handleMedia() does not know what to do");
938 QVector<MythScreenType*> screens;
942 for (
const auto *screen : std::as_const(screens))
944 if (qobject_cast<const GalleryThumbView*>(screen))
947 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - already running");
954 LOG(VB_GUI, LOG_INFO,
"Main: Autostarting Gallery for new media");
959 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - autorun not set");
965 QString sel = selection.toLower();
967 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
975 if (sel ==
"tv_watch_live")
979 else if (sel.startsWith(
"tv_watch_recording"))
982 if ((selection.length() > 19) && (selection.mid(18, 1) ==
" "))
987 else if (sel ==
"tv_schedule")
991 else if (sel ==
"tv_manualschedule")
995 else if (sel ==
"tv_custom_record")
999 else if (sel ==
"tv_fix_conflicts")
1003 else if (sel ==
"tv_manage_recording_rules")
1007 else if (sel ==
"tv_progfind")
1011 else if (sel ==
"tv_search_title")
1015 else if (sel ==
"tv_search_keyword")
1019 else if (sel ==
"tv_search_people")
1023 else if (sel ==
"tv_search_power")
1027 else if (sel ==
"tv_search_stored")
1031 else if (sel ==
"tv_search_channel")
1035 else if (sel ==
"tv_search_category")
1039 else if (sel ==
"tv_search_movie")
1043 else if (sel ==
"tv_search_new")
1047 else if (sel ==
"tv_search_time")
1051 else if (sel ==
"tv_previous")
1055 else if (sel ==
"tv_previous_old")
1059 else if (sel ==
"settings appearance")
1074 else if (sel ==
"settings themechooser")
1084 else if (sel ==
"settings setupwizard")
1094 else if (sel ==
"settings grabbers")
1104 else if (sel ==
"screensetupwizard")
1108 else if (sel ==
"setup_keys")
1112 else if (sel ==
"settings playgroup")
1127 else if (sel ==
"settings general")
1142 else if (sel ==
"settings audiogeneral")
1158 else if (sel ==
"settings maingeneral")
1173 else if (sel ==
"settings playback")
1188 else if (sel ==
"settings osd")
1203 else if (sel ==
"settings epg")
1218 else if (sel ==
"settings channelgroups")
1233 else if (sel ==
"settings generalrecpriorities")
1237 "generalrecprioritiessettings",
1249 else if (sel ==
"settings channelrecpriorities")
1253 else if (sel ==
"settings custompriority")
1257 else if (sel ==
"system_events")
1268 else if (sel ==
"video_settings_general")
1271 GetBoolSetting(
"VideoAggressivePC",
false));
1273 else if (sel ==
"video_settings_player")
1284 else if (sel ==
"video_settings_metadata")
1295 else if (sel ==
"video_settings_associations")
1304 else if (sel ==
"manager")
1308 else if (sel ==
"browser")
1312 else if (sel ==
"listing")
1316 else if (sel ==
"gallery")
1320 else if (sel ==
"disc_play")
1324 else if (sel ==
"tv_status")
1328 else if (sel ==
"exiting_app_prompt")
1332 else if (sel ==
"exiting_app")
1336 else if (sel ==
"standby_mode")
1340 else if (sel ==
"exiting_menu")
1346 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
1349 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
1365 prompter->HandleExit();
1375 QByteArray tmp =
themedir.toLocal8Bit();
1381 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Found mainmenu.xml for theme '%1'")
1388 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find mainmenu.xml for theme '%1'")
1428 const QString &title,
const QString &subtitle,
1429 const QString &director,
int season,
int episode,
1430 const QString &inetref, std::chrono::minutes lenMins,
1431 const QString &year,
1432 const QString &
id,
const bool useBookmark)
1436 QFile checkFile(mrl);
1437 if ((!checkFile.exists() && !mrl.startsWith(
"dvd:")
1438 && !mrl.startsWith(
"bd:")
1439 && !mrl.startsWith(
"myth:")
1440 && !mrl.startsWith(
"http://")
1441 && !mrl.startsWith(
"https://")))
1443 QString errorText = QCoreApplication::translate(
"(MythFrontendMain)",
1444 "Failed to open \n '%1' in %2 \n"
1445 "Check if the video exists")
1446 .arg(mrl.section(
'/', -1),
1447 mrl.section(
'/', 0, -2));
1454 mrl, plot, title, QString(), subtitle, QString(),
1455 director, season, episode, inetref, lenMins,
1456 (year.toUInt()) ? year.toUInt() : 1900,
id);
1458 pginfo->SetProgramInfoType(pginfo->DiscoverProgramInfoType());
1460 bool bookmarkPresent =
false;
1461 bool lastPlayPresent =
false;
1463 if (pginfo->IsVideoDVD())
1465 auto *dvd =
new MythDVDInfo(pginfo->GetPlaybackURL());
1470 if (dvd->GetNameAndSerialNum(name, serialid))
1472 QStringList fields = pginfo->QueryDVDBookmark(serialid);
1473 bookmarkPresent = (fields.count() > 0);
1481 dvd->GetLastError());
1488 else if (pginfo->IsVideoBD())
1497 QStringList fields = pginfo->QueryBDBookmark(serialid);
1498 bookmarkPresent = (fields.count() > 0);
1511 else if (useBookmark && pginfo->IsVideo())
1513 pginfo->SetIgnoreLastPlayPos(
false);
1514 pginfo->SetIgnoreBookmark(
false);
1515 bookmarkPresent = pginfo->QueryBookmark() > 0;
1516 lastPlayPresent = pginfo->QueryLastPlayPos() > 0;
1519 if (useBookmark && (bookmarkPresent || lastPlayPresent))
1522 auto *bookmarkdialog =
new BookmarkDialog(pginfo, mainStack,
1525 if (!bookmarkdialog->Create())
1527 delete bookmarkdialog;
1547 auto *lmenu = qobject_cast<MythThemedMenuState *>
1550 lmenu->m_buttonList->SetItemCurrent(0);
1562 LOG(VB_GENERAL, LOG_WARNING, QString(
"Overriding broken theme '%1' with '%2'")
1563 .arg(badtheme, themename));
1582#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1583 auto activity = QtAndroid::androidActivity();
1585 QJniObject activity = QNativeInterface::QAndroidApplication::context();
1587 auto packageManager = activity.callObjectMethod
1588 (
"getPackageManager",
1589 "()Landroid/content/pm/PackageManager;" );
1591 auto activityIntent = packageManager.callObjectMethod
1592 (
"getLaunchIntentForPackage",
1593 "(Ljava/lang/String;)Landroid/content/Intent;",
1594 activity.callObjectMethod(
"getPackageName",
1595 "()Ljava/lang/String;").object() );
1597 auto pendingIntent = QAndroidJniObject::callStaticObjectMethod
1598 (
"android/app/PendingIntent",
1600 "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;",
1603 activityIntent.object(),
1604 QAndroidJniObject::getStaticField<jint>(
"android/content/Intent",
1605 "FLAG_ACTIVITY_CLEAR_TOP") );
1607 auto alarmManager = activity.callObjectMethod
1608 (
"getSystemService",
1609 "(Ljava/lang/String;)Ljava/lang/Object;",
1610 QAndroidJniObject::getStaticObjectField(
"android/content/Context",
1612 "Ljava/lang/String;").
object() );
1614 alarmManager.callMethod<
void>
1616 "(IJLandroid/app/PendingIntent;)V",
1617 QAndroidJniObject::getStaticField<jint>(
"android/app/AlarmManager",
"RTC"),
1618 jlong(QDateTime::currentMSecsSinceEpoch() + 100),
1619 pendingIntent.object() );
1635 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'").arg(themename));
1687 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Reload Theme"),
1689 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Main Menu"),
1691 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Guide"),
1693 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Finder"),
1697 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recordings / "
1698 "Fix Conflicts"),
"",
"",
startManaged,
"VIEWSCHEDULED");
1699 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recording Rules"),
1701 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Channel Recording "
1703 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"TV Recording Playback"),
1705 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Live TV"),
1707 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Status Screen"),
1709 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Previously Recorded"),
1712 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Standby Mode"),
1727 REG_JUMP(
"Play Disc", QT_TRANSLATE_NOOP(
"MythControls",
1728 "Play an Optical Disc"),
"",
playDisc);
1735 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Borders"),
1737 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Names"),
1739 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Reset All Keys"),
1740 QT_TRANSLATE_NOOP(
"MythControls",
"Reset all keys to defaults"),
1753 REG_KEY(
"Video",
"PLAYALT", QT_TRANSLATE_NOOP(
"MythControls",
1754 "Play selected item in alternate player"),
"ALT+P");
1755 REG_KEY(
"Video",
"FILTER", QT_TRANSLATE_NOOP(
"MythControls",
1756 "Open video filter dialog"),
"F");
1757 REG_KEY(
"Video",
"INCPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1758 "Increase Parental Level"),
"],},F11");
1759 REG_KEY(
"Video",
"DECPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1760 "Decrease Parental Level"),
"[,{,F10");
1761 REG_KEY(
"Video",
"INCSEARCH", QT_TRANSLATE_NOOP(
"MythControls",
1762 "Show Incremental Search Dialog"),
"Ctrl+S,Search");
1763 REG_KEY(
"Video",
"DOWNLOADDATA", QT_TRANSLATE_NOOP(
"MythControls",
1764 "Download metadata for current item"),
"W");
1765 REG_KEY(
"Video",
"ITEMDETAIL", QT_TRANSLATE_NOOP(
"MythControls",
1766 "Display Item Detail Popup"),
"");
1769 REG_KEY(
"Images",
"PLAY", QT_TRANSLATE_NOOP(
"MythControls",
1770 "Start/Stop Slideshow"),
"P,Media Play");
1771 REG_KEY(
"Images",
"RECURSIVESHOW", QT_TRANSLATE_NOOP(
"MythControls",
1772 "Start Recursive Slideshow"),
"R");
1773 REG_KEY(
"Images",
"ROTRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1774 "Rotate image right 90 degrees"),
"],3");
1775 REG_KEY(
"Images",
"ROTLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1776 "Rotate image left 90 degrees"),
"[,1");
1777 REG_KEY(
"Images",
"FLIPHORIZONTAL", QT_TRANSLATE_NOOP(
"MythControls",
1778 "Flip image horizontally"),
"");
1779 REG_KEY(
"Images",
"FLIPVERTICAL", QT_TRANSLATE_NOOP(
"MythControls",
1780 "Flip image vertically"),
"");
1781 REG_KEY(
"Images",
"ZOOMOUT", QT_TRANSLATE_NOOP(
"MythControls",
1782 "Zoom image out"),
"7,<,Ctrl+B,Media Rewind");
1783 REG_KEY(
"Images",
"ZOOMIN", QT_TRANSLATE_NOOP(
"MythControls",
1784 "Zoom image in"),
"9,>,Ctrl+F,Media Fast Forward");
1785 REG_KEY(
"Images",
"FULLSIZE", QT_TRANSLATE_NOOP(
"MythControls",
1786 "Full-size (un-zoom) image"),
"0");
1787 REG_KEY(
"Images",
"MARK", QT_TRANSLATE_NOOP(
"MythControls",
1788 "Mark image"),
"T");
1789 REG_KEY(
"Images",
"SCROLLUP", QT_TRANSLATE_NOOP(
"MythControls",
1790 "Scroll image up"),
"2");
1791 REG_KEY(
"Images",
"SCROLLLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1792 "Scroll image left"),
"4");
1793 REG_KEY(
"Images",
"SCROLLRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1794 "Scroll image right"),
"6");
1795 REG_KEY(
"Images",
"SCROLLDOWN", QT_TRANSLATE_NOOP(
"MythControls",
1796 "Scroll image down"),
"8");
1797 REG_KEY(
"Images",
"RECENTER", QT_TRANSLATE_NOOP(
"MythControls",
1798 "Recenter image"),
"5");
1799 REG_KEY(
"Images",
"COVER", QT_TRANSLATE_NOOP(
"MythControls",
1800 "Set or clear cover image"),
"C");
1830 query.
prepare(
"DELETE FROM keybindings "
1831 "WHERE hostname = :HOSTNAME;");
1835 query.
prepare(
"DELETE FROM jumppoints "
1836 "WHERE hostname = :HOSTNAME;");
1880 query.
prepare(
"DELETE FROM inuseprograms "
1881 "WHERE hostname = :HOSTNAME and recusage = 'player' ;");
1889 bool autoStart =
false;
1895 QDateTime startupTime = QDateTime();
1904 if (startupTime.isValid())
1907 startupSecs = std::max(startupSecs, 15 * 60s);
1914 LOG(VB_GENERAL, LOG_INFO,
1915 "Close to auto-start time, AUTO-Startup assumed");
1921 LOG(VB_GENERAL, LOG_INFO,
1922 "Close to MythFillDB suggested run time, AUTO-Startup to fetch guide data?");
1928 LOG(VB_GENERAL, LOG_DEBUG,
1929 "NOT close to auto-start time, USER-initiated startup assumed");
1939 if (!wakeupCmd.isEmpty())
1942 bool bConflicts =
false;
1943 QDateTime nextRecordingStart;
1950 for (
auto *prog : progList)
1954 (prog->GetHostname() ==
hostname) &&
1955 (nextRecordingStart.isNull() ||
1956 nextRecordingStart > prog->GetRecordingStartTime()))
1958 nextRecordingStart = prog->GetRecordingStartTime();
1962 if (!nextRecordingStart.isNull() &&
1965 LOG(VB_GENERAL, LOG_INFO,
1966 "Close to start time, AUTO-Startup assumed");
1974 LOG(VB_GENERAL, LOG_DEBUG,
1975 "NOT close to auto-start time, USER-initiated startup assumed");
2001Q_DECL_EXPORT
int main(
int argc,
char **argv)
2003 bool bPromptForBackend =
false;
2004 bool bBypassAutoDiscovery =
false;
2025#if CONFIG_QTWEBENGINE
2026#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2027 QtWebEngineQuick::initialize();
2029 QtWebEngine::initialize();
2034 QApplication::setSetuidAllowed(
true);
2035 QApplication a(argc, argv);
2039 QString path = QCoreApplication::applicationDirPath();
2041 QString(
"%1/../Resources/lib/%2:/../Resources/lib/%2/site-packages:/../Resources/lib/%2/lib-dynload:%3")
2043 .arg(QFileInfo(PYTHON_EXE).fileName())
2044 .arg(QProcessEnvironment::systemEnvironment().value(
"PYTHONPATH"))
2045 .toUtf8().constData(), 1);
2049 auto config = QSslConfiguration::defaultConfiguration();
2050 config.setCaCertificates(QSslConfiguration::systemCaCertificates());
2051 QSslConfiguration::setDefaultConfiguration(config);
2058 bool ResetSettings =
false;
2061 bPromptForBackend =
true;
2063 bBypassAutoDiscovery =
true;
2065 if (signal(
SIGPIPE, SIG_IGN) == SIG_ERR)
2066 std::cerr <<
"Unable to ignore SIGPIPE\n";
2076 if (!context.Init(
true, bPromptForBackend, bBypassAutoDiscovery))
2078 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
2096 ResetSettings =
true;
2111 QDir dir(fileprefix);
2113 dir.mkdir(fileprefix);
2126 LOG(VB_GENERAL, LOG_NOTICE,
"Appearance settings and language have "
2127 "been reset to defaults. You will need to "
2128 "restart the frontend.");
2129 context.saveSettingsCache();
2133#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2135 if (maxImageSize >=0)
2136 QImageReader::setAllocationLimit(maxImageSize);
2138 LOG(VB_GENERAL, LOG_DEBUG,
2139 QString(
"Built against zlib %1, linked against %2.")
2140 .arg(ZLIB_VERSION, zlibVersion()));
2141 QList<QByteArray>
formats = QImageReader::supportedImageFormats();
2142 QString format_str =
formats.takeFirst();
2143 for (
const auto& format : std::as_const(
formats))
2144 format_str +=
", " + format;
2145 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Supported image formats: %1").arg(format_str));
2147 QCoreApplication::setSetuidAllowed(
true);
2151 LOG(VB_GENERAL, LOG_ERR,
"Failed to revokeRoot(), exiting.");
2161 fe_sd_notify(
"STATUS=Registering frontend with bonjour");
2166 QByteArray name(
"Mythfrontend on ");
2168 bonjour->Register(port,
"_mythfrontend._tcp",
2187 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2196 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2210 mainWindow->Init(
false);
2211 mainWindow->setWindowTitle(QCoreApplication::translate(
"(MythFrontendMain)",
2213 "Main window title"));
2238 LOG(VB_GENERAL, LOG_ERR,
2239 "Couldn't upgrade database to new schema, exiting.");
2247 mainWindow->ReloadKeys();
2270 mainWindow->installEventFilter(mon);
2279 if (!networkControl->
listen(port))
2281 LOG(VB_GENERAL, LOG_ERR,
2282 QString(
"NetworkControl failed to bind to port %1.")
2298 std::unique_ptr<ThemeUpdateChecker> themeUpdateChecker;
2300 themeUpdateChecker = std::make_unique<ThemeUpdateChecker>();
2313 #ifdef CONFIG_BINDINGS_PYTHON
2317 housekeeping->Start();
2334 LOG(VB_GENERAL, LOG_ERR,
2335 QString(
"Invalid plugin name supplied on command line: '%1'")
2337 LOG(VB_GENERAL, LOG_ERR,
2338 QString(
"Available plugins: %1")
2339 .arg(plugins.join(
", ")));
2353 LOG(VB_GENERAL, LOG_ERR,
2354 QString(
"Invalid jump point supplied on the command line: %1")
2356 LOG(VB_GENERAL, LOG_ERR,
2357 QString(
"Available jump points: %2")
2384 auto root = [](
auto && PH1) {
return MythHTTPRoot::RedirectRoot(std::forward<
decltype(PH1)>(PH1),
"apps/frontend/index.html"); };
2386 ret = QCoreApplication::exec();
2391 context.saveSettingsCache();
2396 delete housekeeping;
2403 delete networkControl;
2409 LOG(VB_GENERAL, LOG_INFO,
"Reloading theme");
2418 LOG(VB_GENERAL, LOG_INFO,
"Restarting LIRC handler");
2426#include "mythfrontend.moc"
static const std::array< const std::string, 8 > formats
std::vector< ChannelInfo > ChannelInfoList
static void Cleanup(void)
Screen for managing channel priorities in recording scheduling decisions.
static ChannelInfoList LoadChannels(uint startIndex, uint count, uint &totalAvailable, bool ignoreHidden=true, OrderBy orderBy=kChanOrderByChanNum, GroupBy groupBy=kChanGroupByChanid, uint sourceID=0, uint channelGroupID=0, bool liveTVOnly=false, const QString &callsign="", const QString &channum="", bool ignoreUntunable=true)
Load channels from database into a list of ChannelInfo objects.
A screen to create a fully custom recording.
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static const Type kEventType
static void RunProgramGuide(uint startChanId, const QString &startChanNum, const QDateTime &startTime, TV *player=nullptr, bool embedVideo=false, bool allowFinder=true, int changrpid=-1)
Manages registered HouseKeeperTasks and queues tasks for operation.
static QStringList SupportedImages()
Return recognised pictures.
static QStringList SupportedVideos()
Return recognised video extensions.
static void SetupLCD(void)
static bool prompt(bool force=false)
Ask the user for the language to use.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void Cleanup(void)
QString GetLastError(void) const
bool GetNameAndSerialNum(QString &Name, QString &SerialNum)
static ImageType inspectImage(const QString &path)
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
void ApplySettingsOverride(void)
Apply all overrides to the global context.
int ConfigureLogging(const QString &mask="general", bool progress=false)
Read in logging options and initialize the logging interface.
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
static void PrintVersion(void)
Print application version information.
void PrintHelp(void) const
Print command line option help.
Startup context for MythTV.
Screen for managing and configuring keyboard input bindings.
void emitTVPlaybackStarted(void)
void emitTVPlaybackStopped(void)
void ClearSettingsCache(const QString &myKey=QString(""))
void ActivateSettingsCache(bool activate=true)
QString GetHostName(void)
static bool BackendIsRunning(void)
a backend process is running on this host
void SaveSetting(const QString &key, int newValue)
void SetExiting(bool exiting=true)
QString GetSetting(const QString &key, const QString &defaultval="")
void OverrideSettingForSession(const QString &key, const QString &value)
QString GetSettingOnHost(const QString &key, const QString &host, const QString &defaultval="")
T GetDurSetting(const QString &key, T defaultval=T::zero())
void SendMessage(const QString &message)
bool IsMasterHost(void)
is this the same host as the master
void SetPluginManager(MythPluginManager *pmanager)
int GetNumSetting(const QString &key, int defaultval=0)
void SetAsFrontend(bool frontend)
bool GetBoolSetting(const QString &key, bool defaultval=false)
static void DBError(const QString &where, const MSqlQuery &query)
Basic menu dialog, message and a list of options.
static void ConfigureQtGUI(int SwapInterval, const MythCommandLineParser &CmdLine)
Shared static initialisation code for all MythTV GUI applications.
static void AddErrorPageHandler(const HTTPHandler &Handler)
static void Addservices(const HTTPServices &Services)
static HTTPResponse RewriteToSPA(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests to a Single Page web app (SPA)
static HTTPResponse RedirectRoot(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests for index.html to a context specific file.
void ClearKeyContext(const QString &Context)
void PauseIdleTimer(bool Pause)
Pause the idle timeout timer.
MythScreenStack * GetMainStack()
void RestartInputHandlers()
void JumpTo(const QString &Destination, bool Pop=true)
MythPainter * GetPainter()
MythScreenStack * GetStack(const QString &Stackname)
bool DestinationExists(const QString &Destination) const
QStringList EnumerateDestinations() const
bool HandleMedia(const QString &Handler, const QString &Mrl, const QString &Plot="", const QString &Title="", const QString &Subtitle="", const QString &Director="", int Season=0, int Episode=0, const QString &Inetref="", std::chrono::minutes LenMins=2h, const QString &Year="1895", const QString &Id="", bool UseBookmarks=false)
void SetEffectsEnabled(bool Enable)
void Init(bool MayReInit=true)
void SetDebugMode(bool showBorders, bool showNames)
bool ShowBorders(void) const
bool ShowTypeNames(void) const
bool run_plugin(const QString &plugname)
QStringList EnumeratePlugins(void)
static void Cleanup(void)
void GetScreenList(QVector< MythScreenType * > &screens)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
virtual MythScreenType * GetTopScreen(void) const
Screen in which all other widgets are contained and rendered.
virtual void Load(void)
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
An editor for MythSystemEvent handler commands.
Handles incoming MythSystemEvent messages.
static void reload()
Reload all active translators based on the current language setting.
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
QString RemoveCurrentLocation()
void AddCurrentLocation(const QString &Location)
static void ParseGeometryOverride(const QString &Geometry)
Parse an X11 style command line geometry string.
QString FindThemeDir(const QString &ThemeName, bool Fallback=true)
Returns the full path to the theme denoted by themename.
static void InitStatics(bool Reinit=false)
void SigResultReady(bool passwordValid, ParentalLevel::Level newLevel)
static void * RunPlaybackBox(void *player, bool showTV)
static void CreatePreviewGeneratorQueue(PreviewGenerator::Mode mode, uint maxAttempts, std::chrono::seconds minBlockSeconds)
Create the singleton queue of preview generators.
static void TeardownPreviewGeneratorQueue()
Destroy the singleton queue of preview generators.
static void * RunProgramList(void *player, ProgListType pltype, const QString &extraArg)
Holds information on recordings and videos.
static void * RunScheduleEditor(ProgramInfo *proginfo, void *player=nullptr)
Callback.
bool listen(QList< QHostAddress > addrs, quint16 port, bool requireall=true, PoolServerType type=kTCPServer)
void RunProlog(const QString &settingsPage)
static void SetHandler(int signum, SigHandlerFunc handler)
bool Create(void) override
Reports on various status items.
static void SetFuncPtr(const char *Name, void *Pointer)
Import pointers to functions used to embed the TV window into other containers e.g.
static bool StartTV(ProgramInfo *TVRec, uint Flags, const ChannelInfoList &Selection=ChannelInfoList())
Start playback of media.
static int ConfiguredTunerCards()
If any cards are configured, return the number.
View and select installed themes.
static VideoListDeathDelayPtr & GetSavedVideoList()
QPointer< class VideoListDeathDelay > VideoListDeathDelayPtr
static constexpr std::chrono::milliseconds kDelayTimeMS
Screen for viewing and managing upcoming and conflicted recordings.
static void * RunViewScheduled(void *player, bool showTv)
This dialog is used when playing something from the "Watch Videos" page. Playing from the "Watch Reco...
QString m_btnClearBookmark
QString m_btnPlayBookmark
void customEvent(QEvent *event) override
BookmarkDialog(ProgramInfo *pginfo, MythScreenStack *parent, bool bookmarkPresent, bool lastPlayPresent)
static void Create(bool check)
void OnPasswordResultReady(bool passwordValid, ParentalLevel::Level newLevel)
ParentalLevelChangeChecker m_plcc
~RunSettingsCompletion() override=default
RunSettingsCompletion(bool check)
bool InitializeMythSchema(void)
command to get the the initial database layout from an empty database:
bool UpgradeTVDatabaseSchema(const bool upgradeAllowed, const bool upgradeIfNoUI, const bool informSystemd)
Called from outside dbcheck.cpp to update the schema.
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
@ GENERIC_EXIT_DB_OUTOFDATE
Database needs upgrade.
@ GENERIC_EXIT_OK
Exited with no error.
@ GENERIC_EXIT_NO_THEME
No Theme available.
@ GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
@ GENERIC_EXIT_DB_ERROR
Database error.
@ GENERIC_EXIT_NOT_OK
Exited with error.
Implements Gallery Thumbnail screen.
const QString JUMP_VIDEO_TREE
const QString JUMP_VIDEO_GALLERY
const QString JUMP_VIDEO_MANAGER
const QString JUMP_VIDEO_DEFAULT
const QString JUMP_VIDEO_BROWSER
const QString JUMP_GALLERY_DEFAULT
static constexpr const char * MYTH_APPNAME_MYTHFRONTEND
Main header for mythcontrols.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
QString GetAppBinDir(void)
static void startKeysSetup()
static void startPlaybackWithGroup(const QString &recGroup="")
static void WriteDefaults()
static bool RunMenu(const QString &themedir, const QString &themename)
static void startManaged(void)
static void startChannelRecPriorities(void)
static void startTVNormal(void)
static void startSearchTime(void)
static void startSearchStored(void)
static void startGuide(void)
static bool isLiveTVAvailable(void)
static void standbyScreen(void)
static void startManageRecordingRules(void)
static void startSearchNew(void)
static void resetAllKeys(void)
Reset this host's key bindings and jump points to default values.
static void startPlayback(void)
static void TVMenuCallback(void *, QString &selection)
static SettingsHelper * g_settingsHelper
static MythPluginManager * g_pmanager
static void jumpScreenVideoDefault()
static void setDebugShowNames(void)
static void startSearchCategory(void)
static MediaRenderer * g_pUPnp
static void InitJumpPoints(void)
static void ReloadKeys(void)
static int internal_play_media(const QString &mrl, const QString &plot, const QString &title, const QString &subtitle, const QString &director, int season, int episode, const QString &inetref, std::chrono::minutes lenMins, const QString &year, const QString &id, const bool useBookmark)
static void startPreviousOld(void)
static void SetFuncPtrs(void)
static void jumpScreenVideoBrowser()
static int reloadTheme(void)
static void startCustomEdit(void)
static void jumpScreenVideoGallery()
static void startSearchKeyword(void)
static void handleDVDMedia(MythMediaDevice *dvd, bool)
static void showStatus(void)
static void startSearchPeople(void)
static void startSearchPower(void)
static MythThemedMenu * g_menu
static void startFinder(void)
static void gotoMainMenu(void)
static void handleGalleryMedia(MythMediaDevice *dev, bool forcePlayback)
static void startPrevious(void)
static void startSearchTitle(void)
Q_DECL_EXPORT int main(int argc, char **argv)
static void clearAllKeys(void)
Deletes all key bindings and jump points for this host.
static void startSearchMovie(void)
static bool WasAutomaticStart(void)
static void ReloadJumpPoints(void)
static void startSearchChannel(void)
static void jumpScreenVideoManager()
static void startAppearWiz(void)
static int internal_media_init()
static void fe_sd_notify(const char *)
static void reloadTheme_void(void)
static bool resetTheme(QString themedir, const QString &badtheme)
static int revokeRoot(void)
static void startCustomPriority(void)
static void InitKeys(void)
static void CleanupMyOldInUsePrograms(void)
static void jumpScreenVideoTree()
static void startManualSchedule(void)
static void handleExit(bool prompt)
static void RunVideoScreen(VideoDialog::DialogType type, bool fromJump=false)
static void setDebugShowBorders(void)
static const QString sLocation
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
static void REG_JUMPLOC(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void), const QString &LocalAction)
static void REG_JUMPEX(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void), bool ExitToMain)
static void REG_MEDIAPLAYER(const QString &Name, const QString &Desc, MediaPlayCallback Func)
static void REG_JUMP(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void))
static void REG_KEY(const QString &Context, const QString &Action, const QString &Description, const QString &Key)
void setHttpProxy(void)
Get network proxy settings from OS, and use for [Q]Http[Comms].
void ShowNotificationError(const QString &msg, const QString &from, const QString &detail, const VNMask visibility, const MythNotification::Priority priority)
convenience utility to display error message as notification
@ kMSPropagateLogs
add arguments for MythTV log propagation
@ kMSDisableUDPListener
disable MythMessage UDP listener for the duration of application.
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
MythUIHelper * GetMythUI()
static constexpr const char * FALLBACK_UI_THEME
static constexpr const char * DEFAULT_UI_THEME
std::chrono::seconds secsInPast(const QDateTime &past)
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
MythCommFlagCommandLineParser cmdline
void RunProgramFinder(TV *player, bool embedVideo, bool allowEPG)
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
@ kStartTVIgnoreLastPlayPos
int RemoteGetFreeRecorderCount(void)
int RemoteGetRecordingMask(void)