aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-06-28 00:08:57 -0700
committerChris Robinson <[email protected]>2013-06-28 00:08:57 -0700
commitf23a28e8f327ff14dc05d7c2c4fcb34a8262ca69 (patch)
treeb7a37d70da992e4d37055713b09268c21e6b54d7
parent314f9e2686c4b54e6c2ff50f13a655b3cc3202a8 (diff)
Disable HRTF remove button when no files selected
-rw-r--r--utils/alsoft-config/mainwindow.cpp7
-rw-r--r--utils/alsoft-config/mainwindow.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp
index f2db5c54..0047233f 100644
--- a/utils/alsoft-config/mainwindow.cpp
+++ b/utils/alsoft-config/mainwindow.cpp
@@ -96,6 +96,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->hrtfAddButton, SIGNAL(clicked()), this, SLOT(addHrtfFile()));
connect(ui->hrtfRemoveButton, SIGNAL(clicked()), this, SLOT(removeHrtfFile()));
+ connect(ui->hrtfFileList, SIGNAL(itemSelectionChanged()), this, SLOT(updateHrtfRemoveButton()));
ui->enabledBackendList->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->enabledBackendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showEnabledBackendMenu(QPoint)));
@@ -238,6 +239,7 @@ void MainWindow::loadConfig(const QString &fname)
hrtf_tables.begin(), std::mem_fun_ref(&QString::trimmed));
ui->hrtfFileList->clear();
ui->hrtfFileList->addItems(hrtf_tables);
+ updateHrtfRemoveButton();
ui->enabledBackendList->clear();
ui->disabledBackendList->clear();
@@ -495,6 +497,11 @@ void MainWindow::removeHrtfFile()
delete item;
}
+void MainWindow::updateHrtfRemoveButton()
+{
+ ui->hrtfRemoveButton->setEnabled(ui->hrtfFileList->selectedItems().size() != 0);
+}
+
void MainWindow::showEnabledBackendMenu(QPoint pt)
{
QMap<QAction*,QString> actionMap;
diff --git a/utils/alsoft-config/mainwindow.h b/utils/alsoft-config/mainwindow.h
index 28e109a2..0421aabb 100644
--- a/utils/alsoft-config/mainwindow.h
+++ b/utils/alsoft-config/mainwindow.h
@@ -30,6 +30,8 @@ private slots:
void addHrtfFile();
void removeHrtfFile();
+ void updateHrtfRemoveButton();
+
void showEnabledBackendMenu(QPoint pt);
void showDisabledBackendMenu(QPoint pt);