1#include "libmythbase/mythconfig.h"
14#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
15#include <QtSystemDetection>
18#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
19#include <QtAndroidExtras>
21#include <QCoreApplication>
23#define QAndroidJniObject QJniObject
26#include <QApplication>
34#include <QProcessEnvironment>
38#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
39#include <QtWebEngineQuick>
65#include "libmythbase/mythversion.h"
136#include <QScopedPointer>
139#if CONFIG_SYSTEMD_NOTIFY
140#include <systemd/sd-daemon.h>
141static inline void fe_sd_notify(
const char *str) { sd_notify(0, str); };
164static bool gLoaded =
false;
167static const QString
sLocation = QCoreApplication::translate(
"(Common)",
188 this, &RunSettingsCompletion::OnPasswordResultReady);
223 LOG(VB_GENERAL, LOG_WARNING,
224 "Aggressive Parental Controls Warning: "
225 "invalid password. An attempt to enter a "
226 "MythVideo settings screen was prevented.");
245 bool bookmarkPresent,
bool lastPlayPresent) :
248 m_bookmarked(bookmarkPresent),
249 m_lastPlayed(lastPlayPresent),
250 m_btnPlayBookmark(tr(
"Play from bookmark")),
251 m_btnClearBookmark(tr(
"Clear bookmark")),
252 m_btnPlayBegin(tr(
"Play from beginning")),
253 m_btnPlayLast(tr(
"Play from last played position")),
254 m_btnClearLast(tr(
"Clear last played position")) {
259 QString msg = tr(
"DVD/Video contains a bookmark");
261 m_videoDlg =
dynamic_cast<VideoDialog*
>(GetScreenStack()->GetTopScreen());
262 auto *popup =
new MythDialogBox(msg, GetScreenStack(),
"bookmarkdialog");
263 if (!popup->Create())
269 GetScreenStack()->AddScreen(popup);
271 popup->SetReturnEvent(
this,
"bookmarkdialog");
273 popup->AddButton(m_btnPlayLast);
275 popup->AddButton(m_btnPlayBookmark);
276 popup->AddButton(m_btnPlayBegin);
278 popup->AddButton(m_btnClearLast);
280 popup->AddButton(m_btnClearBookmark);
290 QString buttonText = dce->GetResultText();
292 if (dce->GetId() !=
"bookmarkdialog")
295 if (buttonText == m_btnPlayLast)
297 else if (buttonText == m_btnPlayBookmark)
299 else if (buttonText == m_btnPlayBegin)
301 else if (buttonText == m_btnClearBookmark)
303 m_pgi->SaveBookmark(0);
306 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
309 else if (buttonText == m_btnClearLast)
311 m_pgi->SaveLastPlayPos(0);
314 m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
322 bool m_bookmarked {
false};
323 bool m_lastPlayed {
false};
334 QCoreApplication::processEvents();
345 LOG(VB_GENERAL, LOG_INFO,
"Shutting down UPnP client...");
378 ShowOkPopup(QCoreApplication::translate(
"(MythFrontendMain)",
379 "The ScreenSetupWizard cannot be used while "
380 "mythfrontend is operating in windowed mode."));
417 auto *mythcontrols =
new MythControls(mainStack,
"mythcontrols");
419 if (mythcontrols->Create())
544 if (viewsched->Create())
556 if (progRecPrior->Create())
568 if (chanRecPrior->Create())
580 if (custom->Create())
590 auto *pbb =
new PlaybackBox(mainStack,
"playbackbox");
594 if (!recGroup.isEmpty())
595 pbb->setInitialRecGroup(recGroup);
635 if (custom->Create())
647 if (mansched->Create())
658 QString msg = QCoreApplication::translate(
"(Common)",
"All tuners are currently busy.");
661 msg = QCoreApplication::translate(
"(Common)",
"There are no configured tuners.");
676 while (keylist.size() < 2)
699 auto *statusbox =
new StatusBox(mainStack);
701 if (statusbox->Create())
714 if (idlescreen->Create())
722 QString message = QCoreApplication::translate(
"(MythFrontendMain)",
723 "Loading videos ...");
729 "mythvideobusydialog");
731 if (busyPopup->Create())
743 video_list = saved->GetSaved();
744 LOG(VB_GENERAL, LOG_INFO,
745 QString(
"Reusing saved video list because MythVideo was resumed"
760 if (mythvideo->Create())
781 if (galleryView->Create())
784 galleryView->Start();
795 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for BluRay medium");
796 const QString bluray_mountpoint =
798 QDir bdtest(bluray_mountpoint +
"/BDMV");
804 QString
filename = QString(
"bd:/%1").arg(bluray_mountpoint);
807 0, 0,
"", 0min,
"",
"",
true);
816 LOG(VB_MEDIA, LOG_ERR,
"Could not access media monitor");
821 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for DVD medium");
822 const bool isDVD = mediaMonitor->
IsActive()
829 if (dvd_device.isEmpty())
835 QString command_string =
837 if ((command_string.indexOf(
"internal", 0, Qt::CaseInsensitive) > -1) ||
838 (command_string.length() < 1))
843#elif defined(Q_OS_WINDOWS)
850 command_string =
"Internal";
852 "",
"", 0, 0,
"", 0min,
"",
"",
true);
858 if (command_string.contains(
"%d"))
863 command_string = command_string.replace(
"%d", dvd_device);
880 LOG(VB_MEDIA, LOG_DEBUG,
"Checking for audio CD medium");
884 if (!audioMedia.isEmpty())
886 for (
auto *medium : std::as_const(audioMedia))
888 if (medium->isUsable()) {
889 LOG(VB_MEDIA, LOG_DEBUG, QString(
"Found usable audio/mixed device %1").arg(medium->getDevicePath()));
918 LOG(VB_GENERAL, LOG_ERR,
919 "mythdvd main.o: handleMedia() does not know what to do");
931 QVector<MythScreenType*> screens;
935 for (
const auto *screen : std::as_const(screens))
937 if (qobject_cast<const GalleryThumbView*>(screen))
940 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - already running");
947 LOG(VB_GUI, LOG_INFO,
"Main: Autostarting Gallery for new media");
952 LOG(VB_MEDIA, LOG_INFO,
"Main: Ignoring new gallery media - autorun not set");
958 QString sel = selection.toLower();
960 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
968 if (sel ==
"tv_watch_live")
970 else if (sel.startsWith(
"tv_watch_recording"))
973 if ((selection.length() > 19) && (selection.mid(18, 1) ==
" "))
978 else if (sel ==
"tv_schedule")
982 else if (sel ==
"tv_manualschedule")
986 else if (sel ==
"tv_custom_record")
990 else if (sel ==
"tv_fix_conflicts")
994 else if (sel ==
"tv_manage_recording_rules")
998 else if (sel ==
"tv_progfind")
1002 else if (sel ==
"tv_search_title")
1006 else if (sel ==
"tv_search_keyword")
1010 else if (sel ==
"tv_search_people")
1014 else if (sel ==
"tv_search_power")
1018 else if (sel ==
"tv_search_stored")
1022 else if (sel ==
"tv_search_channel")
1026 else if (sel ==
"tv_search_category")
1030 else if (sel ==
"tv_search_movie")
1034 else if (sel ==
"tv_search_new")
1038 else if (sel ==
"tv_search_time")
1042 else if (sel ==
"tv_previous")
1046 else if (sel ==
"tv_previous_old")
1050 else if (sel ==
"settings appearance")
1065 else if (sel ==
"settings themechooser")
1075 else if (sel ==
"settings setupwizard")
1085 else if (sel ==
"settings grabbers")
1095 else if (sel ==
"screensetupwizard")
1099 else if (sel ==
"setup_keys")
1103 else if (sel ==
"settings playgroup")
1118 else if (sel ==
"settings general")
1133 else if (sel ==
"settings audiogeneral")
1149 else if (sel ==
"settings maingeneral")
1164 else if (sel ==
"settings playback")
1179 else if (sel ==
"settings osd")
1194 else if (sel ==
"settings epg")
1209 else if (sel ==
"settings channelgroups")
1224 else if (sel ==
"settings generalrecpriorities")
1228 "generalrecprioritiessettings",
1240 else if (sel ==
"settings channelrecpriorities")
1244 else if (sel ==
"settings custompriority")
1248 else if (sel ==
"system_events")
1259 else if (sel ==
"video_settings_general")
1262 GetBoolSetting(
"VideoAggressivePC",
false));
1264 else if (sel ==
"video_settings_player")
1275 else if (sel ==
"video_settings_metadata")
1286 else if (sel ==
"video_settings_associations")
1295 else if (sel ==
"manager")
1299 else if (sel ==
"browser")
1303 else if (sel ==
"listing")
1307 else if (sel ==
"gallery")
1311 else if (sel ==
"disc_play")
1315 else if (sel ==
"tv_status")
1319 else if (sel ==
"exiting_app_prompt")
1323 else if (sel ==
"exiting_app")
1327 else if (sel ==
"standby_mode")
1331 else if (sel ==
"exiting_menu")
1337 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
1340 if (sel.startsWith(
"settings ") || sel ==
"video_settings_general")
1356 prompter->HandleExit();
1372 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Found mainmenu.xml for theme '%1'")
1379 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find mainmenu.xml for theme '%1'")
1419 const QString &title,
const QString &subtitle,
1420 const QString &director,
int season,
int episode,
1421 const QString &inetref, std::chrono::minutes lenMins,
1422 const QString &year,
1423 const QString &
id,
const bool useBookmark)
1427 QFile checkFile(mrl);
1428 if ((!checkFile.exists() && !mrl.startsWith(
"dvd:")
1429 && !mrl.startsWith(
"bd:")
1430 && !mrl.startsWith(
"myth:")
1431 && !mrl.startsWith(
"http://")
1432 && !mrl.startsWith(
"https://")))
1434 QString errorText = QCoreApplication::translate(
"(MythFrontendMain)",
1435 "Failed to open \n '%1' in %2 \n"
1436 "Check if the video exists")
1437 .arg(mrl.section(
'/', -1),
1438 mrl.section(
'/', 0, -2));
1445 mrl, plot, title, QString(), subtitle, QString(),
1446 director, season, episode, inetref, lenMins,
1447 (year.toUInt()) ? year.toUInt() : 1900,
id);
1449 pginfo->SetProgramInfoType(pginfo->DiscoverProgramInfoType());
1451 bool bookmarkPresent =
false;
1452 bool lastPlayPresent =
false;
1454 if (pginfo->IsVideoDVD())
1456 auto *dvd =
new MythDVDInfo(pginfo->GetPlaybackURL());
1461 if (dvd->GetNameAndSerialNum(name, serialid))
1463 QStringList fields = pginfo->QueryDVDBookmark(serialid);
1464 bookmarkPresent = (fields.count() > 0);
1472 dvd->GetLastError());
1479 else if (pginfo->IsVideoBD())
1488 QStringList fields = pginfo->QueryBDBookmark(serialid);
1489 bookmarkPresent = (fields.count() > 0);
1502 else if (useBookmark && pginfo->IsVideo())
1504 pginfo->SetIgnoreLastPlayPos(
false);
1505 pginfo->SetIgnoreBookmark(
false);
1506 bookmarkPresent = pginfo->QueryBookmark() > 0;
1507 lastPlayPresent = pginfo->QueryLastPlayPos() > 0;
1510 if (useBookmark && (bookmarkPresent || lastPlayPresent))
1513 auto *bookmarkdialog =
new BookmarkDialog(pginfo, mainStack,
1516 if (!bookmarkdialog->Create())
1518 delete bookmarkdialog;
1538 auto *lmenu = qobject_cast<MythThemedMenuState *>
1541 lmenu->m_buttonList->SetItemCurrent(0);
1553 LOG(VB_GENERAL, LOG_WARNING, QString(
"Overriding broken theme '%1' with '%2'")
1554 .arg(badtheme, themename));
1573#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1574 auto activity = QtAndroid::androidActivity();
1576 QJniObject activity = QNativeInterface::QAndroidApplication::context();
1578 auto packageManager = activity.callObjectMethod
1579 (
"getPackageManager",
1580 "()Landroid/content/pm/PackageManager;" );
1582 auto activityIntent = packageManager.callObjectMethod
1583 (
"getLaunchIntentForPackage",
1584 "(Ljava/lang/String;)Landroid/content/Intent;",
1585 activity.callObjectMethod(
"getPackageName",
1586 "()Ljava/lang/String;").object() );
1588 auto pendingIntent = QAndroidJniObject::callStaticObjectMethod
1589 (
"android/app/PendingIntent",
1591 "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;",
1594 activityIntent.object(),
1595 QAndroidJniObject::getStaticField<jint>(
"android/content/Intent",
1596 "FLAG_ACTIVITY_CLEAR_TOP") );
1598 auto alarmManager = activity.callObjectMethod
1599 (
"getSystemService",
1600 "(Ljava/lang/String;)Ljava/lang/Object;",
1601 QAndroidJniObject::getStaticObjectField(
"android/content/Context",
1603 "Ljava/lang/String;").
object() );
1605 alarmManager.callMethod<
void>
1607 "(IJLandroid/app/PendingIntent;)V",
1608 QAndroidJniObject::getStaticField<jint>(
"android/app/AlarmManager",
"RTC"),
1609 jlong(QDateTime::currentMSecsSinceEpoch() + 100),
1610 pendingIntent.object() );
1626 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'").arg(themename));
1678 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Reload Theme"),
1680 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Main Menu"),
1682 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Guide"),
1684 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Program Finder"),
1688 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recordings / "
1689 "Fix Conflicts"),
"",
"",
startManaged,
"VIEWSCHEDULED");
1690 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Manage Recording Rules"),
1692 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Channel Recording "
1694 REG_JUMPLOC(QT_TRANSLATE_NOOP(
"MythControls",
"TV Recording Playback"),
1696 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Live TV"),
1698 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Status Screen"),
1700 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Previously Recorded"),
1703 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Standby Mode"),
1718 REG_JUMP(
"Play Disc", QT_TRANSLATE_NOOP(
"MythControls",
1719 "Play an Optical Disc"),
"",
playDisc);
1726 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Borders"),
1728 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Toggle Show Widget Names"),
1730 REG_JUMPEX(QT_TRANSLATE_NOOP(
"MythControls",
"Reset All Keys"),
1731 QT_TRANSLATE_NOOP(
"MythControls",
"Reset all keys to defaults"),
1744 REG_KEY(
"Video",
"PLAYALT", QT_TRANSLATE_NOOP(
"MythControls",
1745 "Play selected item in alternate player"),
"ALT+P");
1746 REG_KEY(
"Video",
"FILTER", QT_TRANSLATE_NOOP(
"MythControls",
1747 "Open video filter dialog"),
"F");
1748 REG_KEY(
"Video",
"INCPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1749 "Increase Parental Level"),
"],},F11");
1750 REG_KEY(
"Video",
"DECPARENT", QT_TRANSLATE_NOOP(
"MythControls",
1751 "Decrease Parental Level"),
"[,{,F10");
1752 REG_KEY(
"Video",
"INCSEARCH", QT_TRANSLATE_NOOP(
"MythControls",
1753 "Show Incremental Search Dialog"),
"Ctrl+S,Search");
1754 REG_KEY(
"Video",
"DOWNLOADDATA", QT_TRANSLATE_NOOP(
"MythControls",
1755 "Download metadata for current item"),
"W");
1756 REG_KEY(
"Video",
"ITEMDETAIL", QT_TRANSLATE_NOOP(
"MythControls",
1757 "Display Item Detail Popup"),
"");
1760 REG_KEY(
"Images",
"PLAY", QT_TRANSLATE_NOOP(
"MythControls",
1761 "Start/Stop Slideshow"),
"P,Media Play");
1762 REG_KEY(
"Images",
"RECURSIVESHOW", QT_TRANSLATE_NOOP(
"MythControls",
1763 "Start Recursive Slideshow"),
"R");
1764 REG_KEY(
"Images",
"ROTRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1765 "Rotate image right 90 degrees"),
"],3");
1766 REG_KEY(
"Images",
"ROTLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1767 "Rotate image left 90 degrees"),
"[,1");
1768 REG_KEY(
"Images",
"FLIPHORIZONTAL", QT_TRANSLATE_NOOP(
"MythControls",
1769 "Flip image horizontally"),
"");
1770 REG_KEY(
"Images",
"FLIPVERTICAL", QT_TRANSLATE_NOOP(
"MythControls",
1771 "Flip image vertically"),
"");
1772 REG_KEY(
"Images",
"ZOOMOUT", QT_TRANSLATE_NOOP(
"MythControls",
1773 "Zoom image out"),
"7,<,Ctrl+B,Media Rewind");
1774 REG_KEY(
"Images",
"ZOOMIN", QT_TRANSLATE_NOOP(
"MythControls",
1775 "Zoom image in"),
"9,>,Ctrl+F,Media Fast Forward");
1776 REG_KEY(
"Images",
"FULLSIZE", QT_TRANSLATE_NOOP(
"MythControls",
1777 "Full-size (un-zoom) image"),
"0");
1778 REG_KEY(
"Images",
"MARK", QT_TRANSLATE_NOOP(
"MythControls",
1779 "Mark image"),
"T");
1780 REG_KEY(
"Images",
"SCROLLUP", QT_TRANSLATE_NOOP(
"MythControls",
1781 "Scroll image up"),
"2");
1782 REG_KEY(
"Images",
"SCROLLLEFT", QT_TRANSLATE_NOOP(
"MythControls",
1783 "Scroll image left"),
"4");
1784 REG_KEY(
"Images",
"SCROLLRIGHT", QT_TRANSLATE_NOOP(
"MythControls",
1785 "Scroll image right"),
"6");
1786 REG_KEY(
"Images",
"SCROLLDOWN", QT_TRANSLATE_NOOP(
"MythControls",
1787 "Scroll image down"),
"8");
1788 REG_KEY(
"Images",
"RECENTER", QT_TRANSLATE_NOOP(
"MythControls",
1789 "Recenter image"),
"5");
1790 REG_KEY(
"Images",
"COVER", QT_TRANSLATE_NOOP(
"MythControls",
1791 "Set or clear cover image"),
"C");
1821 query.
prepare(
"DELETE FROM keybindings "
1822 "WHERE hostname = :HOSTNAME;");
1826 query.
prepare(
"DELETE FROM jumppoints "
1827 "WHERE hostname = :HOSTNAME;");
1871 query.
prepare(
"DELETE FROM inuseprograms "
1872 "WHERE hostname = :HOSTNAME and recusage = 'player' ;");
1880 bool autoStart =
false;
1886 QDateTime startupTime = QDateTime();
1895 if (startupTime.isValid())
1898 startupSecs = std::max(startupSecs, 15 * 60s);
1905 LOG(VB_GENERAL, LOG_INFO,
1906 "Close to auto-start time, AUTO-Startup assumed");
1912 LOG(VB_GENERAL, LOG_INFO,
1913 "Close to MythFillDB suggested run time, AUTO-Startup to fetch guide data?");
1919 LOG(VB_GENERAL, LOG_DEBUG,
1920 "NOT close to auto-start time, USER-initiated startup assumed");
1930 if (!wakeupCmd.isEmpty())
1933 bool bConflicts =
false;
1934 QDateTime nextRecordingStart;
1941 for (
auto *prog : progList)
1945 (prog->GetHostname() ==
hostname) &&
1946 (nextRecordingStart.isNull() ||
1947 nextRecordingStart > prog->GetRecordingStartTime()))
1949 nextRecordingStart = prog->GetRecordingStartTime();
1953 if (!nextRecordingStart.isNull() &&
1956 LOG(VB_GENERAL, LOG_INFO,
1957 "Close to start time, AUTO-Startup assumed");
1965 LOG(VB_GENERAL, LOG_DEBUG,
1966 "NOT close to auto-start time, USER-initiated startup assumed");
1992Q_DECL_EXPORT
int main(
int argc,
char **argv)
1994 bool bPromptForBackend =
false;
1995 bool bBypassAutoDiscovery =
false;
2016#if CONFIG_QTWEBENGINE
2017#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2018 QtWebEngineQuick::initialize();
2020 QtWebEngine::initialize();
2025 QApplication::setSetuidAllowed(
true);
2026 QApplication a(argc, argv);
2030 QString path = QCoreApplication::applicationDirPath();
2032 QString(
"%1/../Resources/lib/%2:/../Resources/lib/%2/site-packages:/../Resources/lib/%2/lib-dynload:%3")
2034 .arg(QFileInfo(PYTHON_EXE).fileName())
2035 .arg(QProcessEnvironment::systemEnvironment().value(
"PYTHONPATH"))
2036 .toUtf8().constData(), 1);
2040 auto config = QSslConfiguration::defaultConfiguration();
2041 config.setCaCertificates(QSslConfiguration::systemCaCertificates());
2042 QSslConfiguration::setDefaultConfiguration(config);
2049 bool ResetSettings =
false;
2052 bPromptForBackend =
true;
2054 bBypassAutoDiscovery =
true;
2056 if (signal(
SIGPIPE, SIG_IGN) == SIG_ERR)
2057 std::cerr <<
"Unable to ignore SIGPIPE\n";
2067 if (!context.Init(
true, bPromptForBackend, bBypassAutoDiscovery))
2069 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
2087 ResetSettings =
true;
2102 QDir dir(fileprefix);
2104 dir.mkdir(fileprefix);
2117 LOG(VB_GENERAL, LOG_NOTICE,
"Appearance settings and language have "
2118 "been reset to defaults. You will need to "
2119 "restart the frontend.");
2120 context.saveSettingsCache();
2124#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2126 if (maxImageSize >=0)
2127 QImageReader::setAllocationLimit(maxImageSize);
2129 LOG(VB_GENERAL, LOG_DEBUG,
2130 QString(
"Built against zlib %1, linked against %2.")
2131 .arg(ZLIB_VERSION, zlibVersion()));
2132 QList<QByteArray>
formats = QImageReader::supportedImageFormats();
2133 QString format_str =
formats.takeFirst();
2134 for (
const auto& format : std::as_const(
formats))
2135 format_str +=
", " + format;
2136 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Supported image formats: %1").arg(format_str));
2138 QCoreApplication::setSetuidAllowed(
true);
2142 LOG(VB_GENERAL, LOG_ERR,
"Failed to revokeRoot(), exiting.");
2152 fe_sd_notify(
"STATUS=Registering frontend with bonjour");
2157 QByteArray name(
"Mythfrontend on ");
2159 bonjour->Register(port,
"_mythfrontend._tcp",
2178 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2187 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
2201 mainWindow->Init(
false);
2202 mainWindow->setWindowTitle(QCoreApplication::translate(
"(MythFrontendMain)",
2204 "Main window title"));
2229 LOG(VB_GENERAL, LOG_ERR,
2230 "Couldn't upgrade database to new schema, exiting.");
2238 mainWindow->ReloadKeys();
2261 mainWindow->installEventFilter(mon);
2270 if (!networkControl->
listen(port))
2272 LOG(VB_GENERAL, LOG_ERR,
2273 QString(
"NetworkControl failed to bind to port %1.")
2289 std::unique_ptr<ThemeUpdateChecker> themeUpdateChecker;
2291 themeUpdateChecker = std::make_unique<ThemeUpdateChecker>();
2303 #ifdef CONFIG_BINDINGS_PYTHON
2307 housekeeping->Start();
2320 LOG(VB_GENERAL, LOG_ERR,
2321 QString(
"Invalid plugin name supplied on command line: '%1'")
2323 LOG(VB_GENERAL, LOG_ERR,
2324 QString(
"Available plugins: %1")
2325 .arg(plugins.join(
", ")));
2337 LOG(VB_GENERAL, LOG_ERR,
2338 QString(
"Invalid jump point supplied on the command line: %1")
2340 LOG(VB_GENERAL, LOG_ERR,
2341 QString(
"Available jump points: %2")
2370 ret = QCoreApplication::exec();
2375 context.saveSettingsCache();
2380 delete housekeeping;
2387 delete networkControl;
2393 LOG(VB_GENERAL, LOG_INFO,
"Reloading theme");
2402 LOG(VB_GENERAL, LOG_INFO,
"Restarting LIRC handler");
2410#include "mythfrontend.moc"
static const std::array< const std::string, 8 > formats
std::vector< ChannelInfo > ChannelInfoList
static void Cleanup(void)
Screen for managing channel priorities in recording scheduling decisions.
static ChannelInfoList LoadChannels(uint startIndex, uint count, uint &totalAvailable, bool ignoreHidden=true, OrderBy orderBy=kChanOrderByChanNum, GroupBy groupBy=kChanGroupByChanid, uint sourceID=0, uint channelGroupID=0, bool liveTVOnly=false, const QString &callsign="", const QString &channum="", bool ignoreUntunable=true)
Load channels from database into a list of ChannelInfo objects.
A screen to create a fully custom recording.
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static const Type kEventType
static void RunProgramGuide(uint startChanId, const QString &startChanNum, const QDateTime &startTime, TV *player=nullptr, bool embedVideo=false, bool allowFinder=true, int changrpid=-1)
Manages registered HouseKeeperTasks and queues tasks for operation.
static QStringList SupportedImages()
Return recognised pictures.
static QStringList SupportedVideos()
Return recognised video extensions.
static void SetupLCD(void)
static bool prompt(bool force=false)
Ask the user for the language to use.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void Cleanup(void)
QString GetLastError(void) const
bool GetNameAndSerialNum(QString &Name, QString &SerialNum)
static ImageType inspectImage(const QString &path)
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
void ApplySettingsOverride(void)
Apply all overrides to the global context.
int ConfigureLogging(const QString &mask="general", bool progress=false)
Read in logging options and initialize the logging interface.
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
static void PrintVersion(void)
Print application version information.
void PrintHelp(void) const
Print command line option help.
Startup context for MythTV.
Screen for managing and configuring keyboard input bindings.
void emitTVPlaybackStarted(void)
void emitTVPlaybackStopped(void)
void ClearSettingsCache(const QString &myKey=QString(""))
void ActivateSettingsCache(bool activate=true)
QString GetHostName(void)
static bool BackendIsRunning(void)
a backend process is running on this host
void SaveSetting(const QString &key, int newValue)
void SetExiting(bool exiting=true)
QString GetSetting(const QString &key, const QString &defaultval="")
void OverrideSettingForSession(const QString &key, const QString &value)
QString GetSettingOnHost(const QString &key, const QString &host, const QString &defaultval="")
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)