aboutsummaryrefslogtreecommitdiffstats
path: root/utils/alsoft-config/mainwindow.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-02-23 11:03:58 -0800
committerChris Robinson <[email protected]>2016-02-23 11:03:58 -0800
commitc9b2a0ae26aa60c26506901be97b209ca772d368 (patch)
treec1c9c211d3459ec80085556a1c6816e91e6b921f /utils/alsoft-config/mainwindow.cpp
parent68a2ae4024909a6ef785d702ffb90480aac6f0cc (diff)
Collect HRTF names from the paths list for alsoft-config
Diffstat (limited to 'utils/alsoft-config/mainwindow.cpp')
-rw-r--r--utils/alsoft-config/mainwindow.cpp41
1 files changed, 36 insertions, 5 deletions
diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp
index 382520af..498be083 100644
--- a/utils/alsoft-config/mainwindow.cpp
+++ b/utils/alsoft-config/mainwindow.cpp
@@ -346,13 +346,13 @@ void MainWindow::cancelCloseAction()
}
-QStringList MainWindow::collectDefaultHrtfs()
+QStringList MainWindow::collectHrtfs()
{
QStringList ret;
- QStringList paths = getAllDataPaths("/openal/hrtf");
- foreach(const QString &name, paths)
+
+ for(int i = 0;i < ui->hrtfFileList->count();i++)
{
- QDir dir(name);
+ QDir dir(ui->hrtfFileList->item(i)->text());
QStringList fnames = dir.entryList(QDir::Files | QDir::Readable);
foreach(const QString &fname, fnames)
{
@@ -376,6 +376,37 @@ QStringList MainWindow::collectDefaultHrtfs()
}
}
}
+
+ if(ui->defaultHrtfPathsCheckBox->isChecked())
+ {
+ QStringList paths = getAllDataPaths("/openal/hrtf");
+ foreach(const QString &name, paths)
+ {
+ QDir dir(name);
+ QStringList fnames = dir.entryList(QDir::Files | QDir::Readable);
+ foreach(const QString &fname, fnames)
+ {
+ if(fname.endsWith(".mhr", Qt::CaseInsensitive))
+ {
+ if(!ret.contains(fname))
+ ret.push_back(fname);
+ else
+ {
+ size_t i = 1;
+ do {
+ QString s = fname+" #"+QString::number(i);
+ if(!ret.contains(s))
+ {
+ ret.push_back(s);
+ break;
+ }
+ ++i;
+ } while(1);
+ }
+ }
+ }
+ }
+ }
return ret;
}
@@ -523,7 +554,7 @@ void MainWindow::loadConfig(const QString &fname)
ui->preferredHrtfComboBox->addItem("- Any -");
if(ui->defaultHrtfPathsCheckBox->isChecked())
{
- QStringList hrtfs = collectDefaultHrtfs();
+ QStringList hrtfs = collectHrtfs();
foreach(const QString &name, hrtfs)
ui->preferredHrtfComboBox->addItem(name);
}