12#define LOC QString("ThemeHelper: ")
26 LOG(VB_GUI, LOG_INFO,
LOC + QString(
"Using theme base resolution of %1x%2")
33 if (themename ==
"default")
34 themename =
"defaultmenu";
53 if (!ThemeName.isEmpty())
65 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"No theme dir: '%1'").arg(dir.absolutePath()));
75 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Could not find theme: %1 - Switching to %2")
81 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"No default theme dir: '%1'")
82 .arg(dir.absolutePath()));
88 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Could not find theme: %1 - Switching to %2")
94 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"No fallback GUI theme dir: '%1'").arg(dir.absolutePath()));
112 dir.setPath(testdir);
117 dir.setPath(testdir);
122 dir.setPath(testdir);
125 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Could not find menu theme: %1 - Switching to default")
131 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Could not find menu theme: %1 - Fallback to default failed.")
170 for (
int x = 0; x < themeList.count(); x++)
172 if (themeList.at(x).GetName() ==
themeName)
175 baseName = themeList.at(x).GetBaseTheme();
176 dirName = themeList.at(x).GetDirectoryName();
187 LOG(VB_GUI, LOG_INFO,
LOC + QString(
"Adding path '%1' to theme search paths").arg(
themedir));
192 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Could not find ui theme location: %1").arg(
themedir));
197 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Could not find inherited theme: %1").arg(
themeName));
214 themeDirs.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
215 themeDirs.setSorting(QDir::Name | QDir::IgnoreCase);
216 QFileInfoList fileList { themeDirs.entryInfoList() };
218 fileList.append(themeDirs.entryInfoList());
220 QList<ThemeInfo> themeList;
221 for (
const auto & theme : std::as_const(fileList))
223 if (theme.baseName() ==
"default" || theme.baseName() ==
"default-wide" ||
224 theme.baseName() ==
"Slave")
229 ThemeInfo themeInfo(theme.absoluteFilePath());
231 if (themeInfo.
GetType() & Type)
232 themeList.append(themeInfo);
242 if (fi.isAbsolute() && fi.exists())
245 if (Path.startsWith(
"assets:/") && fi.exists())
250 bool foundit =
false;
253 for (
const auto & ii : std::as_const(searchpath))
256 file = ii + fi.filePath();
257 else if (fi.isAbsolute() && !fi.isRoot())
258 file = ii + fi.fileName();
QString GetHostName(void)
void SaveSetting(const QString &key, int newValue)
QString GetSetting(const QString &key, const QString &defaultval="")
void OverrideSettingForSession(const QString &key, const QString &value)
bool FindThemeFile(QString &Path)
QString m_menuthemepathname
QList< ThemeInfo > GetThemes(ThemeType Type)
QStringList GetThemeSearchPath()
QString FindThemeDir(const QString &ThemeName, bool Fallback=true)
Returns the full path to the theme denoted by themename.
QStringList m_searchPaths
QString GetMenuThemeDir()
QString FindMenuThemeDir(const QString &MenuName)
Returns the full path to the menu theme denoted by menuname.
QSize GetBaseSize() const
QString GetFirstDir(bool appendSlash=false) const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QString GetShareDir(void)
QString GetThemesParentDir(void)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static constexpr const char * FALLBACK_UI_THEME
static constexpr const char * DEFAULT_UI_THEME