Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
4ae66199
Commit
4ae66199
authored
Jun 29, 2010
by
con
Browse files
Make it possible to assign shortcut to "Expand All".
Task-number: QTCREATORBUG-1438
parent
2a480324
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/find/searchresultwindow.cpp
View file @
4ae66199
...
...
@@ -35,6 +35,10 @@
#include <aggregation/aggregate.h>
#include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icontext.h>
#include <utils/qtcassert.h>
#include <QtCore/QFile>
...
...
@@ -47,6 +51,7 @@
#include <QtGui/QStackedWidget>
#include <QtGui/QLabel>
#include <QtGui/QFont>
#include <QtGui/QAction>
static
const
char
SETTINGSKEYSECTIONNAME
[]
=
"SearchResults"
;
static
const
char
SETTINGSKEYEXPANDRESULTS
[]
=
"ExpandResults"
;
...
...
@@ -183,7 +188,8 @@ namespace Internal {
Internal
::
SearchResultTreeView
*
m_searchResultTreeView
;
QListWidget
*
m_noMatchesFoundDisplay
;
QToolButton
*
m_expandCollapseToolButton
;
QToolButton
*
m_expandCollapseButton
;
QAction
*
m_expandCollapseAction
;
QLabel
*
m_replaceLabel
;
QLineEdit
*
m_replaceTextEdit
;
QToolButton
*
m_replaceButton
;
...
...
@@ -223,11 +229,16 @@ SearchResultWindow::SearchResultWindow() : d(new SearchResultWindowPrivate)
d
->
m_noMatchesFoundDisplay
->
setFrameStyle
(
QFrame
::
NoFrame
);
d
->
m_widget
->
addWidget
(
d
->
m_noMatchesFoundDisplay
);
d
->
m_expandCollapseToolButton
=
new
QToolButton
(
d
->
m_widget
);
d
->
m_expandCollapseToolButton
->
setAutoRaise
(
true
);
d
->
m_expandCollapseToolButton
->
setCheckable
(
true
);
d
->
m_expandCollapseToolButton
->
setIcon
(
QIcon
(
QLatin1String
(
":/find/images/expand.png"
)));
d
->
m_expandCollapseToolButton
->
setToolTip
(
tr
(
"Expand All"
));
d
->
m_expandCollapseButton
=
new
QToolButton
(
d
->
m_widget
);
d
->
m_expandCollapseButton
->
setAutoRaise
(
true
);
d
->
m_expandCollapseAction
=
new
QAction
(
tr
(
"Expand All"
),
this
);
d
->
m_expandCollapseAction
->
setCheckable
(
true
);
d
->
m_expandCollapseAction
->
setIcon
(
QIcon
(
QLatin1String
(
":/find/images/expand.png"
)));
Core
::
Command
*
cmd
=
Core
::
ICore
::
instance
()
->
actionManager
()
->
registerAction
(
d
->
m_expandCollapseAction
,
QLatin1String
(
"Find.ExpandAll"
),
Core
::
Context
(
Core
::
Constants
::
C_GLOBAL
));
d
->
m_expandCollapseButton
->
setDefaultAction
(
cmd
->
action
());
d
->
m_replaceLabel
=
new
QLabel
(
tr
(
"Replace with:"
),
d
->
m_widget
);
d
->
m_replaceLabel
->
setContentsMargins
(
12
,
0
,
5
,
0
);
...
...
@@ -241,7 +252,7 @@ SearchResultWindow::SearchResultWindow() : d(new SearchResultWindowPrivate)
connect
(
d
->
m_searchResultTreeView
,
SIGNAL
(
jumpToSearchResult
(
int
,
bool
)),
this
,
SLOT
(
handleJumpToSearchResult
(
int
,
bool
)));
connect
(
d
->
m_expandCollapse
ToolButt
on
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
handleExpandCollapseToolButton
(
bool
)));
connect
(
d
->
m_expandCollapse
Acti
on
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
handleExpandCollapseToolButton
(
bool
)));
connect
(
d
->
m_replaceTextEdit
,
SIGNAL
(
returnPressed
()),
this
,
SLOT
(
handleReplaceButton
()));
connect
(
d
->
m_replaceButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
handleReplaceButton
()));
...
...
@@ -318,7 +329,7 @@ QWidget *SearchResultWindow::outputWidget(QWidget *)
QList
<
QWidget
*>
SearchResultWindow
::
toolBarWidgets
()
const
{
return
QList
<
QWidget
*>
()
<<
d
->
m_expandCollapse
Tool
Button
<<
d
->
m_replaceLabel
<<
d
->
m_replaceTextEdit
<<
d
->
m_replaceButton
;
return
QList
<
QWidget
*>
()
<<
d
->
m_expandCollapseButton
<<
d
->
m_replaceLabel
<<
d
->
m_replaceTextEdit
<<
d
->
m_replaceButton
;
}
SearchResult
*
SearchResultWindow
::
startNewSearch
(
SearchMode
searchOrSearchAndReplace
)
...
...
@@ -455,7 +466,7 @@ void SearchResultWindow::readSettings()
QSettings
*
s
=
Core
::
ICore
::
instance
()
->
settings
();
if
(
s
)
{
s
->
beginGroup
(
QLatin1String
(
SETTINGSKEYSECTIONNAME
));
d
->
m_expandCollapse
ToolButt
on
->
setChecked
(
s
->
value
(
QLatin1String
(
SETTINGSKEYEXPANDRESULTS
),
d
->
m_initiallyExpand
).
toBool
());
d
->
m_expandCollapse
Acti
on
->
setChecked
(
s
->
value
(
QLatin1String
(
SETTINGSKEYEXPANDRESULTS
),
d
->
m_initiallyExpand
).
toBool
());
s
->
endGroup
();
}
}
...
...
@@ -465,7 +476,7 @@ void SearchResultWindow::writeSettings()
QSettings
*
s
=
Core
::
ICore
::
instance
()
->
settings
();
if
(
s
)
{
s
->
beginGroup
(
QLatin1String
(
SETTINGSKEYSECTIONNAME
));
s
->
setValue
(
QLatin1String
(
SETTINGSKEYEXPANDRESULTS
),
d
->
m_expandCollapse
ToolButt
on
->
isChecked
());
s
->
setValue
(
QLatin1String
(
SETTINGSKEYEXPANDRESULTS
),
d
->
m_expandCollapse
Acti
on
->
isChecked
());
s
->
endGroup
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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