NOISSUE tabs -> spaces
This commit is contained in:
@ -46,17 +46,17 @@ namespace
|
||||
{
|
||||
struct QtIconCache : public IconCache
|
||||
{
|
||||
QtIconCache()
|
||||
{
|
||||
qAddPostRoutine(qt_cleanup_icon_cache);
|
||||
}
|
||||
QtIconCache()
|
||||
{
|
||||
qAddPostRoutine(qt_cleanup_icon_cache);
|
||||
}
|
||||
};
|
||||
}
|
||||
Q_GLOBAL_STATIC(IconCache, qtIconCache)
|
||||
|
||||
static void qt_cleanup_icon_cache()
|
||||
{
|
||||
qtIconCache()->clear();
|
||||
qtIconCache()->clear();
|
||||
}
|
||||
|
||||
/************************************************
|
||||
@ -78,7 +78,7 @@ XdgIcon::~XdgIcon()
|
||||
************************************************/
|
||||
QString XdgIcon::themeName()
|
||||
{
|
||||
return QIcon::themeName();
|
||||
return QIcon::themeName();
|
||||
}
|
||||
|
||||
/************************************************
|
||||
@ -86,8 +86,8 @@ QString XdgIcon::themeName()
|
||||
************************************************/
|
||||
void XdgIcon::setThemeName(const QString &themeName)
|
||||
{
|
||||
QIcon::setThemeName(themeName);
|
||||
QtXdg::QIconLoader::instance()->updateSystemTheme();
|
||||
QIcon::setThemeName(themeName);
|
||||
QtXdg::QIconLoader::instance()->updateSystemTheme();
|
||||
}
|
||||
|
||||
/************************************************
|
||||
@ -96,43 +96,43 @@ void XdgIcon::setThemeName(const QString &themeName)
|
||||
************************************************/
|
||||
QIcon XdgIcon::fromTheme(const QString &iconName, const QIcon &fallback)
|
||||
{
|
||||
if (iconName.isEmpty())
|
||||
return fallback;
|
||||
if (iconName.isEmpty())
|
||||
return fallback;
|
||||
|
||||
bool isAbsolute = (iconName[0] == '/');
|
||||
bool isAbsolute = (iconName[0] == '/');
|
||||
|
||||
QString name = QFileInfo(iconName).fileName();
|
||||
if (name.endsWith(".png", Qt::CaseInsensitive) ||
|
||||
name.endsWith(".svg", Qt::CaseInsensitive) ||
|
||||
name.endsWith(".xpm", Qt::CaseInsensitive))
|
||||
{
|
||||
name.truncate(name.length() - 4);
|
||||
}
|
||||
QString name = QFileInfo(iconName).fileName();
|
||||
if (name.endsWith(".png", Qt::CaseInsensitive) ||
|
||||
name.endsWith(".svg", Qt::CaseInsensitive) ||
|
||||
name.endsWith(".xpm", Qt::CaseInsensitive))
|
||||
{
|
||||
name.truncate(name.length() - 4);
|
||||
}
|
||||
|
||||
QIcon icon;
|
||||
QIcon icon;
|
||||
|
||||
if (qtIconCache()->contains(name))
|
||||
{
|
||||
icon = *qtIconCache()->object(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
QIcon *cachedIcon;
|
||||
if (!isAbsolute)
|
||||
cachedIcon = new QIcon(new QtXdg::QIconLoaderEngineFixed(name));
|
||||
else
|
||||
cachedIcon = new QIcon(iconName);
|
||||
qtIconCache()->insert(name, cachedIcon);
|
||||
icon = *cachedIcon;
|
||||
}
|
||||
if (qtIconCache()->contains(name))
|
||||
{
|
||||
icon = *qtIconCache()->object(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
QIcon *cachedIcon;
|
||||
if (!isAbsolute)
|
||||
cachedIcon = new QIcon(new QtXdg::QIconLoaderEngineFixed(name));
|
||||
else
|
||||
cachedIcon = new QIcon(iconName);
|
||||
qtIconCache()->insert(name, cachedIcon);
|
||||
icon = *cachedIcon;
|
||||
}
|
||||
|
||||
// Note the qapp check is to allow lazy loading of static icons
|
||||
// Supporting fallbacks will not work for this case.
|
||||
if (qApp && !isAbsolute && icon.availableSizes().isEmpty())
|
||||
{
|
||||
return fallback;
|
||||
}
|
||||
return icon;
|
||||
// Note the qapp check is to allow lazy loading of static icons
|
||||
// Supporting fallbacks will not work for this case.
|
||||
if (qApp && !isAbsolute && icon.availableSizes().isEmpty())
|
||||
{
|
||||
return fallback;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
/************************************************
|
||||
@ -141,12 +141,12 @@ QIcon XdgIcon::fromTheme(const QString &iconName, const QIcon &fallback)
|
||||
************************************************/
|
||||
QIcon XdgIcon::fromTheme(const QStringList &iconNames, const QIcon &fallback)
|
||||
{
|
||||
foreach (QString iconName, iconNames)
|
||||
{
|
||||
QIcon icon = fromTheme(iconName);
|
||||
if (!icon.isNull())
|
||||
return icon;
|
||||
}
|
||||
foreach (QString iconName, iconNames)
|
||||
{
|
||||
QIcon icon = fromTheme(iconName);
|
||||
if (!icon.isNull())
|
||||
return icon;
|
||||
}
|
||||
|
||||
return fallback;
|
||||
return fallback;
|
||||
}
|
||||
|
Reference in New Issue
Block a user