Go to the documentation of this file.
13 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
14 #include <QtAndroidExtras>
16 #include <QCoreApplication>
18 #define QAndroidJniObject QJniObject
21 #include <QApplication>
29 #include <QProcessEnvironment>
44 #include "libmythbase/mythconfig.h"
52 #include "libmythbase/mythversion.h"
123 #ifdef USING_LIBDNS_SD
124 #include <QScopedPointer>
127 #if CONFIG_SYSTEMD_NOTIFY
128 #include <systemd/sd-daemon.h>
129 static inline void fe_sd_notify(
const char *str) { sd_notify(0, str); };
152 static bool gLoaded =
false;
155 static const QString
sLocation = QCoreApplication::translate(
"(Common)",
176 this, &RunSettingsCompletion::OnPasswordResultReady);
211 LOG(VB_GENERAL, LOG_WARNING,
212 "Aggressive Parental Controls Warning: "
213 "invalid password. An attempt to enter a "
214 "MythVideo settings screen was prevented.");
233 bool bookmarkPresent,
bool lastPlayPresent) :
236 m_bookmarked(bookmarkPresent),
237 m_lastPlayed(lastPlayPresent),
238 m_btnPlayBookmark(tr(
"Play from bookmark")),
239 m_btnClearBookmark(tr(
"Clear bookmark")),
240 m_btnPlayBegin(tr(
"Play from beginning")),
241 m_btnPlayLast(tr(
"Play from last played position")),
242 m_btnClearLast(tr(
"Clear last played position")) {
247 QString msg = tr(
"DVD/Video contains a bookmark");
249 m_videoDlg =
dynamic_cast<VideoDialog*
>(GetScreenStack()->GetTopScreen());
250 auto *popup =
new MythDialogBox(msg, GetScreenStack(),
"bookmarkdialog");
251 if (!popup->Create())
257 GetScreenStack()->AddScreen(popup);
259 popup->SetReturnEvent(
this,
"bookmarkdialog");
261 popup->AddButton(m_btnPlayLast);
263 popup->AddButton(m_btnPlayBookmark);
264 popup->AddButton(m_btnPlayBegin);
266 popup->AddButton(m_btnClearLast);
268 popup->AddButton(m_btnClearBookmark);
278 QString buttonText = dce->GetResultText();
280 if (dce->GetId() !=
"bookmarkdialog")
283 if (buttonText == m_btnPlayLast)
285 else if (buttonText == m_btnPlayBookmark)
287 else if (buttonText == m_btnPlayBegin)
289 else if (buttonText == m_btnClearBookmark)
291 m_pgi->SaveBookmark(0);
294 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
297 else if (buttonText == m_btnClearLast)
299 m_pgi->SaveLastPlayPos(0);
302 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
310 bool m_bookmarked {
false};
311 bool m_lastPlayed {
false};
322 QCoreApplication::processEvents();
334 LOG(VB_GENERAL, LOG_INFO,
"Shutting down UPnP client...");
374 ShowOkPopup(QCoreApplication::translate(
"(MythFrontendMain)",
375 "The ScreenSetupWizard cannot be used while "
376 "mythfrontend is operating in windowed mode."));
413 auto *mythcontrols =
new MythControls(mainStack,
"mythcontrols");
415 if (mythcontrols->Create())
540 if (viewsched->Create())
552 if (progRecPrior->Create())
564 if (chanRecPrior->Create())
576 if (custom->Create())
586 auto *pbb =
new PlaybackBox(mainStack,
"playbackbox");
590 if (!recGroup.isEmpty())
591 pbb->setInitialRecGroup(recGroup);
631 if (custom->Create())
643 if (mansched->Create())
654 QString msg = QCoreApplication::translate(
"(Common)",
"All tuners are currently busy.");
657 msg = QCoreApplication::translate(
"(Common)",
"There are no configured tuners.");
672 while (keylist.size() < 2)
695 auto *statusbox =
new StatusBox(mainStack);
697 if (statusbox->Create())
710 if (idlescreen->Create())
718 QString message = QCoreApplication::translate(
"(MythFrontendMain)",
719 "Loading videos ...");
725 "mythvideobusydialog");
727 if (busyPopup->Create())
739 video_list = saved->GetSaved();
740 LOG(VB_GENERAL, LOG_INFO,
741 QString(
"Reusing saved video list because MythVideo was resumed"
756 if (mythvideo->Create())
777 if (galleryView->Create())
780 galleryView->Start();
796 QString command_string =
798 QString bluray_mountpoint =
800 QDir bdtest(bluray_mountpoint +
"/BDMV");
809 QString
filename = QString(
"bd:/%1").arg(bluray_mountpoint);
812 0, 0,
"", 0min,
"",
"",
true);
820 if (dvd_device.isEmpty())
825 if ((command_string.indexOf(
"internal", 0, Qt::CaseInsensitive) > -1) ||
826 (command_string.length() < 1))
831 #elif defined(_WIN32)
838 command_string =
"Internal";
840 "",
"", 0, 0,
"", 0min,
"",
"",
true);
846 if (command_string.contains(
"%d"))
851 command_string = command_string.replace(
"%d", dvd_device);
887 LOG(VB_GENERAL, LOG_ERR,
888 "mythdvd main.o: handleMedia() does not know what to do");
900 QVector<MythScreenType*> screens;
904 for (
const auto *screen : std::as_const(screens))
906 if (qobject_cast<const GalleryThumbView*>(screen))
909 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - already running");
916 LOG(VB_GUI, LOG_INFO,
"Main: Autostarting Gallery for new media");
921 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - autorun not set");
927 QString sel = selection.toLower();
929 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
937 if (sel ==
"tv_watch_live")
939 else if (sel.startsWith(
"tv_watch_recording"))
942 if ((selection.length() > 19) && (selection.mid(18, 1) ==
" "))
947 else if (sel ==
"tv_schedule")
951 else if (sel ==
"tv_manualschedule")
955 else if (sel ==
"tv_custom_record")
959 else if (sel ==
"tv_fix_conflicts")
963 else if (sel ==
"tv_manage_recording_rules")
967 else if (sel ==
"tv_progfind")
971 else if (sel ==
"tv_search_title")
975 else if (sel ==
"tv_search_keyword")
979 else if (sel ==
"tv_search_people")
983 else if (sel ==
"tv_search_power")
987 else if (sel ==
"tv_search_stored")
991 else if (sel ==
"tv_search_channel")
995 else if (sel ==
"tv_search_category")
999 else if (sel ==
"tv_search_movie")
1003 else if (sel ==
"tv_search_new")
1007 else if (sel ==
"tv_search_time")
1011 else if (sel ==
"tv_previous")
1015 else if (sel ==
"tv_previous_old")
1019 else if (sel ==
"settings appearance")
1034 else if (sel ==
"settings themechooser")
1044 else if (sel ==
"settings setupwizard")
1054 else if (sel ==
"settings grabbers")
1064 else if (sel ==
"screensetupwizard")
1068 else if (sel ==
"setup_keys")
1072 else if (sel ==
"settings playgroup")
1087 else if (sel ==
"settings general")
1102 else if (sel ==
"settings audiogeneral")
1118 else if (sel ==
"settings maingeneral")
1133 else if (sel ==
"settings playback")
1148 else if (sel ==
"settings osd")
1163 else if (sel ==
"settings epg")
1178 else if (sel ==
"settings channelgroups")
1193 else if (sel ==
"settings generalrecpriorities")
1197 "generalrecprioritiessettings",
1209 else if (sel ==
"settings channelrecpriorities")
1213 else if (sel ==
"settings custompriority")
1217 else if (sel ==
"system_events")
1228 else if (sel ==
"video_settings_general")
1231 GetBoolSetting(
"VideoAggressivePC",
false));
1233 else if (sel ==
"video_settings_player")
1244 else if (sel ==
"video_settings_metadata")
1255 else if (sel ==
"video_settings_associations")
1264 else if (sel ==
"manager")
1268 else if (sel ==
"browser")
1272 else if (sel ==
"listing")
1276 else if (sel ==
"gallery")
1280 else if (sel ==
"disc_play")
1284 else if (sel ==
"tv_status")
1288 else if (sel ==
"exiting_app_prompt")
1292 else if (sel ==
"exiting_app")
1296 else if (sel ==
"standby_mode")
1300 else if (sel ==
"exiting_menu")
1306 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
1309 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
1325 prompter->HandleExit();
1341 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Found mainmenu.xml for theme '%1'")
1348 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find mainmenu.xml for theme '%1'")
1388 const QString &title,
const QString &subtitle,
1389 const QString &director,
int season,
int episode,
1390 const QString &inetref, std::chrono::minutes lenMins,
1391 const QString &year,
1392 const QString &
id,
const bool useBookmark)
1396 QFile checkFile(mrl);
1397 if ((!checkFile.exists() && !mrl.startsWith(
"dvd:")
1398 && !mrl.startsWith(
"bd:")
1399 && !mrl.startsWith(
"myth:")
1400 && !mrl.startsWith(
"http://")
1401 && !mrl.startsWith(
"https://")))
1403 QString errorText = QCoreApplication::translate(
"(MythFrontendMain)",
1404 "Failed to open \n '%1' in %2 \n"
1405 "Check if the video exists")
1406 .arg(mrl.section(
'/', -1),
1407 mrl.section(
'/', 0, -2));
1414 mrl, plot, title, QString(), subtitle, QString(),
1415 director, season, episode, inetref, lenMins,
1416 (year.toUInt()) ? year.toUInt() : 1900,
id);
1418 pginfo->SetProgramInfoType(pginfo->DiscoverProgramInfoType());
1420 bool bookmarkPresent =
false;
1421 bool lastPlayPresent =
false;
1423 if (pginfo->IsVideoDVD())
1425 auto *dvd =
new MythDVDInfo(pginfo->GetPlaybackURL());
1430 if (dvd->GetNameAndSerialNum(name, serialid))
1432 QStringList fields = pginfo->QueryDVDBookmark(serialid);
1433 bookmarkPresent = (fields.count() > 0);
1441 dvd->GetLastError());
1448 else if (pginfo->IsVideoBD())
1457 QStringList fields = pginfo->QueryBDBookmark(serialid);
1458 bookmarkPresent = (fields.count() > 0);
1471 else if (useBookmark && pginfo->IsVideo())
1473 pginfo->SetIgnoreLastPlayPos(
false);
1474 pginfo->SetIgnoreBookmark(
false);
1475 bookmarkPresent = pginfo->QueryBookmark() > 0;
1476 lastPlayPresent = pginfo->QueryLastPlayPos() > 0;
1479 if (useBookmark && (bookmarkPresent || lastPlayPresent))
1482 auto *bookmarkdialog =
new BookmarkDialog(pginfo, mainStack,
1485 if (!bookmarkdialog->Create())
1487 delete bookmarkdialog;
1507 auto *lmenu = qobject_cast<MythThemedMenuState *>
1510 lmenu->m_buttonList->SetItemCurrent(0);
1522 LOG(VB_GENERAL, LOG_WARNING, QString(
"Overriding broken theme '%1' with '%2'")
1523 .arg(badtheme, themename));
1542 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1543 auto activity = QtAndroid::androidActivity();
1545 QJniObject activity = QNativeInterface::QAndroidApplication::context();
1547 auto packageManager = activity.callObjectMethod
1548 (
"getPackageManager",
1549 "()Landroid/content/pm/PackageManager;" );
1551 auto activityIntent = packageManager.callObjectMethod
1552 (
"getLaunchIntentForPackage",
1553 "(Ljava/lang/String;)Landroid/content/Intent;",
1554 activity.callObjectMethod(
"getPackageName",
1555 "()Ljava/lang/String;").object() );
1557 auto pendingIntent = QAndroidJniObject::callStaticObjectMethod
1558 (
"android/app/PendingIntent",
1560 "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;",
1563 activityIntent.object(),
1564 QAndroidJniObject::getStaticField<jint>(
"android/content/Intent",
1565 "FLAG_ACTIVITY_CLEAR_TOP") );
1567 auto alarmManager = activity.callObjectMethod
1568 (
"getSystemService",
1569 "(Ljava/lang/String;)Ljava/lang/Object;",
1570 QAndroidJniObject::getStaticObjectField(
"android/content/Context",
1572 "Ljava/lang/String;").
object() );
1574 alarmManager.callMethod<
void>
1576 "(IJLandroid/app/PendingIntent;)V",
1577 QAndroidJniObject::getStaticField<jint>(
"android/app/AlarmManager",
"RTC"),
1578 jlong(QDateTime::currentMSecsSinceEpoch() + 100),
1579 pendingIntent.object() );
1595 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'").arg(themename));
1647 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Reload Theme"),
1649 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Main Menu"),
1651 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Guide"),
1653 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Finder"),
1657 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recordings / "
1658 "Fix Conflicts"),
"",
"",
startManaged,
"VIEWSCHEDULED");
1659 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recording Rules"),
1661 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Channel Recording "
1663 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"TV Recording Playback"),
1665 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Live TV"),
1667 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Status Screen"),
1669 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Previously Recorded"),
1672 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Standby Mode"),
1687 REG_JUMP(
"Play Disc", QT_TRANSLATE_NOOP(
"MythControls",
1688 "Play an Optical Disc"),
"",
playDisc);
1695 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Borders"),
1697 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Names"),
1699 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Reset All Keys"),
1700 QT_TRANSLATE_NOOP(
"MythControls",
"Reset all keys to defaults"),
1713 REG_KEY(
"Video",
"PLAYALT", QT_TRANSLATE_NOOP(
"MythControls",
1714 "Play selected item in alternate player"),
"ALT+P");
1715 REG_KEY(
"Video",
"FILTER", QT_TRANSLATE_NOOP(
"MythControls",
1716 "Open video filter dialog"),
"F");
1717 REG_KEY(
"Video",
"INCPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1718 "Increase Parental Level"),
"],},F11");
1719 REG_KEY(
"Video",
"DECPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1720 "Decrease Parental Level"),
"[,{,F10");
1721 REG_KEY(
"Video",
"INCSEARCH", QT_TRANSLATE_NOOP(
"MythControls",
1722 "Show Incremental Search Dialog"),
"Ctrl+S,Search");
1723 REG_KEY(
"Video",
"DOWNLOADDATA", QT_TRANSLATE_NOOP(
"MythControls",
1724 "Download metadata for current item"),
"W");
1725 REG_KEY(
"Video",
"ITEMDETAIL", QT_TRANSLATE_NOOP(
"MythControls",
1726 "Display Item Detail Popup"),
"");
1729 REG_KEY(
"Images",
"PLAY", QT_TRANSLATE_NOOP(
"MythControls",
1730 "Start/Stop Slideshow"),
"P,Media Play");
1731 REG_KEY(
"Images",
"RECURSIVESHOW", QT_TRANSLATE_NOOP(
"MythControls",
1732 "Start Recursive Slideshow"),
"R");
1733 REG_KEY(
"Images",
"ROTRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1734 "Rotate image right 90 degrees"),
"],3");
1735 REG_KEY(
"Images",
"ROTLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1736 "Rotate image left 90 degrees"),
"[,1");
1737 REG_KEY(
"Images",
"FLIPHORIZONTAL", QT_TRANSLATE_NOOP(
"MythControls",
1738 "Flip image horizontally"),
"");
1739 REG_KEY(
"Images",
"FLIPVERTICAL", QT_TRANSLATE_NOOP(
"MythControls",
1740 "Flip image vertically"),
"");
1741 REG_KEY(
"Images",
"ZOOMOUT", QT_TRANSLATE_NOOP(
"MythControls",
1742 "Zoom image out"),
"7,<,Ctrl+B,Media Rewind");
1743 REG_KEY(
"Images",
"ZOOMIN", QT_TRANSLATE_NOOP(
"MythControls",
1744 "Zoom image in"),
"9,>,Ctrl+F,Media Fast Forward");
1745 REG_KEY(
"Images",
"FULLSIZE", QT_TRANSLATE_NOOP(
"MythControls",
1746 "Full-size (un-zoom) image"),
"0");
1747 REG_KEY(
"Images",
"MARK", QT_TRANSLATE_NOOP(
"MythControls",
1748 "Mark image"),
"T");
1749 REG_KEY(
"Images",
"SCROLLUP", QT_TRANSLATE_NOOP(
"MythControls",
1750 "Scroll image up"),
"2");
1751 REG_KEY(
"Images",
"SCROLLLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1752 "Scroll image left"),
"4");
1753 REG_KEY(
"Images",
"SCROLLRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1754 "Scroll image right"),
"6");
1755 REG_KEY(
"Images",
"SCROLLDOWN", QT_TRANSLATE_NOOP(
"MythControls",
1756 "Scroll image down"),
"8");
1757 REG_KEY(
"Images",
"RECENTER", QT_TRANSLATE_NOOP(
"MythControls",
1758 "Recenter image"),
"5");
1759 REG_KEY(
"Images",
"COVER", QT_TRANSLATE_NOOP(
"MythControls",
1760 "Set or clear cover image"),
"C");
1790 query.
prepare(
"DELETE FROM keybindings "
1791 "WHERE hostname = :HOSTNAME;");
1795 query.
prepare(
"DELETE FROM jumppoints "
1796 "WHERE hostname = :HOSTNAME;");
1840 query.
prepare(
"DELETE FROM inuseprograms "
1841 "WHERE hostname = :HOSTNAME and recusage = 'player' ;");
1849 bool autoStart =
false;
1855 QDateTime startupTime = QDateTime();
1864 if (startupTime.isValid())
1867 startupSecs = std::max(startupSecs, 15 * 60s);
1874 LOG(VB_GENERAL, LOG_INFO,
1875 "Close to auto-start time, AUTO-Startup assumed");
1881 LOG(VB_GENERAL, LOG_INFO,
1882 "Close to MythFillDB suggested run time, AUTO-Startup to fetch guide data?");
1888 LOG(VB_GENERAL, LOG_DEBUG,
1889 "NOT close to auto-start time, USER-initiated startup assumed");
1899 if (!wakeupCmd.isEmpty())
1902 bool bConflicts =
false;
1903 QDateTime nextRecordingStart;
1910 for (
auto *prog : progList)
1914 (prog->GetHostname() ==
hostname) &&
1915 (nextRecordingStart.isNull() ||
1916 nextRecordingStart > prog->GetRecordingStartTime()))
1918 nextRecordingStart = prog->GetRecordingStartTime();
1922 if (!nextRecordingStart.isNull() &&
1925 LOG(VB_GENERAL, LOG_INFO,
1926 "Close to start time, AUTO-Startup assumed");
1934 LOG(VB_GENERAL, LOG_DEBUG,
1935 "NOT close to auto-start time, USER-initiated startup assumed");
1961 Q_DECL_EXPORT
int main(
int argc,
char **argv)
1963 bool bPromptForBackend =
false;
1964 bool bBypassAutoDiscovery =
false;
1986 QApplication::setSetuidAllowed(
true);
1987 QApplication a(argc, argv);
1992 QString path = QCoreApplication::applicationDirPath();
1994 QString(
"%1/../Resources/lib/%2:/../Resources/lib/%2/site-packages:/../Resources/lib/%2/lib-dynload:%3")
1996 .arg(QFileInfo(PYTHON_EXE).fileName())
1997 .arg(QProcessEnvironment::systemEnvironment().value(
"PYTHONPATH"))
1998 .toUtf8().constData(), 1);
2007 #if defined(Q_OS_ANDROID)
2008 auto config = QSslConfiguration::defaultConfiguration();
2009 config.setCaCertificates(QSslConfiguration::systemCaCertificates());
2010 QSslConfiguration::setDefaultConfiguration(config);
2017 bool ResetSettings =
false;
2020 bPromptForBackend =
true;
2022 bBypassAutoDiscovery =
true;
2024 if (signal(
SIGPIPE, SIG_IGN) == SIG_ERR)
2025 std::cerr <<
"Unable to ignore SIGPIPE\n";
2035 if (!
gContext->
Init(
true, bPromptForBackend, bBypassAutoDiscovery))
2037 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
2051 ResetSettings =
true;
2066 QDir dir(fileprefix);
2068 dir.mkdir(fileprefix);
2081 LOG(VB_GENERAL, LOG_NOTICE,
"Appearance settings and language have "
2082 "been reset to defaults. You will need to "
2083 "restart the frontend.");
2088 #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2090 if (maxImageSize >=0)
2091 QImageReader::setAllocationLimit(maxImageSize);
2093 LOG(VB_GENERAL, LOG_DEBUG,
2094 QString(
"Built against zlib %1, linked against %2.")
2095 .arg(ZLIB_VERSION, zlibVersion()));
2096 QList<QByteArray>
formats = QImageReader::supportedImageFormats();
2097 QString format_str =
formats.takeFirst();
2098 for (
const auto& format : std::as_const(
formats))
2099 format_str +=
", " + format;
2100 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Supported image formats: %1").arg(format_str));
2102 QCoreApplication::setSetuidAllowed(
true);
2106 LOG(VB_GENERAL, LOG_ERR,
"Failed to revokeRoot(), exiting.");
2110 #ifdef USING_LIBDNS_SD
2116 fe_sd_notify(
"STATUS=Registering frontend with bonjour");
2121 QByteArray name(
"Mythfrontend on ");
2123 bonjour->Register(port,
"_mythfrontend._tcp",
2142 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2151 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2165 mainWindow->Init(
false);
2166 mainWindow->setWindowTitle(QCoreApplication::translate(
"(MythFrontendMain)",
2168 "Main window title"));
2170 #ifdef USING_AIRPLAY
2193 LOG(VB_GENERAL, LOG_ERR,
2194 "Couldn't upgrade database to new schema, exiting.");
2202 mainWindow->ReloadKeys();
2225 mainWindow->installEventFilter(mon);
2234 if (!networkControl->
listen(port))
2236 LOG(VB_GENERAL, LOG_ERR,
2237 QString(
"NetworkControl failed to bind to port %1.")
2253 std::unique_ptr<ThemeUpdateChecker> themeUpdateChecker;
2255 themeUpdateChecker = std::make_unique<ThemeUpdateChecker>();
2267 #ifdef CONFIG_BINDINGS_PYTHON
2271 housekeeping->Start();
2284 LOG(VB_GENERAL, LOG_ERR,
2285 QString(
"Invalid plugin name supplied on command line: '%1'")
2287 LOG(VB_GENERAL, LOG_ERR,
2288 QString(
"Available plugins: %1")
2289 .arg(plugins.join(
", ")));
2301 LOG(VB_GENERAL, LOG_ERR,
2302 QString(
"Invalid jump point supplied on the command line: %1")
2304 LOG(VB_GENERAL, LOG_ERR,
2305 QString(
"Available jump points: %2")
2334 ret = QCoreApplication::exec();
2344 delete housekeeping;
2351 delete networkControl;
2357 LOG(VB_GENERAL, LOG_INFO,
"Reloading theme");
2366 LOG(VB_GENERAL, LOG_INFO,
"Restarting LIRC handler");
2374 #include "mythfrontend.moc"
static void startChannelRecPriorities(void)
void SetPluginManager(MythPluginManager *pmanager)
QSqlQuery wrapper that fetches a DB connection from the connection pool.
static void startAppearWiz(void)
MythScreenStack * GetMainStack()
static void InitStatics(bool Reinit=false)
static void * RunPlaybackBox(void *player, bool showTV)
Manages registered HouseKeeperTasks and queues tasks for operation.
@ GENERIC_EXIT_NO_THEME
No Theme available.
void SendMessage(const QString &message)
QString RemoveCurrentLocation()
static void RunProgramGuide(uint startChanId, const QString &startChanNum, const QDateTime &startTime, TV *player=nullptr, bool embedVideo=false, bool allowFinder=true, int changrpid=-1)
View and select installed themes.
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 Init(bool MayReInit=true)
static void ParseGeometryOverride(const QString &Geometry)
Parse an X11 style command line geometry string.
static void startManageRecordingRules(void)
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
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
static void jumpScreenVideoManager()
static void handleExit(bool prompt)
static void reload()
Reload all active translators based on the current language setting.
ParentalLevelChangeChecker m_plcc
RunSettingsCompletion(bool check)
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.
static int reloadTheme(void)
MythCommFlagCommandLineParser cmdline
static void ReloadKeys(void)
bool run_plugin(const QString &plugname)
void emitTVPlaybackStopped(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)
void RunProgramFinder(TV *player, bool embedVideo, bool allowEPG)
static void startSearchPower(void)
static void startSearchTitle(void)
void JumpTo(const QString &Destination, bool Pop=true)
static void startSearchNew(void)
Startup context for MythTV.
void OverrideSettingForSession(const QString &key, const QString &value)
int RemoteGetFreeRecorderCount(void)
static void jumpScreenVideoDefault()
static void jumpScreenVideoTree()
static void standbyScreen(void)
static void CreatePreviewGeneratorQueue(PreviewGenerator::Mode mode, uint maxAttempts, std::chrono::seconds minBlockSeconds)
Create the singleton queue of preview generators.
void emitTVPlaybackStarted(void)
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
static void PrintDebug(void)
Print out any leaks if that level of debugging is enabled.
int RemoteGetRecordingMask(void)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
Q_DECL_EXPORT int main(int argc, char **argv)
static void SetFuncPtrs(void)
static VideoListDeathDelayPtr & GetSavedVideoList()
static void Cleanup(void)
static void startSearchStored(void)
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
MythPainter * GetPainter()
static void startPlayback(void)
static void startSearchCategory(void)
static void * RunProgramList(void *player, ProgListType pltype, const QString &extraArg)
static void startManaged(void)
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)
static SettingsHelper * g_settingsHelper
BookmarkDialog(ProgramInfo *pginfo, MythScreenStack *parent, bool bookmarkPresent, bool lastPlayPresent)
static bool StartTV(ProgramInfo *TVRec, uint Flags, const ChannelInfoList &Selection=ChannelInfoList())
Start playback of media.
const QString JUMP_VIDEO_TREE
void SetEffectsEnabled(bool Enable)
static bool RunMenu(const QString &themedir, const QString &themename)
static void startPreviousOld(void)
static void ConfigureQtGUI(int SwapInterval, const MythCommandLineParser &CmdLine)
Shared static initialisation code for all MythTV GUI applications.
static void fe_sd_notify(const char *)
void GetScreenList(QVector< MythScreenType * > &screens)
static void startSearchChannel(void)
static void Create(bool check)
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
static const QString sLocation
bool InitializeMythSchema(void)
command to get the the initial database layout from an empty database:
bool Create(void) override
static void handleGalleryMedia(MythMediaDevice *dev)
static void startCustomEdit(void)
static void Addservices(const HTTPServices &Services)
static void InitJumpPoints(void)
@ GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
QString m_btnClearBookmark
static int ConfiguredTunerCards()
If any cards are configured, return the number.
void customEvent(QEvent *event) override
static bool BackendIsRunning(void)
a backend process is running on this host
static void jumpScreenVideoGallery()
void SetAsFrontend(bool frontend)
bool UpgradeTVDatabaseSchema(const bool upgradeAllowed, const bool upgradeIfNoUI, [[maybe_unused]] const bool informSystemd)
Called from outside dbcheck.cpp to update the schema.
QPointer< class VideoListDeathDelay > VideoListDeathDelayPtr
const QString JUMP_VIDEO_MANAGER
@ GENERIC_EXIT_OK
Exited with no error.
Basic menu dialog, message and a list of options.
static void startPlaybackWithGroup(const QString &recGroup="")
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void WriteDefaults()
Main header for mythcontrols.
static void DBError(const QString &where, const MSqlQuery &query)
static void startSearchTime(void)
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
QString m_btnPlayBookmark
const std::array< const std::string, 8 > formats
static void gotoMainMenu(void)
Implements Gallery Thumbnail screen.
bool DestinationExists(const QString &Destination) const
void DestroyMythMainWindow(void)
static QStringList SupportedImages()
Return recognised pictures.
static bool isLiveTVAvailable(void)
static void showStatus(void)
QString FindThemeDir(const QString &ThemeName, bool Fallback=true)
Returns the full path to the theme denoted by themename.
static void clearAllKeys(void)
Deletes all key bindings and jump points for this host.
static void PrintVersion(void)
Print application version information.
static void * RunScheduleEditor(ProgramInfo *proginfo, void *player=nullptr)
Callback.
const QString JUMP_VIDEO_GALLERY
static int internal_media_init()
bool GetNameAndSerialNum(QString &Name, QString &SerialNum)
void PrintHelp(void) const
Print command line option help.
An editor for MythSystemEvent handler commands.
const QString JUMP_VIDEO_BROWSER
@ kMSPropagateLogs
add arguments for MythTV log propagation
@ GENERIC_EXIT_DB_OUTOFDATE
Database needs upgrade.
static void startCustomPriority(void)
static HTTPResponse RedirectRoot(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests for index.html to a context specific file.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
const QString JUMP_GALLERY_DEFAULT
static MythPluginManager * g_pmanager
void SigResultReady(bool passwordValid, ParentalLevel::Level newLevel)
void ApplySettingsOverride(void)
Apply all overrides to the global context.
QStringList EnumerateDestinations() const
A screen to create a fully custom recording.
int GetNumSetting(const QString &key, int defaultval=0)
static void * RunViewScheduled(void *player, bool showTv)
@ kStartTVIgnoreLastPlayPos
void OnPasswordResultReady(bool passwordValid, ParentalLevel::Level newLevel)
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
bool ShowBorders(void) const
static int revokeRoot(void)
bool GetBoolSetting(const QString &key, bool defaultval=false)
Reports on various status items.
static ImageType inspectImage(const QString &path)
static void TeardownPreviewGeneratorQueue()
Destroy the singleton queue of preview generators.
Screen for managing channel priorities in recording scheduling decisions.
static void Init(QObject *parent=nullptr)
static constexpr const char * DEFAULT_UI_THEME
static void setDebugShowBorders(void)
static void startSearchMovie(void)
bool ShowTypeNames(void) const
void SetDebugMode(bool showBorders, bool showNames)
static constexpr const char * MYTH_APPNAME_MYTHFRONTEND
static void startManualSchedule(void)
@ kMSDisableUDPListener
disable MythMessage UDP listener for the duration of application.
static void ReloadJumpPoints(void)
Holds information on recordings and videos.
static void RunVideoScreen(VideoDialog::DialogType type, bool fromJump=false)
static void startTVNormal(void)
std::chrono::seconds secsInPast(const QDateTime &past)
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
static void SetupLCD(void)
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
static void handleDVDMedia(MythMediaDevice *dvd)
QString GetSettingOnHost(const QString &key, const QString &host, const QString &defaultval="")
static bool prompt(bool force=false)
Ask the user for the language to use.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
static void Cleanup(void)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
QStringList EnumeratePlugins(void)
Screen for viewing and managing upcoming and conflicted recordings.
static void REG_JUMP(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void))
static void SetFuncPtr(const char *Name, void *Pointer)
Import pointers to functions used to embed the TV window into other containers e.g.
static const Type kEventType
QString GetAppBinDir(void)
static void jumpScreenVideoBrowser()
static bool resetTheme(QString themedir, const QString &badtheme)
static void SetHandler(int signum, SigHandlerFunc handler)
static void REG_MEDIAPLAYER(const QString &Name, const QString &Desc, MediaPlayCallback Func)
MythMainWindow * GetMythMainWindow(void)
@ GENERIC_EXIT_NOT_OK
Exited with error.
static MediaRenderer * g_pUPnp
static void startPrevious(void)
This dialog is used when playing something from the "Watch Videos" page. Playing from the "Watch Reco...
QString GetLastError(void) const
static void REG_JUMPEX(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void), bool ExitToMain)
void ActivateSettingsCache(bool activate=true)
static void startGuide(void)
MythScreenStack * GetStack(const QString &Stackname)
static constexpr std::chrono::milliseconds kDelayTimeMS
static void resetAllKeys(void)
Reset this host's key bindings and jump points to default values.
bool listen(QList< QHostAddress > addrs, quint16 port, bool requireall=true, PoolServerType type=kTCPServer)
void ClearKeyContext(const QString &Context)
QString GetHostName(void)
static void CleanupMyOldInUsePrograms(void)
void RunProlog(const QString &settingsPage)
int ConfigureLogging(const QString &mask="general", bool progress=false)
Read in logging options and initialize the logging interface.
Screen for managing and configuring keyboard input bindings.
void ClearSettingsCache(const QString &myKey=QString(""))
bool IsMasterHost(void)
is this the same host as the master
static constexpr const char * FALLBACK_UI_THEME
void AddCurrentLocation(const QString &Location)
static void setDebugShowNames(void)
void SaveSetting(const QString &key, int newValue)
static void TVMenuCallback([[maybe_unused]] void *data, QString &selection)
static bool WasAutomaticStart(void)
static void Cleanup(void)
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
MythUIHelper * GetMythUI()
static MythThemedMenu * g_menu
void RestartInputHandlers()
Handles incoming MythSystemEvent messages.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
static void startFinder(void)
static void startSearchPeople(void)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
static void reloadTheme_void(void)
static void REG_JUMPLOC(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void), const QString &LocalAction)
MythContext * gContext
This global variable contains the MythContext instance for the application.
static HTTPResponse RewriteToSPA(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests to a Single Page web app (SPA)
bool Init(bool gui=true, bool promptForBackend=false, bool disableAutoDiscovery=false, bool ignoreDB=false)
void SetExiting(bool exiting=true)
static void startSearchKeyword(void)
@ GENERIC_EXIT_DB_ERROR
Database error.
const QString JUMP_VIDEO_DEFAULT
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
void PauseIdleTimer(bool Pause)
Pause the idle timeout timer.
QString GetSetting(const QString &key, const QString &defaultval="")
static QStringList SupportedVideos()
Return recognised video extensions.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
virtual MythScreenType * GetTopScreen(void) const
static void AddErrorPageHandler(const HTTPHandler &Handler)
static void startKeysSetup()
static void InitKeys(void)
std::vector< ChannelInfo > ChannelInfoList