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"
134#include <QScopedPointer>
137#if CONFIG_SYSTEMD_NOTIFY
138#include <systemd/sd-daemon.h>
139static inline void fe_sd_notify(
const char *str) { sd_notify(0, str); };
162static bool gLoaded =
false;
165static const QString
sLocation = QCoreApplication::translate(
"(Common)",
186 this, &RunSettingsCompletion::OnPasswordResultReady);
221 LOG(VB_GENERAL, LOG_WARNING,
222 "Aggressive Parental Controls Warning: "
223 "invalid password. An attempt to enter a "
224 "MythVideo settings screen was prevented.");
243 bool bookmarkPresent,
bool lastPlayPresent) :
246 m_bookmarked(bookmarkPresent),
247 m_lastPlayed(lastPlayPresent),
248 m_btnPlayBookmark(tr(
"Play from bookmark")),
249 m_btnClearBookmark(tr(
"Clear bookmark")),
250 m_btnPlayBegin(tr(
"Play from beginning")),
251 m_btnPlayLast(tr(
"Play from last played position")),
252 m_btnClearLast(tr(
"Clear last played position")) {
257 QString msg = tr(
"DVD/Video contains a bookmark");
259 m_videoDlg =
dynamic_cast<VideoDialog*
>(GetScreenStack()->GetTopScreen());
260 auto *popup =
new MythDialogBox(msg, GetScreenStack(),
"bookmarkdialog");
261 if (!popup->Create())
267 GetScreenStack()->AddScreen(popup);
269 popup->SetReturnEvent(
this,
"bookmarkdialog");
271 popup->AddButton(m_btnPlayLast);
273 popup->AddButton(m_btnPlayBookmark);
274 popup->AddButton(m_btnPlayBegin);
276 popup->AddButton(m_btnClearLast);
278 popup->AddButton(m_btnClearBookmark);
288 QString buttonText = dce->GetResultText();
290 if (dce->GetId() !=
"bookmarkdialog")
293 if (buttonText == m_btnPlayLast)
295 else if (buttonText == m_btnPlayBookmark)
297 else if (buttonText == m_btnPlayBegin)
299 else if (buttonText == m_btnClearBookmark)
301 m_pgi->SaveBookmark(0);
304 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
307 else if (buttonText == m_btnClearLast)
309 m_pgi->SaveLastPlayPos(0);
312 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
320 bool m_bookmarked {
false};
321 bool m_lastPlayed {
false};
332 QCoreApplication::processEvents();
343 LOG(VB_GENERAL, LOG_INFO,
"Shutting down UPnP client...");
376 ShowOkPopup(QCoreApplication::translate(
"(MythFrontendMain)",
377 "The ScreenSetupWizard cannot be used while "
378 "mythfrontend is operating in windowed mode."));
415 auto *mythcontrols =
new MythControls(mainStack,
"mythcontrols");
417 if (mythcontrols->Create())
542 if (viewsched->Create())
554 if (progRecPrior->Create())
566 if (chanRecPrior->Create())
578 if (custom->Create())
588 auto *pbb =
new PlaybackBox(mainStack,
"playbackbox");
592 if (!recGroup.isEmpty())
593 pbb->setInitialRecGroup(recGroup);
633 if (custom->Create())
645 if (mansched->Create())
656 QString msg = QCoreApplication::translate(
"(Common)",
"All tuners are currently busy.");
659 msg = QCoreApplication::translate(
"(Common)",
"There are no configured tuners.");
674 while (keylist.size() < 2)
697 auto *statusbox =
new StatusBox(mainStack);
699 if (statusbox->Create())
712 if (idlescreen->Create())
720 QString message = QCoreApplication::translate(
"(MythFrontendMain)",
721 "Loading videos ...");
727 "mythvideobusydialog");
729 if (busyPopup->Create())
741 video_list = saved->GetSaved();
742 LOG(VB_GENERAL, LOG_INFO,
743 QString(
"Reusing saved video list because MythVideo was resumed"
758 if (mythvideo->Create())
779 if (galleryView->Create())
782 galleryView->Start();
793 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for BluRay medium");
794 const QString bluray_mountpoint =
796 QDir bdtest(bluray_mountpoint +
"/BDMV");
802 QString
filename = QString(
"bd:/%1").arg(bluray_mountpoint);
805 0, 0,
"", 0min,
"",
"",
true);
814 LOG(VB_MEDIA, LOG_ERR,
"Could not access media monitor");
819 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for DVD medium");
820 const bool isDVD = mediaMonitor->
IsActive()
827 if (dvd_device.isEmpty())
833 QString command_string =
835 if ((command_string.indexOf(
"internal", 0, Qt::CaseInsensitive) > -1) ||
836 (command_string.length() < 1))
848 command_string =
"Internal";
850 "",
"", 0, 0,
"", 0min,
"",
"",
true);
856 if (command_string.contains(
"%d"))
861 command_string = command_string.replace(
"%d", dvd_device);
878 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for audio CD medium");
882 if (!audioMedia.isEmpty())
884 for (
auto *medium : std::as_const(audioMedia))
886 if (medium->isUsable()) {
887 LOG(VB_MEDIA, LOG_DEBUG, QString(
"Found usable audio/mixed device %1").arg(medium->getDevicePath()));
916 LOG(VB_GENERAL, LOG_ERR,
917 "mythdvd main.o: handleMedia() does not know what to do");
929 QVector<MythScreenType*> screens;
933 for (
const auto *screen : std::as_const(screens))
935 if (qobject_cast<const GalleryThumbView*>(screen))
938 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - already running");
945 LOG(VB_GUI, LOG_INFO,
"Main: Autostarting Gallery for new media");
950 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - autorun not set");
956 QString sel = selection.toLower();
958 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
966 if (sel ==
"tv_watch_live")
968 else if (sel.startsWith(
"tv_watch_recording"))
971 if ((selection.length() > 19) && (selection.mid(18, 1) ==
" "))
976 else if (sel ==
"tv_schedule")
980 else if (sel ==
"tv_manualschedule")
984 else if (sel ==
"tv_custom_record")
988 else if (sel ==
"tv_fix_conflicts")
992 else if (sel ==
"tv_manage_recording_rules")
996 else if (sel ==
"tv_progfind")
1000 else if (sel ==
"tv_search_title")
1004 else if (sel ==
"tv_search_keyword")
1008 else if (sel ==
"tv_search_people")
1012 else if (sel ==
"tv_search_power")
1016 else if (sel ==
"tv_search_stored")
1020 else if (sel ==
"tv_search_channel")
1024 else if (sel ==
"tv_search_category")
1028 else if (sel ==
"tv_search_movie")
1032 else if (sel ==
"tv_search_new")
1036 else if (sel ==
"tv_search_time")
1040 else if (sel ==
"tv_previous")
1044 else if (sel ==
"tv_previous_old")
1048 else if (sel ==
"settings appearance")
1063 else if (sel ==
"settings themechooser")
1073 else if (sel ==
"settings setupwizard")
1083 else if (sel ==
"settings grabbers")
1093 else if (sel ==
"screensetupwizard")
1097 else if (sel ==
"setup_keys")
1101 else if (sel ==
"settings playgroup")
1116 else if (sel ==
"settings general")
1131 else if (sel ==
"settings audiogeneral")
1147 else if (sel ==
"settings maingeneral")
1162 else if (sel ==
"settings playback")
1177 else if (sel ==
"settings osd")
1192 else if (sel ==
"settings epg")
1207 else if (sel ==
"settings channelgroups")
1222 else if (sel ==
"settings generalrecpriorities")
1226 "generalrecprioritiessettings",
1238 else if (sel ==
"settings channelrecpriorities")
1242 else if (sel ==
"settings custompriority")
1246 else if (sel ==
"system_events")
1257 else if (sel ==
"video_settings_general")
1260 GetBoolSetting(
"VideoAggressivePC",
false));
1262 else if (sel ==
"video_settings_player")
1273 else if (sel ==
"video_settings_metadata")
1284 else if (sel ==
"video_settings_associations")
1293 else if (sel ==
"manager")
1297 else if (sel ==
"browser")
1301 else if (sel ==
"listing")
1305 else if (sel ==
"gallery")
1309 else if (sel ==
"disc_play")
1313 else if (sel ==
"tv_status")
1317 else if (sel ==
"exiting_app_prompt")
1321 else if (sel ==
"exiting_app")
1325 else if (sel ==
"standby_mode")
1329 else if (sel ==
"exiting_menu")
1335 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
1338 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
1354 prompter->HandleExit();
1370 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Found mainmenu.xml for theme '%1'")
1377 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find mainmenu.xml for theme '%1'")
1417 const QString &title,
const QString &subtitle,
1418 const QString &director,
int season,
int episode,
1419 const QString &inetref, std::chrono::minutes lenMins,
1420 const QString &year,
1421 const QString &
id,
const bool useBookmark)
1425 QFile checkFile(mrl);
1426 if ((!checkFile.exists() && !mrl.startsWith(
"dvd:")
1427 && !mrl.startsWith(
"bd:")
1428 && !mrl.startsWith(
"myth:")
1429 && !mrl.startsWith(
"http://")
1430 && !mrl.startsWith(
"https://")))
1432 QString errorText = QCoreApplication::translate(
"(MythFrontendMain)",
1433 "Failed to open \n '%1' in %2 \n"
1434 "Check if the video exists")
1435 .arg(mrl.section(
'/', -1),
1436 mrl.section(
'/', 0, -2));
1443 mrl, plot, title, QString(), subtitle, QString(),
1444 director, season, episode, inetref, lenMins,
1445 (year.toUInt()) ? year.toUInt() : 1900,
id);
1447 pginfo->SetProgramInfoType(pginfo->DiscoverProgramInfoType());
1449 bool bookmarkPresent =
false;
1450 bool lastPlayPresent =
false;
1452 if (pginfo->IsVideoDVD())
1454 auto *dvd =
new MythDVDInfo(pginfo->GetPlaybackURL());
1459 if (dvd->GetNameAndSerialNum(name, serialid))
1461 QStringList fields = pginfo->QueryDVDBookmark(serialid);
1462 bookmarkPresent = (fields.count() > 0);
1470 dvd->GetLastError());
1477 else if (pginfo->IsVideoBD())
1486 QStringList fields = pginfo->QueryBDBookmark(serialid);
1487 bookmarkPresent = (fields.count() > 0);
1500 else if (useBookmark && pginfo->IsVideo())
1502 pginfo->SetIgnoreLastPlayPos(
false);
1503 pginfo->SetIgnoreBookmark(
false);
1504 bookmarkPresent = pginfo->QueryBookmark() > 0;
1505 lastPlayPresent = pginfo->QueryLastPlayPos() > 0;
1508 if (useBookmark && (bookmarkPresent || lastPlayPresent))
1511 auto *bookmarkdialog =
new BookmarkDialog(pginfo, mainStack,
1514 if (!bookmarkdialog->Create())
1516 delete bookmarkdialog;
1536 auto *lmenu = qobject_cast<MythThemedMenuState *>
1539 lmenu->m_buttonList->SetItemCurrent(0);
1551 LOG(VB_GENERAL, LOG_WARNING, QString(
"Overriding broken theme '%1' with '%2'")
1552 .arg(badtheme, themename));
1571#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1572 auto activity = QtAndroid::androidActivity();
1574 QJniObject activity = QNativeInterface::QAndroidApplication::context();
1576 auto packageManager = activity.callObjectMethod
1577 (
"getPackageManager",
1578 "()Landroid/content/pm/PackageManager;" );
1580 auto activityIntent = packageManager.callObjectMethod
1581 (
"getLaunchIntentForPackage",
1582 "(Ljava/lang/String;)Landroid/content/Intent;",
1583 activity.callObjectMethod(
"getPackageName",
1584 "()Ljava/lang/String;").object() );
1586 auto pendingIntent = QAndroidJniObject::callStaticObjectMethod
1587 (
"android/app/PendingIntent",
1589 "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;",
1592 activityIntent.object(),
1593 QAndroidJniObject::getStaticField<jint>(
"android/content/Intent",
1594 "FLAG_ACTIVITY_CLEAR_TOP") );
1596 auto alarmManager = activity.callObjectMethod
1597 (
"getSystemService",
1598 "(Ljava/lang/String;)Ljava/lang/Object;",
1599 QAndroidJniObject::getStaticObjectField(
"android/content/Context",
1601 "Ljava/lang/String;").
object() );
1603 alarmManager.callMethod<
void>
1605 "(IJLandroid/app/PendingIntent;)V",
1606 QAndroidJniObject::getStaticField<jint>(
"android/app/AlarmManager",
"RTC"),
1607 jlong(QDateTime::currentMSecsSinceEpoch() + 100),
1608 pendingIntent.object() );
1624 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'").arg(themename));
1676 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Reload Theme"),
1678 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Main Menu"),
1680 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Guide"),
1682 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Finder"),
1686 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recordings / "
1687 "Fix Conflicts"),
"",
"",
startManaged,
"VIEWSCHEDULED");
1688 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recording Rules"),
1690 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Channel Recording "
1692 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"TV Recording Playback"),
1694 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Live TV"),
1696 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Status Screen"),
1698 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Previously Recorded"),
1701 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Standby Mode"),
1716 REG_JUMP(
"Play Disc", QT_TRANSLATE_NOOP(
"MythControls",
1717 "Play an Optical Disc"),
"",
playDisc);
1724 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Borders"),
1726 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Names"),
1728 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Reset All Keys"),
1729 QT_TRANSLATE_NOOP(
"MythControls",
"Reset all keys to defaults"),
1742 REG_KEY(
"Video",
"PLAYALT", QT_TRANSLATE_NOOP(
"MythControls",
1743 "Play selected item in alternate player"),
"ALT+P");
1744 REG_KEY(
"Video",
"FILTER", QT_TRANSLATE_NOOP(
"MythControls",
1745 "Open video filter dialog"),
"F");
1746 REG_KEY(
"Video",
"INCPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1747 "Increase Parental Level"),
"],},F11");
1748 REG_KEY(
"Video",
"DECPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1749 "Decrease Parental Level"),
"[,{,F10");
1750 REG_KEY(
"Video",
"INCSEARCH", QT_TRANSLATE_NOOP(
"MythControls",
1751 "Show Incremental Search Dialog"),
"Ctrl+S,Search");
1752 REG_KEY(
"Video",
"DOWNLOADDATA", QT_TRANSLATE_NOOP(
"MythControls",
1753 "Download metadata for current item"),
"W");
1754 REG_KEY(
"Video",
"ITEMDETAIL", QT_TRANSLATE_NOOP(
"MythControls",
1755 "Display Item Detail Popup"),
"");
1758 REG_KEY(
"Images",
"PLAY", QT_TRANSLATE_NOOP(
"MythControls",
1759 "Start/Stop Slideshow"),
"P,Media Play");
1760 REG_KEY(
"Images",
"RECURSIVESHOW", QT_TRANSLATE_NOOP(
"MythControls",
1761 "Start Recursive Slideshow"),
"R");
1762 REG_KEY(
"Images",
"ROTRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1763 "Rotate image right 90 degrees"),
"],3");
1764 REG_KEY(
"Images",
"ROTLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1765 "Rotate image left 90 degrees"),
"[,1");
1766 REG_KEY(
"Images",
"FLIPHORIZONTAL", QT_TRANSLATE_NOOP(
"MythControls",
1767 "Flip image horizontally"),
"");
1768 REG_KEY(
"Images",
"FLIPVERTICAL", QT_TRANSLATE_NOOP(
"MythControls",
1769 "Flip image vertically"),
"");
1770 REG_KEY(
"Images",
"ZOOMOUT", QT_TRANSLATE_NOOP(
"MythControls",
1771 "Zoom image out"),
"7,<,Ctrl+B,Media Rewind");
1772 REG_KEY(
"Images",
"ZOOMIN", QT_TRANSLATE_NOOP(
"MythControls",
1773 "Zoom image in"),
"9,>,Ctrl+F,Media Fast Forward");
1774 REG_KEY(
"Images",
"FULLSIZE", QT_TRANSLATE_NOOP(
"MythControls",
1775 "Full-size (un-zoom) image"),
"0");
1776 REG_KEY(
"Images",
"MARK", QT_TRANSLATE_NOOP(
"MythControls",
1777 "Mark image"),
"T");
1778 REG_KEY(
"Images",
"SCROLLUP", QT_TRANSLATE_NOOP(
"MythControls",
1779 "Scroll image up"),
"2");
1780 REG_KEY(
"Images",
"SCROLLLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1781 "Scroll image left"),
"4");
1782 REG_KEY(
"Images",
"SCROLLRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1783 "Scroll image right"),
"6");
1784 REG_KEY(
"Images",
"SCROLLDOWN", QT_TRANSLATE_NOOP(
"MythControls",
1785 "Scroll image down"),
"8");
1786 REG_KEY(
"Images",
"RECENTER", QT_TRANSLATE_NOOP(
"MythControls",
1787 "Recenter image"),
"5");
1788 REG_KEY(
"Images",
"COVER", QT_TRANSLATE_NOOP(
"MythControls",
1789 "Set or clear cover image"),
"C");
1819 query.
prepare(
"DELETE FROM keybindings "
1820 "WHERE hostname = :HOSTNAME;");
1824 query.
prepare(
"DELETE FROM jumppoints "
1825 "WHERE hostname = :HOSTNAME;");
1869 query.
prepare(
"DELETE FROM inuseprograms "
1870 "WHERE hostname = :HOSTNAME and recusage = 'player' ;");
1878 bool autoStart =
false;
1884 QDateTime startupTime = QDateTime();
1893 if (startupTime.isValid())
1896 startupSecs = std::max(startupSecs, 15 * 60s);
1903 LOG(VB_GENERAL, LOG_INFO,
1904 "Close to auto-start time, AUTO-Startup assumed");
1910 LOG(VB_GENERAL, LOG_INFO,
1911 "Close to MythFillDB suggested run time, AUTO-Startup to fetch guide data?");
1917 LOG(VB_GENERAL, LOG_DEBUG,
1918 "NOT close to auto-start time, USER-initiated startup assumed");
1928 if (!wakeupCmd.isEmpty())
1931 bool bConflicts =
false;
1932 QDateTime nextRecordingStart;
1939 for (
auto *prog : progList)
1943 (prog->GetHostname() ==
hostname) &&
1944 (nextRecordingStart.isNull() ||
1945 nextRecordingStart > prog->GetRecordingStartTime()))
1947 nextRecordingStart = prog->GetRecordingStartTime();
1951 if (!nextRecordingStart.isNull() &&
1954 LOG(VB_GENERAL, LOG_INFO,
1955 "Close to start time, AUTO-Startup assumed");
1963 LOG(VB_GENERAL, LOG_DEBUG,
1964 "NOT close to auto-start time, USER-initiated startup assumed");
1990Q_DECL_EXPORT
int main(
int argc,
char **argv)
1992 bool bPromptForBackend =
false;
1993 bool bBypassAutoDiscovery =
false;
2014#if CONFIG_QTWEBENGINE
2015#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2016 QtWebEngineQuick::initialize();
2018 QtWebEngine::initialize();
2023 QApplication::setSetuidAllowed(
true);
2024 QApplication a(argc, argv);
2028 QString path = QCoreApplication::applicationDirPath();
2030 QString(
"%1/../Resources/lib/%2:/../Resources/lib/%2/site-packages:/../Resources/lib/%2/lib-dynload:%3")
2032 .arg(QFileInfo(PYTHON_EXE).fileName())
2033 .arg(QProcessEnvironment::systemEnvironment().value(
"PYTHONPATH"))
2034 .toUtf8().constData(), 1);
2037#if defined(Q_OS_ANDROID)
2038 auto config = QSslConfiguration::defaultConfiguration();
2039 config.setCaCertificates(QSslConfiguration::systemCaCertificates());
2040 QSslConfiguration::setDefaultConfiguration(config);
2047 bool ResetSettings =
false;
2050 bPromptForBackend =
true;
2052 bBypassAutoDiscovery =
true;
2054 if (signal(
SIGPIPE, SIG_IGN) == SIG_ERR)
2055 std::cerr <<
"Unable to ignore SIGPIPE\n";
2065 if (!context.Init(
true, bPromptForBackend, bBypassAutoDiscovery))
2067 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
2085 ResetSettings =
true;
2100 QDir dir(fileprefix);
2102 dir.mkdir(fileprefix);
2115 LOG(VB_GENERAL, LOG_NOTICE,
"Appearance settings and language have "
2116 "been reset to defaults. You will need to "
2117 "restart the frontend.");
2118 context.saveSettingsCache();
2122#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2124 if (maxImageSize >=0)
2125 QImageReader::setAllocationLimit(maxImageSize);
2127 LOG(VB_GENERAL, LOG_DEBUG,
2128 QString(
"Built against zlib %1, linked against %2.")
2129 .arg(ZLIB_VERSION, zlibVersion()));
2130 QList<QByteArray>
formats = QImageReader::supportedImageFormats();
2131 QString format_str =
formats.takeFirst();
2132 for (
const auto& format : std::as_const(
formats))
2133 format_str +=
", " + format;
2134 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Supported image formats: %1").arg(format_str));
2136 QCoreApplication::setSetuidAllowed(
true);
2140 LOG(VB_GENERAL, LOG_ERR,
"Failed to revokeRoot(), exiting.");
2150 fe_sd_notify(
"STATUS=Registering frontend with bonjour");
2155 QByteArray name(
"Mythfrontend on ");
2157 bonjour->Register(port,
"_mythfrontend._tcp",
2176 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2185 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2199 mainWindow->Init(
false);
2200 mainWindow->setWindowTitle(QCoreApplication::translate(
"(MythFrontendMain)",
2202 "Main window title"));
2227 LOG(VB_GENERAL, LOG_ERR,
2228 "Couldn't upgrade database to new schema, exiting.");
2236 mainWindow->ReloadKeys();
2259 mainWindow->installEventFilter(mon);
2268 if (!networkControl->
listen(port))
2270 LOG(VB_GENERAL, LOG_ERR,
2271 QString(
"NetworkControl failed to bind to port %1.")
2287 std::unique_ptr<ThemeUpdateChecker> themeUpdateChecker;
2289 themeUpdateChecker = std::make_unique<ThemeUpdateChecker>();
2301 #ifdef CONFIG_BINDINGS_PYTHON
2305 housekeeping->Start();
2318 LOG(VB_GENERAL, LOG_ERR,
2319 QString(
"Invalid plugin name supplied on command line: '%1'")
2321 LOG(VB_GENERAL, LOG_ERR,
2322 QString(
"Available plugins: %1")
2323 .arg(plugins.join(
", ")));
2335 LOG(VB_GENERAL, LOG_ERR,
2336 QString(
"Invalid jump point supplied on the command line: %1")
2338 LOG(VB_GENERAL, LOG_ERR,
2339 QString(
"Available jump points: %2")
2368 ret = QCoreApplication::exec();
2373 context.saveSettingsCache();
2378 delete housekeeping;
2385 delete networkControl;
2391 LOG(VB_GENERAL, LOG_INFO,
"Reloading theme");
2400 LOG(VB_GENERAL, LOG_INFO,
"Restarting LIRC handler");
2408#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
MythCommFlagCommandLineParser cmdline
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.
void RunProgramFinder(TV *player, bool embedVideo, bool allowEPG)
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
int RemoteGetRecordingMask(void)
@ kStartTVIgnoreLastPlayPos
int RemoteGetFreeRecorderCount(void)
const std::array< const std::string, 8 > formats