Ticket #2932: menutheme_fix.diff

File menutheme_fix.diff, 4.4 KB (added by stuartm, 14 years ago)
  • mythtv/libs/libmyth/mythcontext.cpp

     
    12801280    d->m_backgroundimage = NULL;
    12811281
    12821282    themename = GetSetting("MenuTheme");
    1283     d->m_menuthemepathname = FindThemeDir(themename) +"/";
     1283    d->m_menuthemepathname = FindMenuThemeDir(themename) +"/";
    12841284
    12851285    d->bigfontsize    = GetNumSetting("QtFontBig",    25);
    12861286    d->mediumfontsize = GetNumSetting("QtFontMedium", 16);
     
    16821682    return true;
    16831683}
    16841684
     1685/** \fn FindThemeDir(const QString &themename)
     1686 *  \brief Returns the full path to the theme denoted by themename
     1687 *
     1688 *   If the theme cannot be found falls back to the G.A.N.T. theme.
     1689 *   If the G.A.N.T. theme doesn't exist then returns an empty string.
     1690 *  \param themename The theme name.
     1691 *  \return Path to theme or empty string.
     1692 */
    16851693QString MythContext::FindThemeDir(const QString &themename)
    16861694{
    16871695    QString testdir = MythContext::GetConfDir() + "/themes/" + themename;
     
    16951703    if (dir.exists())
    16961704        return testdir;
    16971705
    1698     testdir = "../menutest/" + themename;
     1706    testdir = GetThemesParentDir() + "G.A.N.T.";
    16991707    dir.setPath(testdir);
    17001708    if (dir.exists())
     1709    {
     1710        VERBOSE(VB_IMPORTANT, QString("Could not find theme: %1 - "
     1711                "Switching to G.A.N.T.").arg(themename));
     1712        SaveSetting("Theme", "G.A.N.T.");
    17011713        return testdir;
     1714    }
    17021715
     1716    VERBOSE(VB_IMPORTANT, QString("Could not find theme: %1").arg(themename));
     1717    return "";
     1718}
    17031719
    1704     // Don't complain about the "default" theme being missing
    1705     if (themename == QObject::tr("Default"))
     1720/** \fn FindMenuThemeDir(const QString &menuname)
     1721 *  \brief Returns the full path to the menu theme denoted by menuname
     1722 *
     1723 *   If the theme cannot be found falls back to the default menu.
     1724 *   If the default menu theme doesn't exist then returns an empty string.
     1725 *  \param menuname The menutheme name.
     1726 *  \return Path to theme or empty string.
     1727 */
     1728QString MythContext::FindMenuThemeDir(const QString &menuname)
     1729{
     1730    QString testdir;
     1731    QDir dir;
     1732
     1733    if (menuname == "default")
    17061734    {
    17071735        testdir = GetShareDir();
    17081736        dir.setPath(testdir);
     
    17101738            return testdir;
    17111739    }
    17121740
    1713     testdir = GetThemesParentDir() + "G.A.N.T.";
     1741    testdir = MythContext::GetConfDir() + "/themes/" + menuname;
     1742
    17141743    dir.setPath(testdir);
    17151744    if (dir.exists())
     1745        return testdir;
     1746
     1747    testdir = GetThemesParentDir() + menuname;
     1748    dir.setPath(testdir);
     1749    if (dir.exists())
     1750        return testdir;
     1751
     1752    testdir = GetShareDir();
     1753    dir.setPath(testdir);
     1754    if (dir.exists())
    17161755    {
    17171756        VERBOSE(VB_IMPORTANT, QString("Could not find theme: %1 - "
    1718                 "Switching to G.A.N.T.").arg(themename));
    1719         SaveSetting("Theme", "G.A.N.T.");
     1757                "Switching to default").arg(menuname));
     1758        SaveSetting("MenuTheme", "default");
    17201759        return testdir;
    17211760    }
     1761    else {
     1762        VERBOSE(VB_IMPORTANT, QString("Could not find menu theme: %1 - Fallback to default failed.").arg(menuname));
     1763    }
    17221764
    1723     VERBOSE(VB_IMPORTANT, QString("Could not find theme: %1").arg(themename));
    17241765    return "";
    17251766}
     1767
    17261768QString MythContext::GetMenuThemeDir(void)
    17271769{
    17281770    return d->m_menuthemepathname;
  • mythtv/libs/libmyth/mythcontext.h

     
    279279    bool ParseGeometryOverride(const QString geometry);
    280280
    281281    QString FindThemeDir(const QString &themename);
     282    QString FindMenuThemeDir(const QString &themename);
    282283    QString GetThemeDir(void);
    283284    QValueList<QString> GetThemeSearchPath(void);
    284285
  • mythtv/programs/mythfrontend/globalsettings.cpp

     
    809809    QDir themes(gContext->GetThemesParentDir());
    810810    themes.setFilter(QDir::Dirs);
    811811    themes.setSorting(QDir::Name | QDir::IgnoreCase);
    812     gc->addSelection(QObject::tr("Default"));
     812    gc->addSelection(QObject::tr("Default"), "default");
    813813    const QFileInfoList *fil = themes.entryInfoList(QDir::Dirs);
    814814    if (!fil)
    815815        return gc;