Fixed #7063 (GUI: better extensions filtering)

Make filtering case insensitive to let check *.C, *.CPP, etc files.
Show in file open dialog only files that could be checked.
This commit is contained in:
Aleksandr Pikalev 2015-10-18 18:19:05 +03:00 committed by PKEuS
parent c0191b25ac
commit e1342435ca
3 changed files with 6 additions and 4 deletions

View File

@ -35,7 +35,7 @@ bool FileList::FilterMatches(const QFileInfo &inf)
const QStringList filters = FileList::GetDefaultFilters();
QString ext("*.");
ext += inf.suffix();
if (filters.contains(ext))
if (filters.contains(ext, Qt::CaseInsensitive))
return true;
}
return false;

View File

@ -68,14 +68,14 @@ public:
*/
void AddExcludeList(const QStringList &paths);
protected:
/**
* @brief Return list of default filename extensions included.
* @return list of default filename extensions included.
*/
static QStringList GetDefaultFilters();
protected:
/**
* @brief Test if filename matches the filename extensions filtering.
* @return true if filename matches filtering.

View File

@ -435,9 +435,11 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
// QFileDialog::getExistingDirectory() because they show native Windows
// selection dialog which is a lot more usable than Qt:s own dialog.
if (mode == QFileDialog::ExistingFiles) {
selected = QFileDialog::getOpenFileNames(this,
tr("Select files to check"),
GetPath(SETTINGS_LAST_CHECK_PATH));
GetPath(SETTINGS_LAST_CHECK_PATH),
tr("C/C++ Source (%1)").arg(FileList::GetDefaultFilters().join(" ")));
if (selected.isEmpty())
mCurrentDirectory.clear();
else {