summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@nokia.com>2012-05-03 13:15:26 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2012-05-03 13:54:38 +0200
commitf5f76be1f5e498233d9412badfee287b26d89264 (patch)
treeabe46599ef18bedbb85c035e6146631bab678898
parent50e6502d155ed7c8dd759388b50e4fc7299ce0c4 (diff)
use QHash where it is possible
Change-Id: I01edf5ee396ea61526dce52d7b7f4fd02721c220 Reviewed-by: Karsten Heimrich <karsten.heimrich@nokia.com>
-rw-r--r--src/libs/installer/component_p.cpp1
-rw-r--r--src/libs/installer/component_p.h2
-rw-r--r--src/libs/installer/componentmodel.h2
-rw-r--r--src/libs/installer/lib7z_facade.cpp4
-rw-r--r--src/libs/installer/packagemanagergui.cpp6
-rw-r--r--src/libs/installer/qtpatchoperation.cpp41
-rw-r--r--src/libs/kdtools/kdupdaterupdate.cpp4
-rw-r--r--src/libs/kdtools/kdupdaterupdate.h4
-rw-r--r--src/libs/kdtools/kdupdaterupdatefinder.cpp2
-rw-r--r--src/libs/kdtools/kdupdaterupdatefinder.h4
-rw-r--r--src/libs/kdtools/kdupdaterupdatesinfo_p.h4
-rw-r--r--tools/common/repositorygen.cpp6
-rw-r--r--tools/common/repositorygen.h4
-rw-r--r--tools/repogen/repogen.cpp2
14 files changed, 42 insertions, 44 deletions
diff --git a/src/libs/installer/component_p.cpp b/src/libs/installer/component_p.cpp
index df09ff50b..e010bf308 100644
--- a/src/libs/installer/component_p.cpp
+++ b/src/libs/installer/component_p.cpp
@@ -63,7 +63,6 @@ ComponentPrivate::ComponentPrivate(PackageManagerCore *core, Component *qq)
ComponentPrivate::~ComponentPrivate()
{
// Before we can delete the added widgets, they need to be removed from the wizard first.
- QMap<QString, QPointer<QWidget> >::const_iterator it;
foreach (const QString &widgetName, m_userInterfaces.keys()) {
m_core->removeWizardPage(q, widgetName);
m_core->removeWizardPageItem(q, widgetName);
diff --git a/src/libs/installer/component_p.h b/src/libs/installer/component_p.h
index 6cdbdcf80..0c58288f9 100644
--- a/src/libs/installer/component_p.h
+++ b/src/libs/installer/component_p.h
@@ -82,7 +82,7 @@ public:
QStringList m_downloadableArchives;
QStringList m_stopProcessForUpdateRequests;
QHash<QString, bool> m_unexistingScriptMethods;
- QMap<QString, QPointer<QWidget> > m_userInterfaces;
+ QHash<QString, QPointer<QWidget> > m_userInterfaces;
// < display name, < file name, file content > >
QHash<QString, QPair<QString, QString> > m_licenses;
diff --git a/src/libs/installer/componentmodel.h b/src/libs/installer/componentmodel.h
index d51c25edf..1d2b5bc9b 100644
--- a/src/libs/installer/componentmodel.h
+++ b/src/libs/installer/componentmodel.h
@@ -106,7 +106,7 @@ private:
QSet<QString> m_currentCheckedSet;
QList<Component*> m_rootComponentList;
- mutable QMap<QString, QPersistentModelIndex> m_indexByNameCache;
+ mutable QHash<QString, QPersistentModelIndex> m_indexByNameCache;
};
} // namespace QInstaller
diff --git a/src/libs/installer/lib7z_facade.cpp b/src/libs/installer/lib7z_facade.cpp
index c679572fd..cdbe3313b 100644
--- a/src/libs/installer/lib7z_facade.cpp
+++ b/src/libs/installer/lib7z_facade.cpp
@@ -615,11 +615,11 @@ private:
OpenArchiveInfoCleaner *m_cleaner;
static QMutex m_mutex;
- static QMap< QIODevice*, OpenArchiveInfo* > instances;
+ static QHash< QIODevice*, OpenArchiveInfo* > instances;
};
QMutex OpenArchiveInfo::m_mutex;
-QMap< QIODevice*, OpenArchiveInfo* > OpenArchiveInfo::instances;
+QHash< QIODevice*, OpenArchiveInfo* > OpenArchiveInfo::instances;
void OpenArchiveInfoCleaner::deviceDestroyed(QObject* dev)
{
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index a2eb6b4cf..5bbea1606 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -204,12 +204,12 @@ public:
bool m_modified;
bool m_autoSwitchPage;
bool m_showSettingsButton;
- QMap<int, QWizardPage*> m_defaultPages;
- QMap<int, QString> m_defaultButtonText;
+ QHash<int, QWizardPage*> m_defaultPages;
+ QHash<int, QString> m_defaultButtonText;
QScriptValue m_controlScript;
QScriptEngine m_controlScriptEngine;
- QMap<QWizard::WizardButton, QString> m_wizardButtonTypes;
+ QHash<QWizard::WizardButton, QString> m_wizardButtonTypes;
};
diff --git a/src/libs/installer/qtpatchoperation.cpp b/src/libs/installer/qtpatchoperation.cpp
index e1b4dc993..b8779150a 100644
--- a/src/libs/installer/qtpatchoperation.cpp
+++ b/src/libs/installer/qtpatchoperation.cpp
@@ -39,7 +39,6 @@
#include "constants.h"
#include "packagemanagercore.h"
-#include <QMap>
#include <QSet>
#include <QFile>
#include <QTextStream>
@@ -48,47 +47,47 @@
using namespace QInstaller;
-static QMap<QByteArray, QByteArray> generatePatchValueMap(const QByteArray &newQtPath,
+static QHash<QByteArray, QByteArray> generatePatchValueHash(const QByteArray &newQtPath,
const QHash<QString, QByteArray> &qmakeValueHash)
{
- QMap<QByteArray, QByteArray> replaceMap; //first == searchstring: second == replace string
+ QHash<QByteArray, QByteArray> replaceHash; //first == searchstring: second == replace string
char nativeSeperator = QDir::separator().toAscii();
QByteArray oldValue;
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_PREFIX"));
- replaceMap.insert(QByteArray("qt_prfxpath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_prfxpath=%1").replace("%1", oldValue),
QByteArray("qt_prfxpath=%1/").replace("%1/", newQtPath));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_DOCS"));
- replaceMap.insert(QByteArray("qt_docspath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_docspath=%1").replace("%1", oldValue),
QByteArray("qt_docspath=%1/doc").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_HEADERS"));
- replaceMap.insert(QByteArray("qt_hdrspath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_hdrspath=%1").replace("%1", oldValue),
QByteArray("qt_hdrspath=%1/include").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_LIBS"));
- replaceMap.insert(QByteArray("qt_libspath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_libspath=%1").replace("%1", oldValue),
QByteArray("qt_libspath=%1/lib").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_BINS"));
- replaceMap.insert(QByteArray("qt_binspath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_binspath=%1").replace("%1", oldValue),
QByteArray("qt_binspath=%1/bin").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_PLUGINS"));
- replaceMap.insert(QByteArray("qt_plugpath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_plugpath=%1").replace("%1", oldValue),
QByteArray("qt_plugpath=%1/plugins").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_IMPORTS"));
- replaceMap.insert(QByteArray("qt_impspath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_impspath=%1").replace("%1", oldValue),
QByteArray("qt_impspath=%1/imports").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_DATA"));
- replaceMap.insert( QByteArray("qt_datapath=%1").replace("%1", oldValue),
+ replaceHash.insert( QByteArray("qt_datapath=%1").replace("%1", oldValue),
QByteArray("qt_datapath=%1/").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_TRANSLATIONS"));
- replaceMap.insert( QByteArray("qt_trnspath=%1").replace("%1", oldValue),
+ replaceHash.insert( QByteArray("qt_trnspath=%1").replace("%1", oldValue),
QByteArray("qt_trnspath=%1/translations").replace("%1/", newQtPath + nativeSeperator));
// This must not be patched. Commenting out to fix QTSDK-429
@@ -99,30 +98,30 @@ static QMap<QByteArray, QByteArray> generatePatchValueMap(const QByteArray &newQ
//examples and demoes can patched outside separately,
//but for cosmetic reasons - if the qt version gets no examples later.
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_EXAMPLES"));
- replaceMap.insert( QByteArray("qt_xmplpath=%1").replace("%1", oldValue),
+ replaceHash.insert( QByteArray("qt_xmplpath=%1").replace("%1", oldValue),
QByteArray("qt_xmplpath=%1/examples").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_DEMOS"));
- replaceMap.insert( QByteArray("qt_demopath=%1").replace("%1", oldValue),
+ replaceHash.insert( QByteArray("qt_demopath=%1").replace("%1", oldValue),
QByteArray("qt_demopath=%1/demos").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_TESTS"));
- replaceMap.insert(QByteArray("qt_tstspath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_tstspath=%1").replace("%1", oldValue),
QByteArray("qt_tstspath=%1/tests").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_HOST_PREFIX"));
- replaceMap.insert(QByteArray("qt_hpfxpath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_hpfxpath=%1").replace("%1", oldValue),
QByteArray("qt_hpfxpath=%1/").replace("%1/", newQtPath));
oldValue = qmakeValueHash.value(QLatin1String("QT_HOST_BINS"));
- replaceMap.insert( QByteArray("qt_hbinpath=%1").replace("%1", oldValue),
+ replaceHash.insert( QByteArray("qt_hbinpath=%1").replace("%1", oldValue),
QByteArray("qt_hbinpath=%1/bin").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_HOST_DATA"));
- replaceMap.insert(QByteArray("qt_hdatpath=%1").replace("%1", oldValue),
+ replaceHash.insert(QByteArray("qt_hdatpath=%1").replace("%1", oldValue),
QByteArray("qt_hdatpath=%1/").replace("%1/", newQtPath));
- return replaceMap;
+ return replaceHash;
}
QtPatchOperation::QtPatchOperation()
@@ -244,7 +243,7 @@ bool QtPatchOperation::performOperation()
prefix += QLatin1Char('/');
//BEGIN - patch binary files
- QMap<QByteArray, QByteArray> patchValueMap = generatePatchValueMap(newQtPath, qmakeValueHash);
+ QHash<QByteArray, QByteArray> patchValueHash = generatePatchValueHash(newQtPath, qmakeValueHash);
foreach (QString fileName, filesToPatch) {
fileName.prepend(prefix);
@@ -262,7 +261,7 @@ bool QtPatchOperation::performOperation()
return false;
}
- QMapIterator<QByteArray, QByteArray> it(patchValueMap);
+ QHashIterator<QByteArray, QByteArray> it(patchValueHash);
while (it.hasNext()) {
it.next();
bool isPatched = QtPatch::patchBinaryFile(&file, it.key(), it.value());
diff --git a/src/libs/kdtools/kdupdaterupdate.cpp b/src/libs/kdtools/kdupdaterupdate.cpp
index 02d7fbc9a..3e560e0b4 100644
--- a/src/libs/kdtools/kdupdaterupdate.cpp
+++ b/src/libs/kdtools/kdupdaterupdate.cpp
@@ -60,7 +60,7 @@ struct Update::UpdateData
Update *q;
Application *application;
UpdateSourceInfo sourceInfo;
- QMap<QString, QVariant> data;
+ QHash<QString, QVariant> data;
QUrl updateUrl;
UpdateType type;
QList<UpdateOperation *> operations;
@@ -77,7 +77,7 @@ struct Update::UpdateData
\internal
*/
Update::Update(Application *application, const UpdateSourceInfo &sourceInfo,
- UpdateType type, const QUrl &updateUrl, const QMap<QString, QVariant> &data,
+ UpdateType type, const QUrl &updateUrl, const QHash<QString, QVariant> &data,
quint64 compressedSize, quint64 uncompressedSize, const QByteArray &sha1sum)
: Task(QLatin1String("Update"), Stoppable, application),
d(new UpdateData(this))
diff --git a/src/libs/kdtools/kdupdaterupdate.h b/src/libs/kdtools/kdupdaterupdate.h
index 0cf614f56..17250a71e 100644
--- a/src/libs/kdtools/kdupdaterupdate.h
+++ b/src/libs/kdtools/kdupdaterupdate.h
@@ -28,7 +28,7 @@
#include <QUrl>
#include <QDate>
-#include <QMap>
+#include <QHash>
#include <QVariant>
#include <QList>
@@ -80,7 +80,7 @@ private:
bool doResume();
Update(Application *application, const UpdateSourceInfo &sourceInfo,
- UpdateType type, const QUrl &updateUrl, const QMap<QString, QVariant> &data,
+ UpdateType type, const QUrl &updateUrl, const QHash<QString, QVariant> &data,
quint64 compressedSize, quint64 uncompressedSize, const QByteArray &sha1sum);
};
diff --git a/src/libs/kdtools/kdupdaterupdatefinder.cpp b/src/libs/kdtools/kdupdaterupdatefinder.cpp
index d3bc5ba40..a883d98b9 100644
--- a/src/libs/kdtools/kdupdaterupdatefinder.cpp
+++ b/src/libs/kdtools/kdupdaterupdatefinder.cpp
@@ -744,7 +744,7 @@ void UpdateFinder::Private::slotDownloadDone()
\internal
*/
Update *UpdateFinder::constructUpdate(Application *application, const UpdateSourceInfo &sourceInfo,
- UpdateType type, const QUrl &updateUrl, const QMap<QString, QVariant> &data,
+ UpdateType type, const QUrl &updateUrl, const QHash<QString, QVariant> &data,
quint64 compressedSize, quint64 uncompressedSize, const QByteArray &sha1sum )
{
return new Update(application, sourceInfo, type, updateUrl, data, compressedSize, uncompressedSize, sha1sum);
diff --git a/src/libs/kdtools/kdupdaterupdatefinder.h b/src/libs/kdtools/kdupdaterupdatefinder.h
index 4faa97dab..7f5ec1bfb 100644
--- a/src/libs/kdtools/kdupdaterupdatefinder.h
+++ b/src/libs/kdtools/kdupdaterupdatefinder.h
@@ -27,7 +27,7 @@
#include "kdupdatertask.h"
#include <QList>
-#include <QMap>
+#include <QHash>
QT_BEGIN_NAMESPACE
class QUrl;
@@ -60,7 +60,7 @@ private:
bool doResume();
Update *constructUpdate(Application *application, const UpdateSourceInfo &sourceInfo,
- UpdateType type, const QUrl &updateUrl, const QMap<QString, QVariant> &data,
+ UpdateType type, const QUrl &updateUrl, const QHash<QString, QVariant> &data,
quint64 compressedSize, quint64 uncompressedSize, const QByteArray &sha1sum);
private:
diff --git a/src/libs/kdtools/kdupdaterupdatesinfo_p.h b/src/libs/kdtools/kdupdaterupdatesinfo_p.h
index 7c4bc5b3f..311c313e4 100644
--- a/src/libs/kdtools/kdupdaterupdatesinfo_p.h
+++ b/src/libs/kdtools/kdupdaterupdatesinfo_p.h
@@ -31,7 +31,7 @@
#include <QList>
#include <QStringList>
#include <QUrl>
-#include <QMap>
+#include <QHash>
#include <QVariant>
// Classes and structures in this header file are for internal use only.
@@ -57,7 +57,7 @@ struct UpdateFileInfo
struct UpdateInfo
{
int type;
- QMap<QString, QVariant> data;
+ QHash<QString, QVariant> data;
QList<UpdateFileInfo> updateFiles;
};
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index f7af3d268..8534c1c20 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -495,9 +495,9 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD
return dict;
}
-QMap<QString, QString> QInstallerTools::buildPathToVersionMap(const PackageInfoVector &info)
+QHash<QString, QString> QInstallerTools::buildPathToVersionMapping(const PackageInfoVector &info)
{
- QMap<QString, QString> map;
+ QHash<QString, QString> map;
foreach (const PackageInfo &inf, info)
map[inf.name] = inf.version;
return map;
@@ -519,7 +519,7 @@ static void writeSHA1ToNodeWithName(QDomDocument &doc, QDomNodeList &list, const
}
void QInstallerTools::compressMetaDirectories(const QString &repoDir, const QString &baseDir,
- const QMap<QString, QString> &versionMapping)
+ const QHash<QString, QString> &versionMapping)
{
QDomDocument doc;
QDomElement root;
diff --git a/tools/common/repositorygen.h b/tools/common/repositorygen.h
index faa7a8083..7cb7a07a0 100644
--- a/tools/common/repositorygen.h
+++ b/tools/common/repositorygen.h
@@ -56,12 +56,12 @@ enum FilterType {
Exclude
};
-QMap<QString, QString> buildPathToVersionMap(const PackageInfoVector &info);
+QHash<QString, QString> buildPathToVersionMapping(const PackageInfoVector &info);
void compressMetaDirectories(const QString &repoDir);
void compressDirectory(const QStringList &paths, const QString &archivePath);
void compressMetaDirectories(const QString &repoDir, const QString &baseDir,
- const QMap<QString, QString> &versionMapping);
+ const QHash<QString, QString> &versionMapping);
void copyComponentData(const QString &packageDir, const QString &repoDir, PackageInfoVector &infos);
diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp
index fea4afada..4ff546e95 100644
--- a/tools/repogen/repogen.cpp
+++ b/tools/repogen/repogen.cpp
@@ -201,7 +201,7 @@ int main(int argc, char** argv)
QInstallerTools::PackageInfoVector packages = QInstallerTools::createListOfPackages(packagesDir,
filteredPackages, filterType);
- QMap<QString, QString> pathToVersionMapping = buildPathToVersionMap(packages);
+ QHash<QString, QString> pathToVersionMapping = buildPathToVersionMapping(packages);
foreach (const QInstallerTools::PackageInfo &package, packages) {
const QFileInfo fi(repositoryDir, package.name);