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
@@ -33,6 +33,7 @@
|
||||
#include "filesselectionwizardpage.h"
|
||||
|
||||
#include "genericprojectwizard.h"
|
||||
#include "genericprojectconstants.h"
|
||||
#include "selectablefilesmodel.h"
|
||||
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
@@ -56,7 +57,9 @@ FilesSelectionWizardPage::FilesSelectionWizardPage(GenericProjectWizardDialog *g
|
||||
hbox->addWidget(m_filterLabel);
|
||||
m_filterLineEdit = new QLineEdit;
|
||||
|
||||
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);
|
||||
@@ -140,5 +143,7 @@ QStringList FilesSelectionWizardPage::selectedFiles() const
|
||||
|
||||
void FilesSelectionWizardPage::applyFilter()
|
||||
{
|
||||
m_model->applyFilter(m_filterLineEdit->text());
|
||||
const QString filter = m_filterLineEdit->text();
|
||||
Core::ICore::settings()->setValue(Constants::FILEFILTER_SETTING, filter);
|
||||
m_model->applyFilter(filter);
|
||||
}
|
||||
|
@@ -56,6 +56,9 @@ const char *const GENERICPROJECT_ID = "GenericProjectManager.GenericProject";
|
||||
|
||||
const char *const EDITFILESACTION = "GenericProjectManager.EditFiles";
|
||||
|
||||
const char *const FILEFILTER_SETTING = "GenericProject/FileFilter";
|
||||
const char *const FILEFILTER_DEFAULT = "Makefile*; *.o; *.obj; *~; *.files; *.config; *.creator; *.user; *.includes";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace GenericProjectManager
|
||||
|
||||
|
@@ -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