aboutsummaryrefslogtreecommitdiffstats
path: root/utils/alsoft-config
diff options
context:
space:
mode:
Diffstat (limited to 'utils/alsoft-config')
-rw-r--r--utils/alsoft-config/mainwindow.cpp41
-rw-r--r--utils/alsoft-config/mainwindow.h2
2 files changed, 37 insertions, 6 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);
}
diff --git a/utils/alsoft-config/mainwindow.h b/utils/alsoft-config/mainwindow.h
index 66b4c650..69c2fda4 100644
--- a/utils/alsoft-config/mainwindow.h
+++ b/utils/alsoft-config/mainwindow.h
@@ -55,7 +55,7 @@ private:
void closeEvent(QCloseEvent *event);
- QStringList collectDefaultHrtfs();
+ QStringList collectHrtfs();
void loadConfig(const QString &fname);
void saveConfig(const QString &fname) const;