forked from qt-creator/qt-creator
Less use of slow methods.
This commit is contained in:
@@ -95,7 +95,7 @@ public:
|
|||||||
loop->exec();
|
loop->exec();
|
||||||
futureInterface.reportFinished();
|
futureInterface.reportFinished();
|
||||||
QThreadPool::globalInstance()->reserveThread();
|
QThreadPool::globalInstance()->reserveThread();
|
||||||
qDeleteAll(watchers.values());
|
qDeleteAll(watchers);
|
||||||
delete selfWatcher;
|
delete selfWatcher;
|
||||||
delete loop;
|
delete loop;
|
||||||
}
|
}
|
||||||
@@ -113,8 +113,7 @@ protected:
|
|||||||
if (finished.contains(watcher))
|
if (finished.contains(watcher))
|
||||||
finished[watcher] = true;
|
finished[watcher] = true;
|
||||||
bool allFinished = true;
|
bool allFinished = true;
|
||||||
const QList<bool> finishedValues = finished.values();
|
foreach (bool isFinished, finished) {
|
||||||
foreach (bool isFinished, finishedValues) {
|
|
||||||
if (!isFinished) {
|
if (!isFinished) {
|
||||||
allFinished = false;
|
allFinished = false;
|
||||||
break;
|
break;
|
||||||
@@ -146,8 +145,7 @@ private:
|
|||||||
void updateProgress()
|
void updateProgress()
|
||||||
{
|
{
|
||||||
int progressSum = 0;
|
int progressSum = 0;
|
||||||
const QList<QFutureWatcher<R> *> watchersValues = watchers.values();
|
foreach (QFutureWatcher<R> *watcher, watchers) {
|
||||||
foreach (QFutureWatcher<R> *watcher, watchersValues) {
|
|
||||||
if (watcher->progressMinimum() == watcher->progressMaximum()) {
|
if (watcher->progressMinimum() == watcher->progressMaximum()) {
|
||||||
if (watcher->future().isFinished() && !watcher->future().isCanceled())
|
if (watcher->future().isFinished() && !watcher->future().isCanceled())
|
||||||
progressSum += 100;
|
progressSum += 100;
|
||||||
@@ -161,8 +159,7 @@ private:
|
|||||||
void updateProgressText()
|
void updateProgressText()
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
const QList<QFutureWatcher<R> *> watchersValues = watchers.values();
|
foreach (QFutureWatcher<R> *watcher, watchers) {
|
||||||
foreach (QFutureWatcher<R> *watcher, watchersValues) {
|
|
||||||
if (!watcher->progressText().isEmpty())
|
if (!watcher->progressText().isEmpty())
|
||||||
text += watcher->progressText() + "\n";
|
text += watcher->progressText() + "\n";
|
||||||
}
|
}
|
||||||
|
@@ -329,7 +329,7 @@ BookmarkManager::~BookmarkManager()
|
|||||||
end = m_bookmarksMap.end();
|
end = m_bookmarksMap.end();
|
||||||
for (it = m_bookmarksMap.begin(); it != end; ++it) {
|
for (it = m_bookmarksMap.begin(); it != end; ++it) {
|
||||||
FileNameBookmarksMap *bookmarks = it.value();
|
FileNameBookmarksMap *bookmarks = it.value();
|
||||||
qDeleteAll(bookmarks->values());
|
qDeleteAll(*bookmarks);
|
||||||
delete bookmarks;
|
delete bookmarks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <coreplugin/inavigationwidgetfactory.h>
|
#include <coreplugin/inavigationwidgetfactory.h>
|
||||||
|
|
||||||
#include <QtCore/QAbstractItemModel>
|
#include <QtCore/QAbstractItemModel>
|
||||||
|
#include <QtCore/QMultiMap>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtGui/QListView>
|
#include <QtGui/QListView>
|
||||||
#include <QtGui/QPixmap>
|
#include <QtGui/QPixmap>
|
||||||
|
@@ -390,8 +390,8 @@ QList<IFile *> FileManager::saveModifiedFiles(const QList<IFile *> &files,
|
|||||||
|
|
||||||
// There can be several FileInterfaces pointing to the same file
|
// There can be several FileInterfaces pointing to the same file
|
||||||
// Select one that is not readonly.
|
// Select one that is not readonly.
|
||||||
if (!(modifiedFilesMap.values().contains(name)
|
if (!(modifiedFilesMap.key(name, 0)
|
||||||
&& file->isReadOnly()))
|
&& file->isReadOnly()))
|
||||||
modifiedFilesMap.insert(file, name);
|
modifiedFilesMap.insert(file, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -194,9 +194,10 @@ void ModeManager::addAction(Command *command, int priority, QMenu *menu)
|
|||||||
|
|
||||||
// Count the number of commands with a higher priority
|
// Count the number of commands with a higher priority
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach (int p, m_actions.values())
|
foreach (int p, m_actions) {
|
||||||
if (p > priority)
|
if (p > priority)
|
||||||
++index;
|
++index;
|
||||||
|
}
|
||||||
|
|
||||||
m_actionBar->insertAction(index, command->action(), menu);
|
m_actionBar->insertAction(index, command->action(), menu);
|
||||||
}
|
}
|
||||||
|
@@ -316,7 +316,7 @@ void ProgressManagerPrivate::taskFinished()
|
|||||||
m_runningTasks.remove(task);
|
m_runningTasks.remove(task);
|
||||||
delete task;
|
delete task;
|
||||||
|
|
||||||
if (!m_runningTasks.values().contains(type)) {
|
if (!m_runningTasks.key(type, 0)) {
|
||||||
emit allTasksFinished(type);
|
emit allTasksFinished(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,7 +68,7 @@ SideBar::SideBar(QList<SideBarItem*> itemList,
|
|||||||
|
|
||||||
SideBar::~SideBar()
|
SideBar::~SideBar()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_itemMap.values());
|
qDeleteAll(m_itemMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SideBar::availableItems() const
|
QStringList SideBar::availableItems() const
|
||||||
|
Reference in New Issue
Block a user