From f23a28e8f327ff14dc05d7c2c4fcb34a8262ca69 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 28 Jun 2013 00:08:57 -0700 Subject: [PATCH] Disable HRTF remove button when no files selected --- utils/alsoft-config/mainwindow.cpp | 7 +++++++ utils/alsoft-config/mainwindow.h | 2 ++ 2 files changed, 9 insertions(+) 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 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);