Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
d6c37e1e
Commit
d6c37e1e
authored
Nov 04, 2009
by
con
Browse files
Disable the find usage and symbol renaming while indexing is done.
Reviewed-by: Roberto Raggi
parent
00298ab2
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/progressmanager/progressmanager.cpp
View file @
d6c37e1e
...
...
@@ -57,17 +57,22 @@ void ProgressManagerPrivate::init()
void
ProgressManagerPrivate
::
cancelTasks
(
const
QString
&
type
)
{
bool
found
=
false
;
QMap
<
QFutureWatcher
<
void
>
*
,
QString
>::
iterator
task
=
m_runningTasks
.
begin
();
while
(
task
!=
m_runningTasks
.
end
())
{
if
(
task
.
value
()
!=
type
)
{
++
task
;
continue
;
}
found
=
true
;
disconnect
(
task
.
key
(),
SIGNAL
(
finished
()),
this
,
SLOT
(
taskFinished
()));
task
.
key
()
->
cancel
();
delete
task
.
key
();
task
=
m_runningTasks
.
erase
(
task
);
}
if
(
found
)
{
emit
allTasksFinished
(
type
);
}
}
void
ProgressManagerPrivate
::
cancelAllRunningTasks
()
...
...
@@ -88,6 +93,7 @@ FutureProgress *ProgressManagerPrivate::addTask(const QFuture<void> &future, con
m_runningTasks
.
insert
(
watcher
,
type
);
connect
(
watcher
,
SIGNAL
(
finished
()),
this
,
SLOT
(
taskFinished
()));
watcher
->
setFuture
(
future
);
emit
taskStarted
(
type
);
return
m_progressView
->
addTask
(
future
,
title
,
type
,
persistency
);
}
...
...
@@ -101,6 +107,11 @@ void ProgressManagerPrivate::taskFinished()
QObject
*
taskObject
=
sender
();
QTC_ASSERT
(
taskObject
,
return
);
QFutureWatcher
<
void
>
*
task
=
static_cast
<
QFutureWatcher
<
void
>
*>
(
taskObject
);
QString
type
=
m_runningTasks
.
value
(
task
);
m_runningTasks
.
remove
(
task
);
delete
task
;
if
(
!
m_runningTasks
.
values
().
contains
(
type
))
{
emit
allTasksFinished
(
type
);
}
}
src/plugins/coreplugin/progressmanager/progressmanager.h
View file @
d6c37e1e
...
...
@@ -51,6 +51,10 @@ public:
public
slots
:
virtual
void
cancelTasks
(
const
QString
&
type
)
=
0
;
signals:
void
taskStarted
(
const
QString
&
type
);
void
allTasksFinished
(
const
QString
&
type
);
};
}
// namespace Core
...
...
src/plugins/cppeditor/cppplugin.cpp
View file @
d6c37e1e
...
...
@@ -43,6 +43,7 @@
#include
<coreplugin/actionmanager/actionmanager.h>
#include
<coreplugin/actionmanager/command.h>
#include
<coreplugin/editormanager/editormanager.h>
#include
<coreplugin/progressmanager/progressmanager.h>
#include
<texteditor/completionsupport.h>
#include
<texteditor/fontsettings.h>
#include
<texteditor/storagesettings.h>
...
...
@@ -55,7 +56,6 @@
#include
<QtCore/QFileInfo>
#include
<QtCore/QSettings>
#include
<QtGui/QMenu>
#include
<QtGui/QAction>
using
namespace
CppEditor
::
Internal
;
...
...
@@ -211,18 +211,18 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
contextMenu
->
addAction
(
cmd
);
am
->
actionContainer
(
CppTools
::
Constants
::
M_TOOLS_CPP
)
->
addAction
(
cmd
);
QAction
*
findUsagesAction
=
new
QAction
(
tr
(
"Find Usages"
),
this
);
cmd
=
am
->
registerAction
(
findUsagesAction
,
Constants
::
FIND_USAGES
,
context
);
m_
findUsagesAction
=
new
QAction
(
tr
(
"Find Usages"
),
this
);
cmd
=
am
->
registerAction
(
m_
findUsagesAction
,
Constants
::
FIND_USAGES
,
context
);
cmd
->
setDefaultKeySequence
(
QKeySequence
(
tr
(
"Ctrl+Shift+U"
)));
connect
(
findUsagesAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
findUsages
()));
connect
(
m_
findUsagesAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
findUsages
()));
contextMenu
->
addAction
(
cmd
);
am
->
actionContainer
(
CppTools
::
Constants
::
M_TOOLS_CPP
)
->
addAction
(
cmd
);
QAction
*
renameSymbolUnderCursorAction
=
new
QAction
(
tr
(
"Rename Symbol under Cursor"
),
this
);
cmd
=
am
->
registerAction
(
renameSymbolUnderCursorAction
,
m_
renameSymbolUnderCursorAction
=
new
QAction
(
tr
(
"Rename Symbol under Cursor"
),
this
);
cmd
=
am
->
registerAction
(
m_
renameSymbolUnderCursorAction
,
Constants
::
RENAME_SYMBOL_UNDER_CURSOR
,
context
);
cmd
->
setDefaultKeySequence
(
QKeySequence
(
"CTRL+SHIFT+R"
));
connect
(
renameSymbolUnderCursorAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
renameSymbolUnderCursor
()));
connect
(
m_
renameSymbolUnderCursorAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
renameSymbolUnderCursor
()));
contextMenu
->
addAction
(
cmd
);
am
->
actionContainer
(
CppTools
::
Constants
::
M_TOOLS_CPP
)
->
addAction
(
cmd
);
...
...
@@ -244,7 +244,10 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
cmd
=
am
->
command
(
TextEditor
::
Constants
::
UN_COMMENT_SELECTION
);
contextMenu
->
addAction
(
cmd
);
connect
(
core
->
progressManager
(),
SIGNAL
(
taskStarted
(
QString
)),
this
,
SLOT
(
onTaskStarted
(
QString
)));
connect
(
core
->
progressManager
(),
SIGNAL
(
allTasksFinished
(
QString
)),
this
,
SLOT
(
onAllTasksFinished
(
QString
)));
readSettings
();
return
true
;
}
...
...
@@ -300,4 +303,20 @@ void CppPlugin::findUsages()
editor
->
findUsages
();
}
void
CppPlugin
::
onTaskStarted
(
const
QString
&
type
)
{
if
(
type
==
CppTools
::
Constants
::
TASK_INDEX
)
{
m_renameSymbolUnderCursorAction
->
setEnabled
(
false
);
m_findUsagesAction
->
setEnabled
(
false
);
}
}
void
CppPlugin
::
onAllTasksFinished
(
const
QString
&
type
)
{
if
(
type
==
CppTools
::
Constants
::
TASK_INDEX
)
{
m_renameSymbolUnderCursorAction
->
setEnabled
(
true
);
m_findUsagesAction
->
setEnabled
(
true
);
}
}
Q_EXPORT_PLUGIN
(
CppPlugin
)
src/plugins/cppeditor/cppplugin.h
View file @
d6c37e1e
...
...
@@ -30,12 +30,13 @@
#ifndef CPPPLUGIN_H
#define CPPPLUGIN_H
#include
<QtCore/QtPlugin>
#include
<QtCore/QStringList>
#include
<extensionsystem/iplugin.h>
#include
<coreplugin/editormanager/ieditorfactory.h>
#include
<QtCore/QtPlugin>
#include
<QtCore/QStringList>
#include
<QtGui/QAction>
namespace
TextEditor
{
class
TextEditorActionHandler
;
}
// namespace TextEditor
...
...
@@ -74,6 +75,8 @@ private slots:
void
switchDeclarationDefinition
();
void
jumpToDefinition
();
void
renameSymbolUnderCursor
();
void
onTaskStarted
(
const
QString
&
type
);
void
onAllTasksFinished
(
const
QString
&
type
);
void
findUsages
();
private:
...
...
@@ -85,6 +88,8 @@ private:
TextEditor
::
TextEditorActionHandler
*
m_actionHandler
;
bool
m_sortedMethodOverview
;
QAction
*
m_renameSymbolUnderCursorAction
;
QAction
*
m_findUsagesAction
;
};
class
CppEditorFactory
:
public
Core
::
IEditorFactory
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment