Go to the documentation of this file.
8 #include <QApplication>
22 #include "libmythbase/mythconfig.h"
28 #include "libmythbase/mythversion.h"
73 QString sel = selection.toLower();
86 else if (sel ==
"capture cards")
97 else if (sel ==
"video sources")
107 else if (sel ==
"card inputs")
118 else if (sel ==
"recording profile")
129 else if (sel ==
"channel editor")
135 if (chanedit->Create())
140 else if (sel ==
"storage groups")
151 else if (sel ==
"systemeventeditor")
162 else if (sel.startsWith(
"exiting_app") || (sel ==
"standby_mode"))
169 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
176 QString(
tmp.constData()),
"setup.xml",
186 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't use theme '%1'").arg(themename));
202 LOG(VB_GENERAL, LOG_ERR,
203 QString(
"Overriding broken theme '%1' with '%2'")
204 .arg(badtheme, themename));
222 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
241 int main(
int argc,
char *argv[])
245 bool doScanList =
false;
246 bool doScanSaveOnly =
false;
247 bool scanInteractive =
true;
248 bool expertMode =
false;
250 bool scanFTAOnly =
false;
251 bool scanLCNOnly =
false;
252 bool scanCompleteOnly =
false;
253 bool scanFullChannelSearch =
false;
254 bool scanRemoveDuplicates =
false;
255 bool addFullTS =
false;
258 QString frequencyStandard =
"atsc";
259 QString modulation =
"vsb8";
260 QString region =
"us";
261 QString scanInputName =
"";
283 bool use_display =
true;
290 std::unique_ptr<QCoreApplication> app {
nullptr};
296 app = std::make_unique<QApplication>(argc, argv);
300 app = std::make_unique<QCoreApplication>(argc, argv);
311 QString mask(
"general");
321 doScanSaveOnly =
true;
323 scanInteractive =
false;
332 scanCompleteOnly =
true;
334 scanFullChannelSearch =
true;
336 scanRemoveDuplicates =
true;
372 if (!geometry.isEmpty())
380 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
397 QDir dir(fileprefix);
399 dir.mkdir(fileprefix);
404 bool okCardID = scanCardId != 0U;
406 if (scanInputName.isEmpty())
410 && scanInputName !=
"None");
412 doScan = (okCardID && okInputName);
416 std::cerr <<
"You must enter a valid cardid to scan." << std::endl;
420 std::cerr <<
"But no cards have been defined on this host"
424 std::cerr <<
"Valid cards: " << std::endl;
425 for (
uint id : cardids)
427 fprintf(
stderr,
"%5u: %s %s\n",
id,
436 std::cerr <<
"You must enter a valid input to scan this card."
438 std::cerr <<
"Valid input: "
448 uint inputid = scanCardId;
450 QMap<QString,QString> startChan;
455 if (frequencyStandard ==
"atsc")
457 else if (frequencyStandard ==
"dvbt")
459 else if (frequencyStandard ==
"mpeg")
461 else if (frequencyStandard ==
"iptv")
464 scanner.
ImportM3U(scanCardId, scanInputName, sourceid,
true);
466 else if (frequencyStandard ==
"extern")
471 scanner.
Scan(scantype,
481 scanFullChannelSearch,
482 scanRemoveDuplicates,
484 scanServiceRequirements,
487 startChan, frequencyStandard, modulation, region);
488 ret = QCoreApplication::exec();
497 std::cout<<
" scanid cardid sourceid processed date"<<std::endl;
498 for (
auto &
scan : scans)
500 printf(
"%5i %6i %8i %8s %20s\n",
502 scan.m_sourceid, (
scan.m_processed) ?
"yes" :
"no",
504 .toLatin1().constData());
506 std::cout<<std::endl;
513 std::cout<<
"*** SCAN IMPORT START ***"<<std::endl;
517 scanFTAOnly, scanLCNOnly,
519 scanFullChannelSearch,
520 scanRemoveDuplicates,
521 scanServiceRequirements);
524 std::cout<<
"*** SCAN IMPORT END ***"<<std::endl;
534 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
541 mainWindow->setWindowTitle(QObject::tr(
"MythTV Setup"));
554 LOG(VB_GENERAL, LOG_ERR,
555 "MySQL time zone support is missing. "
556 "Please install it and try again. "
557 "See 'mysql_tzinfo_to_sql' for assistance.");
563 LOG(VB_GENERAL, LOG_ERR,
"Couldn't upgrade database to new schema.");
585 if (expertEditor->
Create())
590 expertEditor =
nullptr;
591 LOG(VB_GENERAL, LOG_ERR,
592 "Unable to create expert settings editor window");
597 QCoreApplication::exec();
MythScreenStack * GetMainStack()
static std::vector< uint > GetInputIDs(const QString &videodevice=QString(), const QString &rawtype=QString(), const QString &inputname=QString(), QString hostname=QString())
Returns all inputids of inputs that uses the specified videodevice if specified, and optionally rawty...
void setHttpProxy(void)
Get network proxy settings from OS, and use for [Q]Http[Comms].
void Init(bool MayReInit=true)
static void ParseGeometryOverride(const QString &Geometry)
Parse an X11 style command line geometry string.
std::vector< ScanInfo > LoadScanList(void)
void PerformSearch(const QString &sST, std::chrono::seconds timeout=2s)
static void reload()
Reload all active translators based on the current language setting.
static QString GetInputName(uint inputid)
MythCommFlagCommandLineParser cmdline
Startup context for MythTV.
bool Create(void) override
Creates the UI screen.
void OverrideSettingForSession(const QString &key, const QString &value)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static int reloadTheme(void)
@ GENERIC_EXIT_OK
Exited with no error.
void Process(const ScanDTVTransportList &_transports, int sourceid=-1)
def scan(profile, smoonURL, gate)
void SetEffectsEnabled(bool Enable)
static void ConfigureQtGUI(int SwapInterval, const MythCommandLineParser &CmdLine)
Shared static initialisation code for all MythTV GUI applications.
static constexpr const char * MYTH_APPNAME_MYTHTV_SETUP
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
bool InitializeMythSchema(void)
command to get the the initial database layout from an empty database:
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
bool UpgradeTVDatabaseSchema(const bool upgradeAllowed, const bool upgradeIfNoUI, [[maybe_unused]] const bool informSystemd)
Called from outside dbcheck.cpp to update the schema.
static MythThemedMenu * menu
void Scan(int scantype, uint cardid, const QString &inputname, uint sourceid, bool do_ignore_signal_timeout, bool do_follow_nit, bool do_test_decryption, bool do_fta_only, bool do_lcn_only, bool do_complete_only, bool do_full_channel_search, bool do_remove_duplicates, bool do_add_full_ts, ServiceRequirements service_requirements, uint mplexid, const QMap< QString, QString > &startChan, const QString &freq_std, const QString &mod, const QString &tbl, const QString &tbl_start=QString(), const QString &tbl_end=QString())
StartPrompter * startPrompt
void DestroyMythMainWindow(void)
QString FindThemeDir(const QString &ThemeName, bool Fallback=true)
Returns the full path to the theme denoted by themename.
static void PrintVersion(void)
Print application version information.
uint toUInt(const QString &key) const
Returns stored QVariant as an unsigned integer, falling to default if not provided.
static bool CheckTimeZoneSupport(void)
Check if MySQL has working timz zone support.
static bool resetTheme(QString themedir, const QString &badtheme)
void PrintHelp(void) const
Print command line option help.
An editor for MythSystemEvent handler commands.
@ GENERIC_EXIT_NO_THEME
No Theme available.
@ GENERIC_EXIT_NOT_OK
Exited with error.
@ CurrentTransportScan
Scans the transport when there is no tuner (for ASI)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
std::vector< ScanDTVTransport > ScanDTVTransportList
void ApplySettingsOverride(void)
Apply all overrides to the global context.
ExitPrompter * exitPrompt
static void SetupMenuCallback(void *, QString &selection)
static QString GetRawInputType(uint inputid)
@ GENERIC_EXIT_DB_NOTIMEZONE
Missing DB time zone support.
static void Init(QObject *parent=nullptr)
static constexpr const char * DEFAULT_UI_THEME
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
static bool prompt(bool force=false)
Ask the user for the language to use.
@ GENERIC_EXIT_DB_OUTOFDATE
Database needs upgrade.
int main(int argc, char *argv[])
ScanDTVTransportList LoadScan(uint scanid)
static uint GetSourceID(uint inputid)
MythMainWindow * GetMythMainWindow(void)
static void UpdateChannelGroups(void)
static bool RunMenu(const QString &themedir, const QString &themename)
int ConfigureLogging(const QString &mask="general", bool progress=false)
Read in logging options and initialize the logging interface.
static constexpr const char * FALLBACK_UI_THEME
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
MythUIHelper * GetMythUI()
@ GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythContext * gContext
This global variable contains the MythContext instance for the application.
bool Init(bool gui=true, bool promptForBackend=false, bool disableAutoDiscovery=false, bool ignoreDB=false)
virtual bool ImportM3U(uint cardid, const QString &inputname, uint sourceid, bool is_mpts)
static QString GetVideoDevice(uint inputid)
QString GetSetting(const QString &key, const QString &defaultval="")
@ GENERIC_EXIT_DB_ERROR
Database error.