Skip to content

Commit

Permalink
Remove Painter settings on Mac OS X
Browse files Browse the repository at this point in the history
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
jyavenard committed Jul 21, 2012
1 parent 2e9333d commit 0a5d426
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
15 changes: 8 additions & 7 deletions mythtv/libs/libmythui/mythmainwindow.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythmainwindow.h
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions mythtv/libs/libmythui/mythuitype.h
Expand Up @@ -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;

/**
Expand Down
10 changes: 6 additions & 4 deletions mythtv/programs/mythfrontend/globalsettings.cpp
Expand Up @@ -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 "
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions mythtv/programs/mythfrontend/main.cpp
Expand Up @@ -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();

Expand Down Expand Up @@ -1225,7 +1229,11 @@ static int reloadTheme(void)
{
menu->Close();
}
#if CONFIG_DARWIN
GetMythMainWindow()->Init(OPENGL_PAINTER);
#else
GetMythMainWindow()->Init();
#endif

GetMythMainWindow()->ReinitDone();

Expand Down Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion mythtv/programs/mythtv-setup/main.cpp
Expand Up @@ -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);
Expand All @@ -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();

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0a5d426

Please sign in to comment.