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
cd14b9f1
Commit
cd14b9f1
authored
Apr 03, 2009
by
con
Browse files
Find dialog doesn't remember last selected scope.
Reviewed-by:
Daniel Molkentin
<
daniel.molkentin@nokia.com
>
parent
f442fd6e
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/plugins/find/findtoolwindow.cpp
View file @
cd14b9f1
...
...
@@ -40,14 +40,15 @@ using namespace Find::Internal;
FindToolWindow
::
FindToolWindow
(
FindPlugin
*
plugin
)
:
QDialog
(
Core
::
ICore
::
instance
()
->
mainWindow
()),
m_plugin
(
plugin
),
m_findCompleter
(
new
QCompleter
(
this
))
m_findCompleter
(
new
QCompleter
(
this
)),
m_currentFilter
(
0
)
{
m_ui
.
setupUi
(
this
);
connect
(
m_ui
.
closeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
reject
()));
connect
(
m_ui
.
searchButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
accept
()));
connect
(
m_ui
.
matchCase
,
SIGNAL
(
toggled
(
bool
)),
m_plugin
,
SLOT
(
setCaseSensitive
(
bool
)));
connect
(
m_ui
.
wholeWords
,
SIGNAL
(
toggled
(
bool
)),
m_plugin
,
SLOT
(
setWholeWord
(
bool
)));
connect
(
m_ui
.
filterList
,
SIGNAL
(
currentIndexChang
ed
(
int
)),
this
,
SLOT
(
setCurrentFilter
(
int
)));
connect
(
m_ui
.
filterList
,
SIGNAL
(
activat
ed
(
int
)),
this
,
SLOT
(
setCurrentFilter
(
int
)));
connect
(
this
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
search
()));
m_findCompleter
->
setModel
(
m_plugin
->
findCompletionModel
());
m_ui
.
searchTerm
->
setCompleter
(
m_findCompleter
);
...
...
@@ -74,6 +75,8 @@ void FindToolWindow::setFindFilters(const QList<IFindFilter *> &filters)
m_configWidgets
.
append
(
filter
->
createConfigWidget
());
}
m_ui
.
filterList
->
addItems
(
names
);
if
(
m_filters
.
size
()
>
0
)
setCurrentFilter
(
0
);
}
void
FindToolWindow
::
setFindText
(
const
QString
&
text
)
...
...
@@ -83,9 +86,11 @@ void FindToolWindow::setFindText(const QString &text)
void
FindToolWindow
::
open
(
IFindFilter
*
filter
)
{
if
(
!
filter
)
filter
=
m_currentFilter
;
int
index
=
m_filters
.
indexOf
(
filter
);
if
(
index
>=
0
)
{
m_ui
.
filterList
->
setCurrent
Index
(
index
);
setCurrent
Filter
(
index
);
}
m_ui
.
matchCase
->
setChecked
(
m_plugin
->
findFlags
()
&
QTextDocument
::
FindCaseSensitively
);
m_ui
.
wholeWords
->
setChecked
(
m_plugin
->
findFlags
()
&
QTextDocument
::
FindWholeWords
);
...
...
@@ -96,6 +101,7 @@ void FindToolWindow::open(IFindFilter *filter)
void
FindToolWindow
::
setCurrentFilter
(
int
index
)
{
m_ui
.
filterList
->
setCurrentIndex
(
index
);
for
(
int
i
=
0
;
i
<
m_configWidgets
.
size
();
++
i
)
{
QWidget
*
configWidget
=
m_configWidgets
.
at
(
i
);
if
(
!
configWidget
)
...
...
@@ -112,6 +118,7 @@ void FindToolWindow::setCurrentFilter(int index)
configWidget
->
setParent
(
0
);
}
}
m_currentFilter
=
m_filters
.
at
(
index
);
}
void
FindToolWindow
::
search
()
...
...
@@ -129,6 +136,7 @@ void FindToolWindow::writeSettings()
{
QSettings
*
settings
=
Core
::
ICore
::
instance
()
->
settings
();
settings
->
beginGroup
(
"Find"
);
settings
->
setValue
(
"CurrentFilter"
,
m_currentFilter
->
id
());
foreach
(
IFindFilter
*
filter
,
m_filters
)
filter
->
writeSettings
(
settings
);
settings
->
endGroup
();
...
...
@@ -138,7 +146,13 @@ void FindToolWindow::readSettings()
{
QSettings
*
settings
=
Core
::
ICore
::
instance
()
->
settings
();
settings
->
beginGroup
(
"Find"
);
foreach
(
IFindFilter
*
filter
,
m_filters
)
const
QString
currentFilter
=
settings
->
value
(
"CurrentFilter"
).
toString
();
for
(
int
i
=
0
;
i
<
m_filters
.
size
();
++
i
)
{
IFindFilter
*
filter
=
m_filters
.
at
(
i
);
filter
->
readSettings
(
settings
);
if
(
filter
->
id
()
==
currentFilter
)
{
setCurrentFilter
(
i
);
}
}
settings
->
endGroup
();
}
src/plugins/find/findtoolwindow.h
View file @
cd14b9f1
...
...
@@ -67,6 +67,7 @@ private:
QList
<
IFindFilter
*>
m_filters
;
QCompleter
*
m_findCompleter
;
QList
<
QWidget
*>
m_configWidgets
;
IFindFilter
*
m_currentFilter
;
};
}
// namespace Internal
...
...
src/plugins/find/ifindfilter.h
View file @
cd14b9f1
...
...
@@ -45,6 +45,7 @@ public:
virtual
~
IFindFilter
()
{}
virtual
QString
id
()
const
=
0
;
virtual
QString
name
()
const
=
0
;
virtual
bool
isEnabled
()
const
=
0
;
virtual
QKeySequence
defaultShortcut
()
const
=
0
;
...
...
src/plugins/projectexplorer/allprojectsfind.cpp
View file @
cd14b9f1
...
...
@@ -51,6 +51,11 @@ AllProjectsFind::AllProjectsFind(ProjectExplorerPlugin *plugin, SearchResultWind
connect
(
m_plugin
,
SIGNAL
(
fileListChanged
()),
this
,
SIGNAL
(
changed
()));
}
QString
AllProjectsFind
::
id
()
const
{
return
"All Projects"
;
}
QString
AllProjectsFind
::
name
()
const
{
return
tr
(
"All Projects"
);
...
...
src/plugins/projectexplorer/allprojectsfind.h
View file @
cd14b9f1
...
...
@@ -50,6 +50,7 @@ class AllProjectsFind : public TextEditor::BaseFileFind
public:
AllProjectsFind
(
ProjectExplorerPlugin
*
plugin
,
Find
::
SearchResultWindow
*
resultWindow
);
QString
id
()
const
;
QString
name
()
const
;
bool
isEnabled
()
const
;
...
...
src/plugins/projectexplorer/currentprojectfind.cpp
View file @
cd14b9f1
...
...
@@ -52,6 +52,11 @@ CurrentProjectFind::CurrentProjectFind(ProjectExplorerPlugin *plugin, SearchResu
this
,
SIGNAL
(
changed
()));
}
QString
CurrentProjectFind
::
id
()
const
{
return
"Current Project"
;
}
QString
CurrentProjectFind
::
name
()
const
{
return
tr
(
"Current Project"
);
...
...
src/plugins/projectexplorer/currentprojectfind.h
View file @
cd14b9f1
...
...
@@ -48,6 +48,7 @@ class CurrentProjectFind : public TextEditor::BaseFileFind
public:
CurrentProjectFind
(
ProjectExplorerPlugin
*
plugin
,
Find
::
SearchResultWindow
*
resultWindow
);
QString
id
()
const
;
QString
name
()
const
;
bool
isEnabled
()
const
;
...
...
src/plugins/texteditor/findinfiles.cpp
View file @
cd14b9f1
...
...
@@ -45,6 +45,11 @@ FindInFiles::FindInFiles(SearchResultWindow *resultWindow)
{
}
QString
FindInFiles
::
id
()
const
{
return
"Files on Disk"
;
}
QString
FindInFiles
::
name
()
const
{
return
tr
(
"Files on Disk"
);
...
...
src/plugins/texteditor/findinfiles.h
View file @
cd14b9f1
...
...
@@ -51,6 +51,7 @@ class FindInFiles : public BaseFileFind
public:
explicit
FindInFiles
(
Find
::
SearchResultWindow
*
resultWindow
);
QString
id
()
const
;
QString
name
()
const
;
QKeySequence
defaultShortcut
()
const
;
void
findAll
(
const
QString
&
txt
,
QTextDocument
::
FindFlags
findFlags
);
...
...
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