mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
generic: minor optimizations
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
02bf57d377
commit
096b62f757
3 changed files with 12 additions and 18 deletions
|
@ -428,12 +428,11 @@ quint32 KStandardDirs::calcResourceHash( const char *type,
|
|||
// absolute dirs are absolute dirs, right? :-/
|
||||
return updateHash(filename, hash);
|
||||
}
|
||||
QStringList candidates = d->resourceDirs(type, filename);
|
||||
|
||||
foreach ( const QString& candidate, candidates )
|
||||
foreach ( const QString & it, d->resourceDirs(type, filename) )
|
||||
{
|
||||
hash = updateHash(candidate + filename, hash);
|
||||
if ( !( options & Recursive ) && hash ) {
|
||||
hash = updateHash(it + filename, hash);
|
||||
if ( !( options & Recursive ) && hash ) {
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
@ -1198,8 +1197,7 @@ QString KStandardDirs::saveLocation(const char *type,
|
|||
return fullPath;
|
||||
}
|
||||
|
||||
// KDE5: make the method const
|
||||
QString KStandardDirs::relativeLocation(const char *type, const QString &absPath)
|
||||
QString KStandardDirs::relativeLocation(const char *type, const QString &absPath) const
|
||||
{
|
||||
QString fullPath = absPath;
|
||||
int i = absPath.lastIndexOf(QLatin1Char('/'));
|
||||
|
@ -1207,12 +1205,9 @@ QString KStandardDirs::relativeLocation(const char *type, const QString &absPath
|
|||
fullPath = realFilePath(absPath); // Normalize
|
||||
}
|
||||
|
||||
const QStringList candidates = resourceDirs(type);
|
||||
|
||||
for (QStringList::ConstIterator it = candidates.begin();
|
||||
it != candidates.end(); ++it) {
|
||||
if (fullPath.startsWith(*it, case_sensitivity)) {
|
||||
return fullPath.mid((*it).length());
|
||||
foreach (const QString &it, resourceDirs(type)) {
|
||||
if (fullPath.startsWith(it, case_sensitivity)) {
|
||||
return fullPath.mid(it.length());
|
||||
}
|
||||
}
|
||||
return absPath;
|
||||
|
@ -1304,11 +1299,10 @@ void KStandardDirs::addResourcesFrom_krcdirs()
|
|||
|
||||
QSettings iniFile(localFile, QSettings::IniFormat);
|
||||
#ifndef QT_KATIE
|
||||
const QStringList resources = iniFile.allKeys();
|
||||
foreach(QString key, iniFile.allKeys())
|
||||
#else
|
||||
const QStringList resources = iniFile.keys();
|
||||
foreach(QString key, iniFile.keys())
|
||||
#endif
|
||||
foreach(QString key, resources)
|
||||
{
|
||||
QDir path(iniFile.value(key).toString());
|
||||
if (!path.exists())
|
||||
|
|
|
@ -552,7 +552,7 @@ public:
|
|||
* will find @p absPath. If no such relative path exists, @p absPath
|
||||
* will be returned unchanged.
|
||||
*/
|
||||
QString relativeLocation(const char *type, const QString &absPath);
|
||||
QString relativeLocation(const char *type, const QString &absPath) const;
|
||||
|
||||
/**
|
||||
* Recursively creates still-missing directories in the given path.
|
||||
|
|
|
@ -149,7 +149,7 @@ public:
|
|||
void processWallpaperSettings(KConfigBase *metadata);
|
||||
void processAnimationSettings(const QString &theme, KConfigBase *metadata);
|
||||
|
||||
const QString processStyleSheet(const QString &css);
|
||||
QString processStyleSheet(const QString &css);
|
||||
|
||||
static const char *defaultTheme;
|
||||
static const char *systemColorsTheme;
|
||||
|
@ -352,7 +352,7 @@ void ThemePrivate::notifyOfChanged()
|
|||
emit q->themeChanged();
|
||||
}
|
||||
|
||||
const QString ThemePrivate::processStyleSheet(const QString &css)
|
||||
QString ThemePrivate::processStyleSheet(const QString &css)
|
||||
{
|
||||
QString stylesheet;
|
||||
if (css.isEmpty()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue