forked from qt-creator/qt-creator
Better values for the progress bar.
This commit is contained in:
@@ -169,11 +169,16 @@ public:
|
|||||||
void setIncludePaths(const QStringList &includePaths);
|
void setIncludePaths(const QStringList &includePaths);
|
||||||
void setFrameworkPaths(const QStringList &frameworkPaths);
|
void setFrameworkPaths(const QStringList &frameworkPaths);
|
||||||
void setProjectFiles(const QStringList &files);
|
void setProjectFiles(const QStringList &files);
|
||||||
|
void setTodo(const QStringList &files);
|
||||||
|
|
||||||
void run(QString &fileName);
|
void run(QString &fileName);
|
||||||
void operator()(QString &fileName);
|
void operator()(QString &fileName);
|
||||||
|
|
||||||
void resetEnvironment();
|
void resetEnvironment();
|
||||||
|
|
||||||
|
const QSet<QString> &todo() const
|
||||||
|
{ return m_todo; }
|
||||||
|
|
||||||
public: // attributes
|
public: // attributes
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
|
|
||||||
@@ -207,6 +212,7 @@ private:
|
|||||||
QStringList m_frameworkPaths;
|
QStringList m_frameworkPaths;
|
||||||
QSet<QString> m_included;
|
QSet<QString> m_included;
|
||||||
CPlusPlus::Document::Ptr m_currentDoc;
|
CPlusPlus::Document::Ptr m_currentDoc;
|
||||||
|
QSet<QString> m_todo;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
@@ -230,6 +236,9 @@ void CppPreprocessor::setFrameworkPaths(const QStringList &frameworkPaths)
|
|||||||
void CppPreprocessor::setProjectFiles(const QStringList &files)
|
void CppPreprocessor::setProjectFiles(const QStringList &files)
|
||||||
{ m_projectFiles = files; }
|
{ m_projectFiles = files; }
|
||||||
|
|
||||||
|
void CppPreprocessor::setTodo(const QStringList &files)
|
||||||
|
{ m_todo = QSet<QString>::fromList(files); }
|
||||||
|
|
||||||
void CppPreprocessor::run(QString &fileName)
|
void CppPreprocessor::run(QString &fileName)
|
||||||
{ sourceNeeded(fileName, IncludeGlobal, /*line = */ 0); }
|
{ sourceNeeded(fileName, IncludeGlobal, /*line = */ 0); }
|
||||||
|
|
||||||
@@ -447,6 +456,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
|
|||||||
m_currentDoc->addDiagnosticMessage(d);
|
m_currentDoc->addDiagnosticMessage(d);
|
||||||
|
|
||||||
//qWarning() << "file not found:" << fileName << m_currentDoc->fileName() << env.current_line;
|
//qWarning() << "file not found:" << fileName << m_currentDoc->fileName() << env.current_line;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,6 +493,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
|
|||||||
m_modelManager->emitDocumentUpdated(m_currentDoc); // ### TODO: compress
|
m_modelManager->emitDocumentUpdated(m_currentDoc); // ### TODO: compress
|
||||||
|
|
||||||
(void) switchDocument(previousDoc);
|
(void) switchDocument(previousDoc);
|
||||||
|
m_todo.remove(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
|
Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
|
||||||
@@ -904,6 +915,8 @@ void CppModelManager::parse(QFutureInterface<void> &future,
|
|||||||
files = sources;
|
files = sources;
|
||||||
files += headers;
|
files += headers;
|
||||||
|
|
||||||
|
preproc->setTodo(files);
|
||||||
|
|
||||||
// Change the priority of the background parser thread to idle.
|
// Change the priority of the background parser thread to idle.
|
||||||
QThread::currentThread()->setPriority(QThread::IdlePriority);
|
QThread::currentThread()->setPriority(QThread::IdlePriority);
|
||||||
|
|
||||||
@@ -921,8 +934,6 @@ void CppModelManager::parse(QFutureInterface<void> &future,
|
|||||||
if (future.isCanceled())
|
if (future.isCanceled())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
future.setProgressValue(i);
|
|
||||||
|
|
||||||
#ifdef CPPTOOLS_DEBUG_PARSING_TIME
|
#ifdef CPPTOOLS_DEBUG_PARSING_TIME
|
||||||
QTime tm;
|
QTime tm;
|
||||||
tm.start();
|
tm.start();
|
||||||
@@ -945,6 +956,8 @@ void CppModelManager::parse(QFutureInterface<void> &future,
|
|||||||
|
|
||||||
preproc->run(fileName);
|
preproc->run(fileName);
|
||||||
|
|
||||||
|
future.setProgressValue(files.size() - preproc->todo().size());
|
||||||
|
|
||||||
if (isSourceFile)
|
if (isSourceFile)
|
||||||
preproc->resetEnvironment();
|
preproc->resetEnvironment();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user