Skip to content
Snippets Groups Projects
Commit ff652f0a authored by Francois Ferrand's avatar Francois Ferrand Committed by Daniel Teske
Browse files

Generic Project: Better filtering of supported files.


In the edit files dialog and project wizard, initial filtering of files
was done by checking the file suffix in mime database. This does not
work for all files (e.g. makefiles), and is not needed: filtering is
done afterwards using a user-editable filter string.

Change-Id: I0664aa5b3c52b663d6d94020df4e1986dd7c69a5
Reviewed-by: Thorbjørn Lindeijer
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 46a6e9e9
No related branches found
No related tags found
No related merge requests found
......@@ -84,9 +84,7 @@ void FilesSelectionWizardPage::initializePage()
{
m_view->setModel(0);
delete m_model;
Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase();
m_model = new SelectableFilesModel(m_genericProjectWizardDialog->path(), this);
m_model->setSuffixes(mimeDatabase->suffixes().toSet());
connect(m_model, SIGNAL(parsingProgress(QString)),
this, SLOT(parsingProgress(QString)));
connect(m_model, SIGNAL(parsingFinished()),
......
......@@ -122,10 +122,8 @@ void GenericProjectPlugin::updateContextMenu(ProjectExplorer::Project *project,
void GenericProjectPlugin::editFiles()
{
GenericProject *genericProject = static_cast<GenericProject *>(m_contextMenuProject);
Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase();
SelectableFilesDialog sfd(QFileInfo(genericProject->document()->fileName()).path(), genericProject->files(),
mimeDatabase->suffixes().toSet(), Core::ICore::mainWindow());
Core::ICore::mainWindow());
if (sfd.exec() == QDialog::Accepted) {
genericProject->setFiles(sfd.selectedFiles());
}
......
......@@ -69,11 +69,6 @@ void SelectableFilesModel::setInitialMarkedFiles(const QStringList &files)
m_allFiles = false;
}
void SelectableFilesModel::setSuffixes(QSet<QString> suffixes)
{
m_suffixes = suffixes;
}
void SelectableFilesModel::init()
{
}
......@@ -164,7 +159,7 @@ void SelectableFilesModel::buildTree(const QString &baseDir, Tree *tree, QFuture
allChecked &= t->checked == Qt::Checked;
allUnchecked &= t->checked == Qt::Unchecked;
tree->childDirectories.append(t);
} else if (m_suffixes.contains(fileInfo.suffix())) {
} else {
Tree *t = new Tree;
t->parent = tree;
t->name = fileInfo.fileName();
......@@ -509,7 +504,7 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
// SelectableFilesDialog
//////////
SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringList files, const QSet<QString> &suffixes, QWidget *parent)
SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringList files, QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *layout = new QVBoxLayout();
......@@ -537,7 +532,6 @@ SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringL
m_selectableFilesModel = new SelectableFilesModel(path, this);
m_selectableFilesModel->setInitialMarkedFiles(files);
m_selectableFilesModel->setSuffixes(suffixes);
m_view->setModel(m_selectableFilesModel);
m_view->setMinimumSize(500, 400);
m_view->setHeaderHidden(true);
......
......@@ -74,7 +74,6 @@ public:
SelectableFilesModel(const QString &baseDir, QObject *parent);
~SelectableFilesModel();
void setSuffixes(QSet<QString> suffixes);
void setInitialMarkedFiles(const QStringList &files);
int columnCount(const QModelIndex &parent) const;
......@@ -117,7 +116,6 @@ private:
QString m_baseDir;
QSet<QString> m_files;
QStringList m_outOfBaseDirFiles;
QSet<QString> m_suffixes;
QFutureWatcher<void> m_watcher;
Tree *m_rootForFuture;
int m_futureCount;
......@@ -129,7 +127,7 @@ class SelectableFilesDialog : public QDialog
{
Q_OBJECT
public:
SelectableFilesDialog(const QString &path, const QStringList files, const QSet<QString> &suffixes, QWidget *parent);
SelectableFilesDialog(const QString &path, const QStringList files, QWidget *parent);
~SelectableFilesDialog();
QStringList selectedFiles() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment