Permalink
Browse files

Remove Painter settings on Mac OS X

MythFrontend requires OpenGL for proper operation, and mythtv-setup requires Qt.
This is a quick and dirty way to remove the guesswork for the user and automatically have what works.

MythMainWindow::Init now can take an optional argument specifying which theme painter to use and do not rely on user configuration

Fixes #10469
  • Loading branch information...
1 parent 2e9333d commit 0a5d426a0c4ab4ac8791c9e87f8f44bf2e0b8514 @jyavenard jyavenard committed Jul 21, 2012
@@ -933,7 +933,7 @@ bool MythMainWindow::event(QEvent *e)
return QWidget::event(e);
}
-void MythMainWindow::Init(void)
+void MythMainWindow::Init(QString forcedpainter)
{
GetMythUI()->GetScreenSettings(d->xbase, d->screenwidth, d->wmult,
d->ybase, d->screenheight, d->hmult);
@@ -1003,18 +1003,19 @@ void MythMainWindow::Init(void)
d->render = NULL;
}
- QString painter = GetMythDB()->GetSetting("ThemePainter", "qt");
+ QString painter = forcedpainter.isEmpty() ?
+ GetMythDB()->GetSetting("ThemePainter", QT_PAINTER) : forcedpainter;
#ifdef USING_MINGW
- if (painter == "auto" || painter == "d3d9")
+ if (painter == AUTO_PAINTER || painter == D3D9_PAINTER)
{
- LOG(VB_GENERAL, LOG_INFO, "Using the D3D9 painter");
+ LOG(VB_GENERAL, LOG_INFO, QString("Using the %1 painter").arg(D3D9_PAINTER));
d->painter = new MythD3D9Painter();
d->paintwin = new MythPainterWindowD3D9(this, d);
}
#endif
#ifdef USE_OPENGL_PAINTER
- if ((painter == "auto" && (!d->painter && !d->paintwin)) ||
- painter.contains("opengl"))
+ if ((painter == AUTO_PAINTER && (!d->painter && !d->paintwin)) ||
+ painter.contains(OPENGL_PAINTER))
{
LOG(VB_GENERAL, LOG_INFO, "Trying the OpenGL painter");
d->painter = new MythOpenGLPainter();
@@ -1031,7 +1032,7 @@ void MythMainWindow::Init(void)
"Check your OpenGL installation.");
teardown = true;
}
- else if (painter == "auto" && gl && !gl->IsRecommendedRenderer())
+ else if (painter == AUTO_PAINTER && gl && !gl->IsRecommendedRenderer())
{
LOG(VB_GENERAL, LOG_WARNING,
"OpenGL painter not recommended with this system's "
@@ -37,7 +37,7 @@ class MUI_PUBLIC MythMainWindow : public QWidget
friend class MythPainterWindowD3D9;
public:
- void Init(void);
+ void Init(QString forcedpainter = QString());
void ReinitDone(void);
void Show(void);
@@ -34,6 +34,11 @@ class MythUITextEdit;
class MythUIProgressBar;
class MythUIWebBrowser;
+#define QT_PAINTER "qt"
+#define OPENGL_PAINTER "opengl"
+#define AUTO_PAINTER "auto"
+#define D3D9_PAINTER "d3d9"
+
typedef QHash<QString,QString> InfoMap;
/**
@@ -2157,13 +2157,13 @@ static HostComboBox *ThemePainter()
{
HostComboBox *gc = new HostComboBox("ThemePainter");
gc->setLabel(QObject::tr("Paint engine"));
- gc->addSelection(QObject::tr("Qt"), "qt");
- gc->addSelection(QObject::tr("Auto"), "auto");
+ gc->addSelection(QObject::tr("Qt"), QT_PAINTER);
+ gc->addSelection(QObject::tr("Auto"), AUTO_PAINTER);
#ifdef USING_OPENGL
- gc->addSelection(QObject::tr("OpenGL"), "opengl");
+ gc->addSelection(QObject::tr("OpenGL"), OPENGL_PAINTER);
#endif
#ifdef USING_MINGW
- gc->addSelection(QObject::tr("Direct3D"), "d3d9");
+ gc->addSelection(QObject::tr("Direct3D"), D3D9_PAINTER);
#endif
gc->setHelpText(QObject::tr("This selects what MythTV uses to draw. "
"Choosing 'Auto' is recommended, unless running on systems "
@@ -3585,7 +3585,9 @@ AppearanceSettings::AppearanceSettings()
VerticalConfigurationGroup* screen = new VerticalConfigurationGroup(false);
screen->setLabel(QObject::tr("Theme") + " / " + QObject::tr("Screen Settings"));
+#if ! CONFIG_DARWIN
screen->addChild(ThemePainter());
+#endif
screen->addChild(MenuTheme());
if (MythDisplay::GetNumberXineramaScreens() > 1)
@@ -1196,7 +1196,11 @@ static bool resetTheme(QString themedir, const QString badtheme)
MythTranslation::reload();
gCoreContext->ReInitLocale();
GetMythUI()->LoadQtConfig();
+#if CONFIG_DARWIN
+ GetMythMainWindow()->Init(OPENGL_PAINTER);
+#else
GetMythMainWindow()->Init();
+#endif
GetMythMainWindow()->ReinitDone();
@@ -1225,7 +1229,11 @@ static int reloadTheme(void)
{
menu->Close();
}
+#if CONFIG_DARWIN
+ GetMythMainWindow()->Init(OPENGL_PAINTER);
+#else
GetMythMainWindow()->Init();
+#endif
GetMythMainWindow()->ReinitDone();
@@ -1602,7 +1610,11 @@ int main(int argc, char **argv)
}
MythMainWindow *mainWindow = GetMythMainWindow();
+#if CONFIG_DARWIN
+ mainWindow->Init(OPENGL_PAINTER);
+#else
mainWindow->Init();
+#endif
mainWindow->setWindowTitle(QObject::tr("MythTV Frontend"));
// We must reload the translation after a language change and this
@@ -186,8 +186,11 @@ static bool resetTheme(QString themedir, const QString badtheme)
MythTranslation::reload();
GetMythUI()->LoadQtConfig();
+#if CONFIG_DARWIN
+ GetMythMainWindow()->Init(QT_PAINTER);
+#else
GetMythMainWindow()->Init();
-
+#endif
GetMythMainWindow()->ReinitDone();
return RunMenu(themedir, themename);
@@ -211,7 +214,11 @@ static int reloadTheme(void)
GetMythUI()->LoadQtConfig();
menu->Close();
+#if CONFIG_DARWIN
+ GetMythMainWindow()->Init(QT_PAINTER);
+#else
GetMythMainWindow()->Init();
+#endif
GetMythMainWindow()->ReinitDone();
@@ -505,7 +512,11 @@ int main(int argc, char *argv[])
}
MythMainWindow *mainWindow = GetMythMainWindow();
+#if CONFIG_DARWIN
+ mainWindow->Init(QT_PAINTER);
+#else
mainWindow->Init();
+#endif
mainWindow->setWindowTitle(QObject::tr("MythTV Setup"));
// We must reload the translation after a language change and this

0 comments on commit 0a5d426

Please sign in to comment.