forked from qt-creator/qt-creator
Generic Project: improve filtering.
- When applying filter, always show items which were already in project. - Store the filter string in settings. Change-Id: I5b726ed0bde49d8ac48d4f2f4589b194fc557a95 Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
committed by
Daniel Teske
parent
ccc55a6149
commit
a0605523ae
@@ -31,8 +31,10 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "selectablefilesmodel.h"
|
||||
#include "genericprojectconstants.h"
|
||||
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/QtConcurrentTools>
|
||||
#include <QHBoxLayout>
|
||||
@@ -119,6 +121,8 @@ bool SelectableFilesModel::filter(Tree *t)
|
||||
{
|
||||
if (t->isDir)
|
||||
return false;
|
||||
if (m_files.contains(t->fullPath))
|
||||
return false;
|
||||
foreach (const Glob &g, m_filter) {
|
||||
if (g.mode == Glob::EXACT) {
|
||||
if (g.matchString == t->name)
|
||||
@@ -521,7 +525,9 @@ SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringL
|
||||
hbox->addWidget(m_filterLabel);
|
||||
m_filterLineEdit = new QLineEdit(this);
|
||||
|
||||
m_filterLineEdit->setText("Makefile*; *.o; *.obj; *~; *.files; *.config; *.creator; *.user; *.includes");
|
||||
const QString filter = Core::ICore::settings()->value(Constants::FILEFILTER_SETTING,
|
||||
Constants::FILEFILTER_DEFAULT).toString();
|
||||
m_filterLineEdit->setText(filter);
|
||||
m_filterLineEdit->hide();
|
||||
hbox->addWidget(m_filterLineEdit);
|
||||
m_applyFilterButton = new QPushButton(tr("Apply Filter"), this);
|
||||
@@ -611,5 +617,7 @@ QStringList SelectableFilesDialog::selectedFiles() const
|
||||
|
||||
void SelectableFilesDialog::applyFilter()
|
||||
{
|
||||
m_selectableFilesModel->applyFilter(m_filterLineEdit->text());
|
||||
const QString filter = m_filterLineEdit->text();
|
||||
Core::ICore::settings()->setValue(Constants::FILEFILTER_SETTING, filter);
|
||||
m_selectableFilesModel->applyFilter(filter);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user