diff options
author | con <qtc-committer@nokia.com> | 2009-12-09 15:30:23 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2009-12-09 15:31:01 +0100 |
commit | 3ab0a28cca0c20baa4b21a3d08223065a1e3be94 (patch) | |
tree | 2e3fabc7b0771aa279230e1001ae9345189441e3 | |
parent | 9097149ceea07d96716ca9d3ddbb32ec1b933a61 (diff) | |
download | qt-creator-3ab0a28cca0c20baa4b21a3d08223065a1e3be94.tar.gz |
Less use of slow methods.
-rw-r--r-- | src/libs/qtconcurrent/multitask.h | 11 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarkmanager.cpp | 2 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarkmanager.h | 1 | ||||
-rw-r--r-- | src/plugins/coreplugin/filemanager.cpp | 4 | ||||
-rw-r--r-- | src/plugins/coreplugin/modemanager.cpp | 3 | ||||
-rw-r--r-- | src/plugins/coreplugin/progressmanager/progressmanager.cpp | 2 | ||||
-rw-r--r-- | src/plugins/coreplugin/sidebar.cpp | 2 |
7 files changed, 12 insertions, 13 deletions
diff --git a/src/libs/qtconcurrent/multitask.h b/src/libs/qtconcurrent/multitask.h index 56349ee5da..a867f2559f 100644 --- a/src/libs/qtconcurrent/multitask.h +++ b/src/libs/qtconcurrent/multitask.h @@ -95,7 +95,7 @@ public: loop->exec(); futureInterface.reportFinished(); QThreadPool::globalInstance()->reserveThread(); - qDeleteAll(watchers.values()); + qDeleteAll(watchers); delete selfWatcher; delete loop; } @@ -113,8 +113,7 @@ protected: if (finished.contains(watcher)) finished[watcher] = true; bool allFinished = true; - const QList<bool> finishedValues = finished.values(); - foreach (bool isFinished, finishedValues) { + foreach (bool isFinished, finished) { if (!isFinished) { allFinished = false; break; @@ -146,8 +145,7 @@ private: void updateProgress() { int progressSum = 0; - const QList<QFutureWatcher<R> *> watchersValues = watchers.values(); - foreach (QFutureWatcher<R> *watcher, watchersValues) { + foreach (QFutureWatcher<R> *watcher, watchers) { if (watcher->progressMinimum() == watcher->progressMaximum()) { if (watcher->future().isFinished() && !watcher->future().isCanceled()) progressSum += 100; @@ -161,8 +159,7 @@ private: void updateProgressText() { QString text; - const QList<QFutureWatcher<R> *> watchersValues = watchers.values(); - foreach (QFutureWatcher<R> *watcher, watchersValues) { + foreach (QFutureWatcher<R> *watcher, watchers) { if (!watcher->progressText().isEmpty()) text += watcher->progressText() + "\n"; } diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 4fc8c04010..ce08ec8202 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -329,7 +329,7 @@ BookmarkManager::~BookmarkManager() end = m_bookmarksMap.end(); for (it = m_bookmarksMap.begin(); it != end; ++it) { FileNameBookmarksMap *bookmarks = it.value(); - qDeleteAll(bookmarks->values()); + qDeleteAll(*bookmarks); delete bookmarks; } } diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h index 7056868f07..d916759fe8 100644 --- a/src/plugins/bookmarks/bookmarkmanager.h +++ b/src/plugins/bookmarks/bookmarkmanager.h @@ -34,6 +34,7 @@ #include <coreplugin/inavigationwidgetfactory.h> #include <QtCore/QAbstractItemModel> +#include <QtCore/QMultiMap> #include <QtCore/QList> #include <QtGui/QListView> #include <QtGui/QPixmap> diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index 7235085a3a..4036c7396d 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -390,8 +390,8 @@ QList<IFile *> FileManager::saveModifiedFiles(const QList<IFile *> &files, // There can be several FileInterfaces pointing to the same file // Select one that is not readonly. - if (!(modifiedFilesMap.values().contains(name) - && file->isReadOnly())) + if (!(modifiedFilesMap.key(name, 0) + && file->isReadOnly())) modifiedFilesMap.insert(file, name); } } diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 66b36678db..b8334e3733 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -194,9 +194,10 @@ void ModeManager::addAction(Command *command, int priority, QMenu *menu) // Count the number of commands with a higher priority int index = 0; - foreach (int p, m_actions.values()) + foreach (int p, m_actions) { if (p > priority) ++index; + } m_actionBar->insertAction(index, command->action(), menu); } diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 954692f449..7b0afe2bf9 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -316,7 +316,7 @@ void ProgressManagerPrivate::taskFinished() m_runningTasks.remove(task); delete task; - if (!m_runningTasks.values().contains(type)) { + if (!m_runningTasks.key(type, 0)) { emit allTasksFinished(type); } } diff --git a/src/plugins/coreplugin/sidebar.cpp b/src/plugins/coreplugin/sidebar.cpp index a89720c240..86ffd9fe91 100644 --- a/src/plugins/coreplugin/sidebar.cpp +++ b/src/plugins/coreplugin/sidebar.cpp @@ -68,7 +68,7 @@ SideBar::SideBar(QList<SideBarItem*> itemList, SideBar::~SideBar() { - qDeleteAll(m_itemMap.values()); + qDeleteAll(m_itemMap); } QStringList SideBar::availableItems() const |