summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2018-05-12 23:36:07 +0200
committerspycrab <spycrab@users.noreply.github.com>2018-05-15 20:13:12 +0200
commit79533ef789cfef405feaa5c6ecacc1dcd55a2f68 (patch)
tree3a50ec1d1ae317485b6ddd52995fb0e3fed429fb /Source
parent40e6abad09556933fbee0a0f96db7dfbd534e541 (diff)
Qt/PathPane: Disable "Remove" button when not applicable
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinQt2/Settings/PathPane.cpp13
-rw-r--r--Source/Core/DolphinQt2/Settings/PathPane.h3
2 files changed, 12 insertions, 4 deletions
diff --git a/Source/Core/DolphinQt2/Settings/PathPane.cpp b/Source/Core/DolphinQt2/Settings/PathPane.cpp
index 10b38f37bf..1097e6c501 100644
--- a/Source/Core/DolphinQt2/Settings/PathPane.cpp
+++ b/Source/Core/DolphinQt2/Settings/PathPane.cpp
@@ -120,19 +120,24 @@ QGroupBox* PathPane::MakeGameFolderBox()
for (auto& item : items)
delete item;
});
+ connect(m_path_list, &QListWidget::itemSelectionChanged, this,
+ [this] { m_remove_path->setEnabled(m_path_list->selectedItems().count()); });
+
vlayout->addWidget(m_path_list);
QHBoxLayout* hlayout = new QHBoxLayout;
hlayout->addStretch();
- QPushButton* add = new QPushButton(tr("Add"));
- QPushButton* remove = new QPushButton(tr("Remove"));
+ QPushButton* add = new QPushButton(tr("Add..."));
+ m_remove_path = new QPushButton(tr("Remove"));
+
+ m_remove_path->setEnabled(false);
auto* checkbox = new QCheckBox(tr("Search Subfolders"));
checkbox->setChecked(SConfig::GetInstance().m_RecursiveISOFolder);
hlayout->addWidget(add);
- hlayout->addWidget(remove);
+ hlayout->addWidget(m_remove_path);
vlayout->addLayout(hlayout);
vlayout->addWidget(checkbox);
@@ -143,7 +148,7 @@ QGroupBox* PathPane::MakeGameFolderBox()
});
connect(add, &QPushButton::clicked, this, &PathPane::Browse);
- connect(remove, &QPushButton::clicked, this, &PathPane::RemovePath);
+ connect(m_remove_path, &QPushButton::clicked, this, &PathPane::RemovePath);
game_box->setLayout(vlayout);
return game_box;
diff --git a/Source/Core/DolphinQt2/Settings/PathPane.h b/Source/Core/DolphinQt2/Settings/PathPane.h
index 47bec7f31e..d53d973410 100644
--- a/Source/Core/DolphinQt2/Settings/PathPane.h
+++ b/Source/Core/DolphinQt2/Settings/PathPane.h
@@ -10,6 +10,7 @@ class QGridLayout;
class QGroupBox;
class QLineEdit;
class QListWidget;
+class QPushButton;
class PathPane final : public QWidget
{
@@ -35,4 +36,6 @@ private:
QLineEdit* m_nand_edit;
QLineEdit* m_dump_edit;
QLineEdit* m_sdcard_edit;
+
+ QPushButton* m_remove_path;
};