QMimeType performance fix: don't reload from XML files over and over.
Change-Id: Ie19c338ed6449ea1509306cbda5dc251295783ae Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
b36666e1ef
commit
4046ec71c8
@ -529,6 +529,9 @@ QList<QMimeType> QMimeBinaryProvider::allMimeTypes()
|
||||
|
||||
void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
|
||||
{
|
||||
if (data.loaded)
|
||||
return;
|
||||
data.loaded = true;
|
||||
// load comment and globPatterns
|
||||
|
||||
const QString file = data.name + QLatin1String(".xml");
|
||||
|
@ -63,6 +63,7 @@ bool qt_isQMimeTypeDebuggingActivated (false);
|
||||
#endif
|
||||
|
||||
QMimeTypePrivate::QMimeTypePrivate()
|
||||
: loaded(false)
|
||||
{}
|
||||
|
||||
QMimeTypePrivate::QMimeTypePrivate(const QMimeType &other)
|
||||
@ -70,7 +71,8 @@ QMimeTypePrivate::QMimeTypePrivate(const QMimeType &other)
|
||||
localeComments(other.d->localeComments),
|
||||
genericIconName(other.d->genericIconName),
|
||||
iconName(other.d->iconName),
|
||||
globPatterns(other.d->globPatterns)
|
||||
globPatterns(other.d->globPatterns),
|
||||
loaded(other.d->loaded)
|
||||
{}
|
||||
|
||||
void QMimeTypePrivate::clear()
|
||||
@ -80,6 +82,7 @@ void QMimeTypePrivate::clear()
|
||||
genericIconName.clear();
|
||||
iconName.clear();
|
||||
globPatterns.clear();
|
||||
loaded = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
QString genericIconName;
|
||||
QString iconName;
|
||||
QStringList globPatterns;
|
||||
bool loaded;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user