Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flatpak-qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Bubke
flatpak-qt-creator
Commits
ecab2093
Commit
ecab2093
authored
16 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Patches
Plain Diff
Wait the future values.
parent
c395680e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/cpptools/cppmodelmanager.cpp
+13
-1
13 additions, 1 deletion
src/plugins/cpptools/cppmodelmanager.cpp
src/plugins/cpptools/cppmodelmanager.h
+3
-0
3 additions, 0 deletions
src/plugins/cpptools/cppmodelmanager.h
with
16 additions
and
1 deletion
src/plugins/cpptools/cppmodelmanager.cpp
+
13
−
1
View file @
ecab2093
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include
<functional>
#include
<functional>
#include
<QtConcurrentRun>
#include
<QtConcurrentRun>
#include
<QFutureSynchronizer>
#include
<qtconcurrent/runextensions.h>
#include
<qtconcurrent/runextensions.h>
#include
<texteditor/itexteditor.h>
#include
<texteditor/itexteditor.h>
...
@@ -163,6 +164,7 @@ class CppPreprocessor: public CPlusPlus::Client
...
@@ -163,6 +164,7 @@ class CppPreprocessor: public CPlusPlus::Client
{
{
public:
public:
CppPreprocessor
(
QPointer
<
CppModelManager
>
modelManager
);
CppPreprocessor
(
QPointer
<
CppModelManager
>
modelManager
);
virtual
~
CppPreprocessor
();
void
setWorkingCopy
(
const
QMap
<
QString
,
QByteArray
>
&
workingCopy
);
void
setWorkingCopy
(
const
QMap
<
QString
,
QByteArray
>
&
workingCopy
);
void
setIncludePaths
(
const
QStringList
&
includePaths
);
void
setIncludePaths
(
const
QStringList
&
includePaths
);
...
@@ -212,6 +214,7 @@ private:
...
@@ -212,6 +214,7 @@ private:
Document
::
Ptr
m_currentDoc
;
Document
::
Ptr
m_currentDoc
;
QSet
<
QString
>
m_todo
;
QSet
<
QString
>
m_todo
;
QSet
<
QString
>
m_processed
;
QSet
<
QString
>
m_processed
;
QFutureSynchronizer
<
void
>
m_synchronizer
;
};
};
}
// namespace Internal
}
// namespace Internal
...
@@ -221,6 +224,11 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
...
@@ -221,6 +224,11 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
:
snapshot
(
modelManager
->
snapshot
()),
:
snapshot
(
modelManager
->
snapshot
()),
m_modelManager
(
modelManager
),
m_modelManager
(
modelManager
),
preprocess
(
this
,
&
env
)
preprocess
(
this
,
&
env
)
{
m_synchronizer
.
setCancelOnWait
(
true
);
}
CppPreprocessor
::~
CppPreprocessor
()
{
}
{
}
void
CppPreprocessor
::
setWorkingCopy
(
const
QMap
<
QString
,
QByteArray
>
&
workingCopy
)
void
CppPreprocessor
::
setWorkingCopy
(
const
QMap
<
QString
,
QByteArray
>
&
workingCopy
)
...
@@ -502,7 +510,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
...
@@ -502,7 +510,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
snapshot
.
insert
(
doc
->
fileName
(),
doc
);
snapshot
.
insert
(
doc
->
fileName
(),
doc
);
m_todo
.
remove
(
fileName
);
m_todo
.
remove
(
fileName
);
QtConcurrent
::
run
(
Process
(
m_modelManager
),
doc
);
m_synchronizer
.
addFuture
(
QtConcurrent
::
run
(
Process
(
m_modelManager
),
doc
)
)
;
(
void
)
switchDocument
(
previousDoc
);
(
void
)
switchDocument
(
previousDoc
);
}
}
...
@@ -528,6 +536,8 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
...
@@ -528,6 +536,8 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
CppModelManager
::
CppModelManager
(
QObject
*
parent
)
CppModelManager
::
CppModelManager
(
QObject
*
parent
)
:
CppModelManagerInterface
(
parent
)
:
CppModelManagerInterface
(
parent
)
{
{
m_synchronizer
.
setCancelOnWait
(
true
);
m_core
=
Core
::
ICore
::
instance
();
// FIXME
m_core
=
Core
::
ICore
::
instance
();
// FIXME
m_dirty
=
true
;
m_dirty
=
true
;
...
@@ -702,6 +712,8 @@ QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles
...
@@ -702,6 +712,8 @@ QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles
QFuture
<
void
>
result
=
QtConcurrent
::
run
(
&
CppModelManager
::
parse
,
QFuture
<
void
>
result
=
QtConcurrent
::
run
(
&
CppModelManager
::
parse
,
preproc
,
sourceFiles
);
preproc
,
sourceFiles
);
m_synchronizer
.
addFuture
(
result
);
if
(
sourceFiles
.
count
()
>
1
)
{
if
(
sourceFiles
.
count
()
>
1
)
{
m_core
->
progressManager
()
->
addTask
(
result
,
tr
(
"Indexing"
),
m_core
->
progressManager
()
->
addTask
(
result
,
tr
(
"Indexing"
),
CppTools
::
Constants
::
TASK_INDEX
,
CppTools
::
Constants
::
TASK_INDEX
,
...
...
This diff is collapsed.
Click to expand it.
src/plugins/cpptools/cppmodelmanager.h
+
3
−
0
View file @
ecab2093
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include
<QMap>
#include
<QMap>
#include
<QFutureInterface>
#include
<QFutureInterface>
#include
<QFutureSynchronizer>
#include
<QMutex>
#include
<QMutex>
#include
<QTimer>
#include
<QTimer>
#include
<QTextEdit>
#include
<QTextEdit>
...
@@ -174,6 +175,8 @@ private:
...
@@ -174,6 +175,8 @@ private:
QList
<
Editor
>
m_todo
;
QList
<
Editor
>
m_todo
;
QTimer
*
m_updateEditorSelectionsTimer
;
QTimer
*
m_updateEditorSelectionsTimer
;
QFutureSynchronizer
<
void
>
m_synchronizer
;
};
};
}
// namespace Internal
}
// namespace Internal
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment