本文整理汇总了C++中MythMainWindow::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ MythMainWindow::Init方法的具体用法?C++ MythMainWindow::Init怎么用?C++ MythMainWindow::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythMainWindow
的用法示例。
在下文中一共展示了MythMainWindow::Init方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TempMainWindow
/**
* \brief Setup a minimal themed main window, and prompt for user's language.
*
* Used for warnings before the database is opened, or bootstrapping pages.
* After using the window, call EndTempWindow().
*
* \bug Some of these settings (<i>e.g.</I> window size, theme)
* seem to be used after the temp window is destroyed.
*
*/
void MythContextPrivate::TempMainWindow(bool languagePrompt)
{
if (HasMythMainWindow())
return;
SilenceDBerrors();
gCoreContext->SetSetting("Theme", DEFAULT_UI_THEME);
#ifdef Q_WS_MACX
// Qt 4.4 has window-focus problems
gCoreContext->SetSetting("RunFrontendInWindow", "1");
#endif
GetMythUI()->LoadQtConfig();
MythMainWindow *mainWindow = MythMainWindow::getMainWindow(false);
mainWindow->Init();
if (languagePrompt)
{
// ask user for language settings
LanguageSelection::prompt();
MythTranslation::load("mythfrontend");
}
}
示例2: main
int main(int argc, char **argv)
{
MythScreenWizardCommandLineParser cmdline;
if (!cmdline.Parse(argc, argv))
{
cmdline.PrintHelp();
return GENERIC_EXIT_INVALID_CMDLINE;
}
if (cmdline.toBool("showhelp"))
{
cmdline.PrintHelp();
return GENERIC_EXIT_OK;
}
if (cmdline.toBool("showversion"))
{
cmdline.PrintVersion();
return GENERIC_EXIT_OK;
}
#ifdef Q_OS_MAC
// Without this, we can't set focus to any of the CheckBoxSetting, and most
// of the MythPushButton widgets, and they don't use the themed background.
QApplication::setDesktopSettingsAware(false);
#endif
new QApplication(argc, argv);
QCoreApplication::setApplicationName(MYTH_APPNAME_MYTHSCREENWIZARD);
int retval;
QString mask("general");
if ((retval = cmdline.ConfigureLogging(mask, false)) != GENERIC_EXIT_OK)
return retval;
CleanupGuard callCleanup(cleanup);
#ifndef _WIN32
QList<int> signallist;
signallist << SIGINT << SIGTERM << SIGSEGV << SIGABRT << SIGBUS << SIGFPE
<< SIGILL;
#if ! CONFIG_DARWIN
signallist << SIGRTMIN;
#endif
SignalHandler::Init(signallist);
signal(SIGHUP, SIG_IGN);
#endif
if ((retval = cmdline.ConfigureLogging()) != GENERIC_EXIT_OK)
return retval;
if (!cmdline.toString("display").isEmpty())
{
MythUIHelper::SetX11Display(cmdline.toString("display"));
}
gContext = new MythContext(MYTH_BINARY_VERSION);
if (!gContext->Init(true, false, true))
{
LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to init MythContext, exiting.");
return GENERIC_EXIT_NO_MYTHCONTEXT;
}
if (gCoreContext->GetNumSetting("RunFrontendInWindow"))
{
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Refusing to run screen setup wizard in windowed mode.");
return GENERIC_EXIT_NOT_OK;
}
int GuiOffsetX = gCoreContext->GetNumSetting("GuiOffsetX", 0);
int GuiOffsetY = gCoreContext->GetNumSetting("GuiOffsetY", 0);
int GuiWidth = gCoreContext->GetNumSetting("GuiWidth", 0);
int GuiHeight = gCoreContext->GetNumSetting("GuiHeight", 0);
gCoreContext->OverrideSettingForSession("GuiOffsetX", "0");
gCoreContext->OverrideSettingForSession("GuiOffsetY", "0");
gCoreContext->OverrideSettingForSession("GuiWidth", "0");
gCoreContext->OverrideSettingForSession("GuiHeight", "0");
cmdline.ApplySettingsOverride();
GetMythUI()->LoadQtConfig();
QString themename = gCoreContext->GetSetting("Theme", DEFAULT_UI_THEME);
QString themedir = GetMythUI()->FindThemeDir(themename);
if (themedir.isEmpty())
{
LOG(VB_GENERAL, LOG_ERR, QString("Couldn't find theme '%1'")
.arg(themename));
return GENERIC_EXIT_NO_THEME;
}
MythMainWindow *mainWindow = GetMythMainWindow();
#if CONFIG_DARWIN
mainWindow->Init(OPENGL2_PAINTER);
#else
mainWindow->Init();
#endif
//.........这里部分代码省略.........
示例3: main
int main(int argc, char **argv)
{
bool bShowSettings = false;
MythWelcomeCommandLineParser cmdline;
if (!cmdline.Parse(argc, argv))
{
cmdline.PrintHelp();
return GENERIC_EXIT_INVALID_CMDLINE;
}
if (cmdline.toBool("showhelp"))
{
cmdline.PrintHelp();
return GENERIC_EXIT_OK;
}
if (cmdline.toBool("showversion"))
{
cmdline.PrintVersion();
return GENERIC_EXIT_OK;
}
QApplication a(argc, argv);
QCoreApplication::setApplicationName(MYTH_APPNAME_MYTHWELCOME);
int retval;
if ((retval = cmdline.ConfigureLogging()) != GENERIC_EXIT_OK)
return retval;
if (cmdline.toBool("setup"))
bShowSettings = true;
#ifndef _WIN32
QList<int> signallist;
signallist << SIGINT << SIGTERM << SIGSEGV << SIGABRT << SIGBUS << SIGFPE
<< SIGILL;
SignalHandler handler(signallist);
signal(SIGHUP, SIG_IGN);
#endif
gContext = new MythContext(MYTH_BINARY_VERSION);
if (!gContext->Init())
{
LOG(VB_GENERAL, LOG_ERR,
"mythwelcome: Could not initialize MythContext. Exiting.");
return GENERIC_EXIT_NO_MYTHCONTEXT;
}
if (!MSqlQuery::testDBConnection())
{
LOG(VB_GENERAL, LOG_ERR,
"mythwelcome: Could not open the database. Exiting.");
return -1;
}
LCD::SetupLCD();
if (LCD *lcd = LCD::Get())
lcd->switchToTime();
MythTranslation::load("mythfrontend");
GetMythUI()->LoadQtConfig();
MythMainWindow *mainWindow = GetMythMainWindow();
mainWindow->Init();
initKeys();
if (bShowSettings)
{
MythShutdownSettings settings;
settings.exec();
}
else
{
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
WelcomeDialog *welcome = new WelcomeDialog(mainStack, "mythwelcome");
if (welcome->Create())
mainStack->AddScreen(welcome, false);
else
return -1;
do
{
qApp->processEvents();
usleep(5000);
} while (mainStack->TotalScreens() > 0);
}
DestroyMythMainWindow();
delete gContext;
return 0;
}
示例4: main
int main(int argc, char *argv[])
{
MythAVTestCommandLineParser cmdline;
if (!cmdline.Parse(argc, argv))
{
cmdline.PrintHelp();
return GENERIC_EXIT_INVALID_CMDLINE;
}
if (cmdline.toBool("showhelp"))
{
cmdline.PrintHelp();
return GENERIC_EXIT_OK;
}
if (cmdline.toBool("showversion"))
{
cmdline.PrintVersion();
return GENERIC_EXIT_OK;
}
QApplication a(argc, argv);
QCoreApplication::setApplicationName(MYTH_APPNAME_MYTHAVTEST);
int retval;
if ((retval = cmdline.ConfigureLogging()) != GENERIC_EXIT_OK)
return retval;
if (!cmdline.toString("display").isEmpty())
{
MythUIHelper::SetX11Display(cmdline.toString("display"));
}
if (!cmdline.toString("geometry").isEmpty())
{
MythUIHelper::ParseGeometryOverride(cmdline.toString("geometry"));
}
QString filename = "";
if (!cmdline.toString("infile").isEmpty())
filename = cmdline.toString("infile");
else if (cmdline.GetArgs().size() >= 1)
filename = cmdline.GetArgs()[0];
gContext = new MythContext(MYTH_BINARY_VERSION);
if (!gContext->Init())
{
LOG(VB_GENERAL, LOG_ERR, "Failed to init MythContext, exiting.");
return GENERIC_EXIT_NO_MYTHCONTEXT;
}
cmdline.ApplySettingsOverride();
setuid(getuid());
QString themename = gCoreContext->GetSetting("Theme");
QString themedir = GetMythUI()->FindThemeDir(themename);
if (themedir.isEmpty())
{
QString msg = QString("Fatal Error: Couldn't find theme '%1'.")
.arg(themename);
LOG(VB_GENERAL, LOG_ERR, msg);
return GENERIC_EXIT_NO_THEME;
}
GetMythUI()->LoadQtConfig();
#if defined(Q_OS_MACX)
// Mac OS X doesn't define the AudioOutputDevice setting
#else
QString auddevice = gCoreContext->GetSetting("AudioOutputDevice");
if (auddevice.isEmpty())
{
LOG(VB_GENERAL, LOG_ERR, "Fatal Error: Audio not configured, you need "
"to run 'mythfrontend', not 'mythtv'.");
return GENERIC_EXIT_SETUP_ERROR;
}
#endif
MythMainWindow *mainWindow = GetMythMainWindow();
mainWindow->Init();
if (cmdline.toBool("test"))
{
int seconds = 5;
if (!cmdline.toString("seconds").isEmpty())
seconds = cmdline.toInt("seconds");
VideoPerformanceTest *test = new VideoPerformanceTest(filename, false,
cmdline.toBool("decodeonly"), seconds,
cmdline.toBool("deinterlace"));
test->Test();
delete test;
}
else
{
TV::InitKeys();
if (!UpgradeTVDatabaseSchema(false))
{
LOG(VB_GENERAL, LOG_ERR, "Fatal Error: Incorrect database schema.");
//.........这里部分代码省略.........
示例5: main
int main(int argc, char *argv[])
{
bool cmdline_err;
MythCommandLineParser cmdline(
kCLPOverrideSettings |
kCLPWindowed |
kCLPNoWindowed |
#ifdef USING_X11
kCLPDisplay |
#endif // USING_X11
kCLPGeometry |
kCLPVerbose |
kCLPExtra |
kCLPHelp);
print_verbose_messages |= VB_PLAYBACK | VB_LIBAV;
for (int argpos = 1; argpos < argc; ++argpos)
{
if (cmdline.PreParse(argc, argv, argpos, cmdline_err))
{
if (cmdline_err)
return GENERIC_EXIT_INVALID_CMDLINE;
if (cmdline.WantsToExit())
return GENERIC_EXIT_OK;
}
}
QApplication a(argc, argv);
QFileInfo finfo(a.argv()[0]);
QString binname = finfo.baseName();
int argpos = 1;
QString filename = "";
while (argpos < a.argc())
{
if (cmdline.Parse(a.argc(), a.argv(), argpos, cmdline_err))
{
if (cmdline_err)
return GENERIC_EXIT_INVALID_CMDLINE;
if (cmdline.WantsToExit())
return GENERIC_EXIT_OK;
}
else if (a.argv()[argpos][0] != '-')
{
filename = a.argv()[argpos];
}
else
{
return GENERIC_EXIT_INVALID_CMDLINE;
}
++argpos;
}
if (!cmdline.GetDisplay().isEmpty())
{
MythUIHelper::SetX11Display(cmdline.GetDisplay());
}
if (!cmdline.GetGeometry().isEmpty())
{
MythUIHelper::ParseGeometryOverride(cmdline.GetGeometry());
}
gContext = new MythContext(MYTH_BINARY_VERSION);
if (!gContext->Init())
{
VERBOSE(VB_IMPORTANT, "Failed to init MythContext, exiting.");
return GENERIC_EXIT_NO_MYTHCONTEXT;
}
gCoreContext->SetAppName(binname);
QMap<QString, QString> settingsOverride = cmdline.GetSettingsOverride();
if (settingsOverride.size())
{
QMap<QString, QString>::iterator it;
for (it = settingsOverride.begin(); it != settingsOverride.end(); ++it)
{
VERBOSE(VB_IMPORTANT, QString("Setting '%1' being forced to '%2'")
.arg(it.key()).arg(*it));
gCoreContext->OverrideSettingForSession(it.key(), *it);
}
}
// Create priveledged thread, then drop privs
pthread_t priv_thread;
bool priv_thread_created = true;
int status = pthread_create(&priv_thread, NULL, run_priv_thread, NULL);
if (status)
{
VERBOSE(VB_IMPORTANT, QString("Warning: ") +
"Failed to create priveledged thread." + ENO);
priv_thread_created = false;
}
setuid(getuid());
//.........这里部分代码省略.........
示例6: main
int main(int argc, char **argv)
{
bool bShowSettings = false;
bool cmdline_err;
MythCommandLineParser cmdline(
kCLPOverrideSettingsFile |
kCLPOverrideSettings |
kCLPQueryVersion);
for (int argpos = 0; argpos < argc; ++argpos)
{
if (cmdline.PreParse(argc, argv, argpos, cmdline_err))
{
if (cmdline_err)
return GENERIC_EXIT_INVALID_CMDLINE;
if (cmdline.WantsToExit())
return GENERIC_EXIT_OK;
}
}
QApplication a(argc, argv);
QFileInfo finfo(a.argv()[0]);
QString binname = finfo.baseName();
// Check command line arguments
for (int argpos = 1; argpos < a.argc(); ++argpos)
{
if (!strcmp(a.argv()[argpos],"-v") ||
!strcmp(a.argv()[argpos],"--verbose"))
{
if (a.argc()-1 > argpos)
{
if (parse_verbose_arg(a.argv()[argpos+1]) ==
GENERIC_EXIT_INVALID_CMDLINE)
return GENERIC_EXIT_INVALID_CMDLINE;
++argpos;
}
else
{
cerr << "Missing argument to -v/--verbose option\n";
return GENERIC_EXIT_INVALID_CMDLINE;
}
}
else if (!strcmp(a.argv()[argpos],"-s") ||
!strcmp(a.argv()[argpos],"--setup"))
{
bShowSettings = true;
}
else if (!strcmp(a.argv()[argpos], "-l") ||
!strcmp(a.argv()[argpos], "--logfile"))
{
if (a.argc()-1 > argpos)
{
logfile = a.argv()[argpos+1];
if (logfile.startsWith("-"))
{
cerr << "Invalid or missing argument to -l/--logfile option\n";
return GENERIC_EXIT_INVALID_CMDLINE;
}
else
{
++argpos;
}
}
else
{
cerr << "Missing argument to -l/--logfile option\n";
return GENERIC_EXIT_INVALID_CMDLINE;
}
}
else if (cmdline.Parse(a.argc(), a.argv(), argpos, cmdline_err))
{
if (cmdline_err)
return GENERIC_EXIT_INVALID_CMDLINE;
if (cmdline.WantsToExit())
return GENERIC_EXIT_OK;
}
else
{
showUsage(cmdline);
return GENERIC_EXIT_INVALID_CMDLINE;
}
}
gContext = new MythContext(MYTH_BINARY_VERSION);
if (!gContext->Init())
{
VERBOSE(VB_IMPORTANT, "mythwelcome: Could not initialize MythContext. "
"Exiting.");
return GENERIC_EXIT_NO_MYTHCONTEXT;
}
gCoreContext->SetAppName(binname);
//.........这里部分代码省略.........
示例7: main
//.........这里部分代码省略.........
if (!cmdline.GetGeometry().isEmpty())
{
MythUIHelper::ParseGeometryOverride(cmdline.GetGeometry());
}
CleanupGuard callCleanup(cleanup);
gContext = new MythContext(MYTH_BINARY_VERSION);
if (cmdline.IsUPnPEnabled())
{
g_pUPnp = new MediaRenderer();
if (!g_pUPnp->initialized())
{
delete g_pUPnp;
g_pUPnp = NULL;
}
}
// Override settings as early as possible to cover bootstrapped screens
// such as the language prompt
settingsOverride = cmdline.GetSettingsOverride();
if (settingsOverride.size())
{
QMap<QString, QString>::iterator it;
for (it = settingsOverride.begin(); it != settingsOverride.end(); ++it)
{
VERBOSE(VB_IMPORTANT, QString("Setting '%1' being forced to '%2'")
.arg(it.key()).arg(*it));
gCoreContext->OverrideSettingForSession(it.key(), *it);
}
}
if (!gContext->Init(true, bPromptForBackend, bBypassAutoDiscovery))
{
VERBOSE(VB_IMPORTANT, "Failed to init MythContext, exiting.");
return GENERIC_EXIT_NO_MYTHCONTEXT;
}
if (!GetMythDB()->HaveSchema())
{
if (!InitializeMythSchema())
return GENERIC_EXIT_DB_ERROR;
}
for(int argpos = 1; argpos < a.argc(); ++argpos)
{
if (!strcmp(a.argv()[argpos],"-l") ||
!strcmp(a.argv()[argpos],"--logfile"))
{
// Arg processing for logfile already done (before MythContext)
++argpos;
} else if (!strcmp(a.argv()[argpos],"-v") ||
!strcmp(a.argv()[argpos],"--verbose"))
{
// Arg processing for verbose already done (before MythContext)
++argpos;
}
else if (!strcmp(a.argv()[argpos],"-r") ||
!strcmp(a.argv()[argpos],"--reset"))
{
ResetSettings = true;
}
else if (!strcmp(a.argv()[argpos],"--prompt") ||
!strcmp(a.argv()[argpos],"-p" ))
{
示例8: main
//.........这里部分代码省略.........
.arg(MYTH_SOURCE_PATH)
.arg(MYTH_SOURCE_VERSION));
signal(SIGHUP, &log_rotate_handler);
}
}
if (!display.isEmpty())
{
MythUIHelper::SetX11Display(display);
}
if (!geometry.isEmpty())
{
MythUIHelper::ParseGeometryOverride(geometry);
}
gContext = new MythContext(MYTH_BINARY_VERSION);
std::auto_ptr<MythContext> contextScopeDelete(gContext);
// Override settings as early as possible to cover bootstrapped screens
// such as the language prompt
if (settingsOverride.size())
{
QMap<QString, QString>::iterator it;
for (it = settingsOverride.begin(); it != settingsOverride.end(); ++it)
{
VERBOSE(VB_IMPORTANT, QString("Setting '%1' being forced to '%2'")
.arg(it.key()).arg(*it));
gCoreContext->OverrideSettingForSession(it.key(), *it);
}
}
if (!gContext->Init(use_display)) // No Upnp, Prompt for db
{
VERBOSE(VB_IMPORTANT, "Failed to init MythContext, exiting.");
return GENERIC_EXIT_NO_MYTHCONTEXT;
}
if (!GetMythDB()->HaveSchema())
{
if (!InitializeMythSchema())
return GENERIC_EXIT_DB_ERROR;
}
if (use_display)
{
gCoreContext->SetSetting("Theme", DEFAULT_UI_THEME);
GetMythUI()->LoadQtConfig();
QString fileprefix = GetConfDir();
QDir dir(fileprefix);
if (!dir.exists())
dir.mkdir(fileprefix);
}
if (doScan)
{
bool okCardID = scanCardId;
QStringList inputnames = CardUtil::GetInputNames(scanCardId);
okCardID &= !inputnames.empty();
if (scanInputName.isEmpty())
scanInputName = CardUtil::GetDefaultInput(scanCardId);