Ticket #2932: menutheme_fix.diff
| File menutheme_fix.diff, 4.4 KB (added by , 20 years ago) |
|---|
-
mythtv/libs/libmyth/mythcontext.cpp
1280 1280 d->m_backgroundimage = NULL; 1281 1281 1282 1282 themename = GetSetting("MenuTheme"); 1283 d->m_menuthemepathname = Find ThemeDir(themename) +"/";1283 d->m_menuthemepathname = FindMenuThemeDir(themename) +"/"; 1284 1284 1285 1285 d->bigfontsize = GetNumSetting("QtFontBig", 25); 1286 1286 d->mediumfontsize = GetNumSetting("QtFontMedium", 16); … … 1682 1682 return true; 1683 1683 } 1684 1684 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 */ 1685 1693 QString MythContext::FindThemeDir(const QString &themename) 1686 1694 { 1687 1695 QString testdir = MythContext::GetConfDir() + "/themes/" + themename; … … 1695 1703 if (dir.exists()) 1696 1704 return testdir; 1697 1705 1698 testdir = "../menutest/" + themename;1706 testdir = GetThemesParentDir() + "G.A.N.T."; 1699 1707 dir.setPath(testdir); 1700 1708 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."); 1701 1713 return testdir; 1714 } 1702 1715 1716 VERBOSE(VB_IMPORTANT, QString("Could not find theme: %1").arg(themename)); 1717 return ""; 1718 } 1703 1719 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 */ 1728 QString MythContext::FindMenuThemeDir(const QString &menuname) 1729 { 1730 QString testdir; 1731 QDir dir; 1732 1733 if (menuname == "default") 1706 1734 { 1707 1735 testdir = GetShareDir(); 1708 1736 dir.setPath(testdir); … … 1710 1738 return testdir; 1711 1739 } 1712 1740 1713 testdir = GetThemesParentDir() + "G.A.N.T."; 1741 testdir = MythContext::GetConfDir() + "/themes/" + menuname; 1742 1714 1743 dir.setPath(testdir); 1715 1744 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()) 1716 1755 { 1717 1756 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"); 1720 1759 return testdir; 1721 1760 } 1761 else { 1762 VERBOSE(VB_IMPORTANT, QString("Could not find menu theme: %1 - Fallback to default failed.").arg(menuname)); 1763 } 1722 1764 1723 VERBOSE(VB_IMPORTANT, QString("Could not find theme: %1").arg(themename));1724 1765 return ""; 1725 1766 } 1767 1726 1768 QString MythContext::GetMenuThemeDir(void) 1727 1769 { 1728 1770 return d->m_menuthemepathname; -
mythtv/libs/libmyth/mythcontext.h
279 279 bool ParseGeometryOverride(const QString geometry); 280 280 281 281 QString FindThemeDir(const QString &themename); 282 QString FindMenuThemeDir(const QString &themename); 282 283 QString GetThemeDir(void); 283 284 QValueList<QString> GetThemeSearchPath(void); 284 285 -
mythtv/programs/mythfrontend/globalsettings.cpp
809 809 QDir themes(gContext->GetThemesParentDir()); 810 810 themes.setFilter(QDir::Dirs); 811 811 themes.setSorting(QDir::Name | QDir::IgnoreCase); 812 gc->addSelection(QObject::tr("Default") );812 gc->addSelection(QObject::tr("Default"), "default"); 813 813 const QFileInfoList *fil = themes.entryInfoList(QDir::Dirs); 814 814 if (!fil) 815 815 return gc;
