void IconFactory::loadCurrentIconTheme() { const QStringList installed_themes = installedIconThemes(); const QString theme_name_from_settings = qApp->settings()->value(GROUP(GUI), SETTING(GUI::IconTheme)).toString(); if (QIcon::themeName() == theme_name_from_settings) { qDebug("Icon theme '%s' already loaded.", qPrintable(theme_name_from_settings)); return; } // Display list of installed themes. qDebug("Installed icon themes are: %s.", qPrintable(QStringList(installed_themes) .replaceInStrings(QRegExp(QSL("^|$")), QSL("\'")) .replaceInStrings(QRegExp(QSL("^\\'$")), QSL("\'\'")).join(QSL(", ")))); if (installed_themes.contains(theme_name_from_settings)) { // Desired icon theme is installed and can be loaded. qDebug("Loading icon theme '%s'.", qPrintable(theme_name_from_settings)); QIcon::setThemeName(theme_name_from_settings); } else { // Desired icon theme is not currently available. // Install "default" icon theme instead. qWarning("Icon theme '%s' cannot be loaded because it is not installed. No icon theme (or default icon theme) is loaded now.", qPrintable(theme_name_from_settings)); QIcon::setThemeName(APP_NO_THEME); } }
void IconFactory::loadCurrentIconTheme() { QStringList installed_themes = installedIconThemes(); QString theme_name_from_settings = qApp->settings()->value(APP_CFG_GUI, "icon_theme", APP_THEME_DEFAULT).toString(); if (m_currentIconTheme == theme_name_from_settings) { qDebug("Icon theme '%s' already loaded.", qPrintable(theme_name_from_settings)); return; } // Display list of installed themes. qDebug("Installed icon themes are: %s.", qPrintable(QStringList(installed_themes).replaceInStrings(QRegExp("^|$"), "\'").join(", "))); if (installed_themes.contains(theme_name_from_settings)) { // Desired icon theme is installed and can be loaded. qDebug("Loading icon theme '%s'.", qPrintable(theme_name_from_settings)); m_currentIconTheme = theme_name_from_settings; } else { // Desired icon theme is not currently available. // Install "default" icon theme instead. qDebug("Icon theme '%s' cannot be loaded because it is not installed. " "No icon theme is loaded now.", qPrintable(theme_name_from_settings)); m_currentIconTheme = APP_NO_THEME; } }