1#include "libmythbase/mythconfig.h"
15#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
16#include <QtAndroidExtras>
18#include <QCoreApplication>
20#define QAndroidJniObject QJniObject
23#include <QApplication>
31#include <QProcessEnvironment>
35#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
36#include <QtWebEngineQuick>
62#include "libmythbase/mythversion.h"
133#include <QScopedPointer>
136#if CONFIG_SYSTEMD_NOTIFY
137#include <systemd/sd-daemon.h>
138static inline void fe_sd_notify(
const char *str) { sd_notify(0, str); };
161static bool gLoaded =
false;
164static const QString
sLocation = QCoreApplication::translate(
"(Common)",
185 this, &RunSettingsCompletion::OnPasswordResultReady);
220 LOG(VB_GENERAL, LOG_WARNING,
221 "Aggressive Parental Controls Warning: "
222 "invalid password. An attempt to enter a "
223 "MythVideo settings screen was prevented.");
242 bool bookmarkPresent,
bool lastPlayPresent) :
245 m_bookmarked(bookmarkPresent),
246 m_lastPlayed(lastPlayPresent),
247 m_btnPlayBookmark(tr(
"Play from bookmark")),
248 m_btnClearBookmark(tr(
"Clear bookmark")),
249 m_btnPlayBegin(tr(
"Play from beginning")),
250 m_btnPlayLast(tr(
"Play from last played position")),
251 m_btnClearLast(tr(
"Clear last played position")) {
256 QString msg = tr(
"DVD/Video contains a bookmark");
258 m_videoDlg =
dynamic_cast<VideoDialog*
>(GetScreenStack()->GetTopScreen());
259 auto *popup =
new MythDialogBox(msg, GetScreenStack(),
"bookmarkdialog");
260 if (!popup->Create())
266 GetScreenStack()->AddScreen(popup);
268 popup->SetReturnEvent(
this,
"bookmarkdialog");
270 popup->AddButton(m_btnPlayLast);
272 popup->AddButton(m_btnPlayBookmark);
273 popup->AddButton(m_btnPlayBegin);
275 popup->AddButton(m_btnClearLast);
277 popup->AddButton(m_btnClearBookmark);
287 QString buttonText = dce->GetResultText();
289 if (dce->GetId() !=
"bookmarkdialog")
292 if (buttonText == m_btnPlayLast)
294 else if (buttonText == m_btnPlayBookmark)
296 else if (buttonText == m_btnPlayBegin)
298 else if (buttonText == m_btnClearBookmark)
300 m_pgi->SaveBookmark(0);
303 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
306 else if (buttonText == m_btnClearLast)
308 m_pgi->SaveLastPlayPos(0);
311 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
319 bool m_bookmarked {
false};
320 bool m_lastPlayed {
false};
331 QCoreApplication::processEvents();
342 LOG(VB_GENERAL, LOG_INFO,
"Shutting down UPnP client...");
375 ShowOkPopup(QCoreApplication::translate(
"(MythFrontendMain)",
376 "The ScreenSetupWizard cannot be used while "
377 "mythfrontend is operating in windowed mode."));
414 auto *mythcontrols =
new MythControls(mainStack,
"mythcontrols");
416 if (mythcontrols->Create())
541 if (viewsched->Create())
553 if (progRecPrior->Create())
565 if (chanRecPrior->Create())
577 if (custom->Create())
587 auto *pbb =
new PlaybackBox(mainStack,
"playbackbox");
591 if (!recGroup.isEmpty())
592 pbb->setInitialRecGroup(recGroup);
632 if (custom->Create())
644 if (mansched->Create())
655 QString msg = QCoreApplication::translate(
"(Common)",
"All tuners are currently busy.");
658 msg = QCoreApplication::translate(
"(Common)",
"There are no configured tuners.");
673 while (keylist.size() < 2)
696 auto *statusbox =
new StatusBox(mainStack);
698 if (statusbox->Create())
711 if (idlescreen->Create())
719 QString message = QCoreApplication::translate(
"(MythFrontendMain)",
720 "Loading videos ...");
726 "mythvideobusydialog");
728 if (busyPopup->Create())
740 video_list = saved->GetSaved();
741 LOG(VB_GENERAL, LOG_INFO,
742 QString(
"Reusing saved video list because MythVideo was resumed"
757 if (mythvideo->Create())
778 if (galleryView->Create())
781 galleryView->Start();
792 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for BluRay medium");
793 const QString bluray_mountpoint =
795 QDir bdtest(bluray_mountpoint +
"/BDMV");
801 QString
filename = QString(
"bd:/%1").arg(bluray_mountpoint);
804 0, 0,
"", 0min,
"",
"",
true);
813 LOG(VB_MEDIA, LOG_ERR,
"Could not access media monitor");
818 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for DVD medium");
819 const bool isDVD = mediaMonitor->
IsActive()
826 if (dvd_device.isEmpty())
832 QString command_string =
834 if ((command_string.indexOf(
"internal", 0, Qt::CaseInsensitive) > -1) ||
835 (command_string.length() < 1))
847 command_string =
"Internal";
849 "",
"", 0, 0,
"", 0min,
"",
"",
true);
855 if (command_string.contains(
"%d"))
860 command_string = command_string.replace(
"%d", dvd_device);
877 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for audio CD medium");
881 if (!audioMedia.isEmpty())
883 for (
auto *medium : std::as_const(audioMedia))
885 if (medium->isUsable()) {
886 LOG(VB_MEDIA, LOG_DEBUG, QString(
"Found usable audio/mixed device %1").arg(medium->getDevicePath()));
915 LOG(VB_GENERAL, LOG_ERR,
916 "mythdvd main.o: handleMedia() does not know what to do");
928 QVector<MythScreenType*> screens;
932 for (
const auto *screen : std::as_const(screens))
934 if (qobject_cast<const GalleryThumbView*>(screen))
937 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - already running");
944 LOG(VB_GUI, LOG_INFO,
"Main: Autostarting Gallery for new media");
949 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - autorun not set");
955 QString sel = selection.toLower();
957 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
965 if (sel ==
"tv_watch_live")
967 else if (sel.startsWith(
"tv_watch_recording"))
970 if ((selection.length() > 19) && (selection.mid(18, 1) ==
" "))
975 else if (sel ==
"tv_schedule")
979 else if (sel ==
"tv_manualschedule")
983 else if (sel ==
"tv_custom_record")
987 else if (sel ==
"tv_fix_conflicts")
991 else if (sel ==
"tv_manage_recording_rules")
995 else if (sel ==
"tv_progfind")
999 else if (sel ==
"tv_search_title")
1003 else if (sel ==
"tv_search_keyword")
1007 else if (sel ==
"tv_search_people")
1011 else if (sel ==
"tv_search_power")
1015 else if (sel ==
"tv_search_stored")
1019 else if (sel ==
"tv_search_channel")
1023 else if (sel ==
"tv_search_category")
1027 else if (sel ==
"tv_search_movie")
1031 else if (sel ==
"tv_search_new")
1035 else if (sel ==
"tv_search_time")
1039 else if (sel ==
"tv_previous")
1043 else if (sel ==
"tv_previous_old")
1047 else if (sel ==
"settings appearance")
1062 else if (sel ==
"settings themechooser")
1072 else if (sel ==
"settings setupwizard")
1082 else if (sel ==
"settings grabbers")
1092 else if (sel ==
"screensetupwizard")
1096 else if (sel ==
"setup_keys")
1100 else if (sel ==
"settings playgroup")
1115 else if (sel ==
"settings general")
1130 else if (sel ==
"settings audiogeneral")
1146 else if (sel ==
"settings maingeneral")
1161 else if (sel ==
"settings playback")
1176 else if (sel ==
"settings osd")
1191 else if (sel ==
"settings epg")
1206 else if (sel ==
"settings channelgroups")
1221 else if (sel ==
"settings generalrecpriorities")
1225 "generalrecprioritiessettings",
1237 else if (sel ==
"settings channelrecpriorities")
1241 else if (sel ==
"settings custompriority")
1245 else if (sel ==
"system_events")
1256 else if (sel ==
"video_settings_general")
1259 GetBoolSetting(
"VideoAggressivePC",
false));
1261 else if (sel ==
"video_settings_player")
1272 else if (sel ==
"video_settings_metadata")
1283 else if (sel ==
"video_settings_associations")
1292 else if (sel ==
"manager")
1296 else if (sel ==
"browser")
1300 else if (sel ==
"listing")
1304 else if (sel ==
"gallery")
1308 else if (sel ==
"disc_play")
1312 else if (sel ==
"tv_status")
1316 else if (sel ==
"exiting_app_prompt")
1320 else if (sel ==
"exiting_app")
1324 else if (sel ==
"standby_mode")
1328 else if (sel ==
"exiting_menu")
1334 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
1337 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
1353 prompter->HandleExit();
1369 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Found mainmenu.xml for theme '%1'")
1376 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find mainmenu.xml for theme '%1'")
1416 const QString &title,
const QString &subtitle,
1417 const QString &director,
int season,
int episode,
1418 const QString &inetref, std::chrono::minutes lenMins,
1419 const QString &year,
1420 const QString &
id,
const bool useBookmark)
1424 QFile checkFile(mrl);
1425 if ((!checkFile.exists() && !mrl.startsWith(
"dvd:")
1426 && !mrl.startsWith(
"bd:")
1427 && !mrl.startsWith(
"myth:")
1428 && !mrl.startsWith(
"http://")
1429 && !mrl.startsWith(
"https://")))
1431 QString errorText = QCoreApplication::translate(
"(MythFrontendMain)",
1432 "Failed to open \n '%1' in %2 \n"
1433 "Check if the video exists")
1434 .arg(mrl.section(
'/', -1),
1435 mrl.section(
'/', 0, -2));
1442 mrl, plot, title, QString(), subtitle, QString(),
1443 director, season, episode, inetref, lenMins,
1444 (year.toUInt()) ? year.toUInt() : 1900,
id);
1446 pginfo->SetProgramInfoType(pginfo->DiscoverProgramInfoType());
1448 bool bookmarkPresent =
false;
1449 bool lastPlayPresent =
false;
1451 if (pginfo->IsVideoDVD())
1453 auto *dvd =
new MythDVDInfo(pginfo->GetPlaybackURL());
1458 if (dvd->GetNameAndSerialNum(name, serialid))
1460 QStringList fields = pginfo->QueryDVDBookmark(serialid);
1461 bookmarkPresent = (fields.count() > 0);
1469 dvd->GetLastError());
1476 else if (pginfo->IsVideoBD())
1485 QStringList fields = pginfo->QueryBDBookmark(serialid);
1486 bookmarkPresent = (fields.count() > 0);
1499 else if (useBookmark && pginfo->IsVideo())
1501 pginfo->SetIgnoreLastPlayPos(
false);
1502 pginfo->SetIgnoreBookmark(
false);
1503 bookmarkPresent = pginfo->QueryBookmark() > 0;
1504 lastPlayPresent = pginfo->QueryLastPlayPos() > 0;
1507 if (useBookmark && (bookmarkPresent || lastPlayPresent))
1510 auto *bookmarkdialog =
new BookmarkDialog(pginfo, mainStack,
1513 if (!bookmarkdialog->Create())
1515 delete bookmarkdialog;
1535 auto *lmenu = qobject_cast<MythThemedMenuState *>
1538 lmenu->m_buttonList->SetItemCurrent(0);
1550 LOG(VB_GENERAL, LOG_WARNING, QString(
"Overriding broken theme '%1' with '%2'")
1551 .arg(badtheme, themename));
1570#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1571 auto activity = QtAndroid::androidActivity();
1573 QJniObject activity = QNativeInterface::QAndroidApplication::context();
1575 auto packageManager = activity.callObjectMethod
1576 (
"getPackageManager",
1577 "()Landroid/content/pm/PackageManager;" );
1579 auto activityIntent = packageManager.callObjectMethod
1580 (
"getLaunchIntentForPackage",
1581 "(Ljava/lang/String;)Landroid/content/Intent;",
1582 activity.callObjectMethod(
"getPackageName",
1583 "()Ljava/lang/String;").object() );
1585 auto pendingIntent = QAndroidJniObject::callStaticObjectMethod
1586 (
"android/app/PendingIntent",
1588 "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;",
1591 activityIntent.object(),
1592 QAndroidJniObject::getStaticField<jint>(
"android/content/Intent",
1593 "FLAG_ACTIVITY_CLEAR_TOP") );
1595 auto alarmManager = activity.callObjectMethod
1596 (
"getSystemService",
1597 "(Ljava/lang/String;)Ljava/lang/Object;",
1598 QAndroidJniObject::getStaticObjectField(
"android/content/Context",
1600 "Ljava/lang/String;").
object() );
1602 alarmManager.callMethod<
void>
1604 "(IJLandroid/app/PendingIntent;)V",
1605 QAndroidJniObject::getStaticField<jint>(
"android/app/AlarmManager",
"RTC"),
1606 jlong(QDateTime::currentMSecsSinceEpoch() + 100),
1607 pendingIntent.object() );
1623 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'").arg(themename));
1675 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Reload Theme"),
1677 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Main Menu"),
1679 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Guide"),
1681 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Finder"),
1685 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recordings / "
1686 "Fix Conflicts"),
"",
"",
startManaged,
"VIEWSCHEDULED");
1687 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recording Rules"),
1689 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Channel Recording "
1691 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"TV Recording Playback"),
1693 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Live TV"),
1695 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Status Screen"),
1697 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Previously Recorded"),
1700 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Standby Mode"),
1715 REG_JUMP(
"Play Disc", QT_TRANSLATE_NOOP(
"MythControls",
1716 "Play an Optical Disc"),
"",
playDisc);
1723 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Borders"),
1725 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Names"),
1727 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Reset All Keys"),
1728 QT_TRANSLATE_NOOP(
"MythControls",
"Reset all keys to defaults"),
1741 REG_KEY(
"Video",
"PLAYALT", QT_TRANSLATE_NOOP(
"MythControls",
1742 "Play selected item in alternate player"),
"ALT+P");
1743 REG_KEY(
"Video",
"FILTER", QT_TRANSLATE_NOOP(
"MythControls",
1744 "Open video filter dialog"),
"F");
1745 REG_KEY(
"Video",
"INCPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1746 "Increase Parental Level"),
"],},F11");
1747 REG_KEY(
"Video",
"DECPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1748 "Decrease Parental Level"),
"[,{,F10");
1749 REG_KEY(
"Video",
"INCSEARCH", QT_TRANSLATE_NOOP(
"MythControls",
1750 "Show Incremental Search Dialog"),
"Ctrl+S,Search");
1751 REG_KEY(
"Video",
"DOWNLOADDATA", QT_TRANSLATE_NOOP(
"MythControls",
1752 "Download metadata for current item"),
"W");
1753 REG_KEY(
"Video",
"ITEMDETAIL", QT_TRANSLATE_NOOP(
"MythControls",
1754 "Display Item Detail Popup"),
"");
1757 REG_KEY(
"Images",
"PLAY", QT_TRANSLATE_NOOP(
"MythControls",
1758 "Start/Stop Slideshow"),
"P,Media Play");
1759 REG_KEY(
"Images",
"RECURSIVESHOW", QT_TRANSLATE_NOOP(
"MythControls",
1760 "Start Recursive Slideshow"),
"R");
1761 REG_KEY(
"Images",
"ROTRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1762 "Rotate image right 90 degrees"),
"],3");
1763 REG_KEY(
"Images",
"ROTLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1764 "Rotate image left 90 degrees"),
"[,1");
1765 REG_KEY(
"Images",
"FLIPHORIZONTAL", QT_TRANSLATE_NOOP(
"MythControls",
1766 "Flip image horizontally"),
"");
1767 REG_KEY(
"Images",
"FLIPVERTICAL", QT_TRANSLATE_NOOP(
"MythControls",
1768 "Flip image vertically"),
"");
1769 REG_KEY(
"Images",
"ZOOMOUT", QT_TRANSLATE_NOOP(
"MythControls",
1770 "Zoom image out"),
"7,<,Ctrl+B,Media Rewind");
1771 REG_KEY(
"Images",
"ZOOMIN", QT_TRANSLATE_NOOP(
"MythControls",
1772 "Zoom image in"),
"9,>,Ctrl+F,Media Fast Forward");
1773 REG_KEY(
"Images",
"FULLSIZE", QT_TRANSLATE_NOOP(
"MythControls",
1774 "Full-size (un-zoom) image"),
"0");
1775 REG_KEY(
"Images",
"MARK", QT_TRANSLATE_NOOP(
"MythControls",
1776 "Mark image"),
"T");
1777 REG_KEY(
"Images",
"SCROLLUP", QT_TRANSLATE_NOOP(
"MythControls",
1778 "Scroll image up"),
"2");
1779 REG_KEY(
"Images",
"SCROLLLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1780 "Scroll image left"),
"4");
1781 REG_KEY(
"Images",
"SCROLLRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1782 "Scroll image right"),
"6");
1783 REG_KEY(
"Images",
"SCROLLDOWN", QT_TRANSLATE_NOOP(
"MythControls",
1784 "Scroll image down"),
"8");
1785 REG_KEY(
"Images",
"RECENTER", QT_TRANSLATE_NOOP(
"MythControls",
1786 "Recenter image"),
"5");
1787 REG_KEY(
"Images",
"COVER", QT_TRANSLATE_NOOP(
"MythControls",
1788 "Set or clear cover image"),
"C");
1818 query.
prepare(
"DELETE FROM keybindings "
1819 "WHERE hostname = :HOSTNAME;");
1823 query.
prepare(
"DELETE FROM jumppoints "
1824 "WHERE hostname = :HOSTNAME;");
1868 query.
prepare(
"DELETE FROM inuseprograms "
1869 "WHERE hostname = :HOSTNAME and recusage = 'player' ;");
1877 bool autoStart =
false;
1883 QDateTime startupTime = QDateTime();
1892 if (startupTime.isValid())
1895 startupSecs = std::max(startupSecs, 15 * 60s);
1902 LOG(VB_GENERAL, LOG_INFO,
1903 "Close to auto-start time, AUTO-Startup assumed");
1909 LOG(VB_GENERAL, LOG_INFO,
1910 "Close to MythFillDB suggested run time, AUTO-Startup to fetch guide data?");
1916 LOG(VB_GENERAL, LOG_DEBUG,
1917 "NOT close to auto-start time, USER-initiated startup assumed");
1927 if (!wakeupCmd.isEmpty())
1930 bool bConflicts =
false;
1931 QDateTime nextRecordingStart;
1938 for (
auto *prog : progList)
1942 (prog->GetHostname() ==
hostname) &&
1943 (nextRecordingStart.isNull() ||
1944 nextRecordingStart > prog->GetRecordingStartTime()))
1946 nextRecordingStart = prog->GetRecordingStartTime();
1950 if (!nextRecordingStart.isNull() &&
1953 LOG(VB_GENERAL, LOG_INFO,
1954 "Close to start time, AUTO-Startup assumed");
1962 LOG(VB_GENERAL, LOG_DEBUG,
1963 "NOT close to auto-start time, USER-initiated startup assumed");
1989Q_DECL_EXPORT
int main(
int argc,
char **argv)
1991 bool bPromptForBackend =
false;
1992 bool bBypassAutoDiscovery =
false;
2013#if CONFIG_QTWEBENGINE
2014#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2015 QtWebEngineQuick::initialize();
2017 QtWebEngine::initialize();
2022 QApplication::setSetuidAllowed(
true);
2023 QApplication a(argc, argv);
2027 QString path = QCoreApplication::applicationDirPath();
2029 QString(
"%1/../Resources/lib/%2:/../Resources/lib/%2/site-packages:/../Resources/lib/%2/lib-dynload:%3")
2031 .arg(QFileInfo(PYTHON_EXE).fileName())
2032 .arg(QProcessEnvironment::systemEnvironment().value(
"PYTHONPATH"))
2033 .toUtf8().constData(), 1);
2037 auto config = QSslConfiguration::defaultConfiguration();
2038 config.setCaCertificates(QSslConfiguration::systemCaCertificates());
2039 QSslConfiguration::setDefaultConfiguration(config);
2046 bool ResetSettings =
false;
2049 bPromptForBackend =
true;
2051 bBypassAutoDiscovery =
true;
2053 if (signal(
SIGPIPE, SIG_IGN) == SIG_ERR)
2054 std::cerr <<
"Unable to ignore SIGPIPE\n";
2064 if (!context.Init(
true, bPromptForBackend, bBypassAutoDiscovery))
2066 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
2084 ResetSettings =
true;
2099 QDir dir(fileprefix);
2101 dir.mkdir(fileprefix);
2114 LOG(VB_GENERAL, LOG_NOTICE,
"Appearance settings and language have "
2115 "been reset to defaults. You will need to "
2116 "restart the frontend.");
2117 context.saveSettingsCache();
2121#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2123 if (maxImageSize >=0)
2124 QImageReader::setAllocationLimit(maxImageSize);
2126 LOG(VB_GENERAL, LOG_DEBUG,
2127 QString(
"Built against zlib %1, linked against %2.")
2128 .arg(ZLIB_VERSION, zlibVersion()));
2129 QList<QByteArray>
formats = QImageReader::supportedImageFormats();
2130 QString format_str =
formats.takeFirst();
2131 for (
const auto& format : std::as_const(
formats))
2132 format_str +=
", " + format;
2133 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Supported image formats: %1").arg(format_str));
2135 QCoreApplication::setSetuidAllowed(
true);
2139 LOG(VB_GENERAL, LOG_ERR,
"Failed to revokeRoot(), exiting.");
2149 fe_sd_notify(
"STATUS=Registering frontend with bonjour");
2154 QByteArray name(
"Mythfrontend on ");
2156 bonjour->Register(port,
"_mythfrontend._tcp",
2175 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2184 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2198 mainWindow->Init(
false);
2199 mainWindow->setWindowTitle(QCoreApplication::translate(
"(MythFrontendMain)",
2201 "Main window title"));
2226 LOG(VB_GENERAL, LOG_ERR,
2227 "Couldn't upgrade database to new schema, exiting.");
2235 mainWindow->ReloadKeys();
2258 mainWindow->installEventFilter(mon);
2267 if (!networkControl->
listen(port))
2269 LOG(VB_GENERAL, LOG_ERR,
2270 QString(
"NetworkControl failed to bind to port %1.")
2286 std::unique_ptr<ThemeUpdateChecker> themeUpdateChecker;
2288 themeUpdateChecker = std::make_unique<ThemeUpdateChecker>();
2300 #ifdef CONFIG_BINDINGS_PYTHON
2304 housekeeping->Start();
2317 LOG(VB_GENERAL, LOG_ERR,
2318 QString(
"Invalid plugin name supplied on command line: '%1'")
2320 LOG(VB_GENERAL, LOG_ERR,
2321 QString(
"Available plugins: %1")
2322 .arg(plugins.join(
", ")));
2334 LOG(VB_GENERAL, LOG_ERR,
2335 QString(
"Invalid jump point supplied on the command line: %1")
2337 LOG(VB_GENERAL, LOG_ERR,
2338 QString(
"Available jump points: %2")
2367 ret = QCoreApplication::exec();
2372 context.saveSettingsCache();
2377 delete housekeeping;
2384 delete networkControl;
2390 LOG(VB_GENERAL, LOG_INFO,
"Reloading theme");
2399 LOG(VB_GENERAL, LOG_INFO,
"Restarting LIRC handler");
2407#include "mythfrontend.moc"
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="")
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)
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
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)
const std::array< const std::string, 8 > formats