Skip to content

Commit

Permalink
Qt/PathPane: Disable "Remove" button when not applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
spycrab committed May 15, 2018
1 parent 40e6aba commit 79533ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Source/Core/DolphinQt2/Settings/PathPane.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -120,19 +120,24 @@ QGroupBox* PathPane::MakeGameFolderBox()
for (auto& item : items) for (auto& item : items)
delete item; delete item;
}); });
connect(m_path_list, &QListWidget::itemSelectionChanged, this,
[this] { m_remove_path->setEnabled(m_path_list->selectedItems().count()); });

vlayout->addWidget(m_path_list); vlayout->addWidget(m_path_list);


QHBoxLayout* hlayout = new QHBoxLayout; QHBoxLayout* hlayout = new QHBoxLayout;


hlayout->addStretch(); hlayout->addStretch();
QPushButton* add = new QPushButton(tr("Add")); QPushButton* add = new QPushButton(tr("Add..."));
QPushButton* remove = new QPushButton(tr("Remove")); m_remove_path = new QPushButton(tr("Remove"));

m_remove_path->setEnabled(false);


auto* checkbox = new QCheckBox(tr("Search Subfolders")); auto* checkbox = new QCheckBox(tr("Search Subfolders"));
checkbox->setChecked(SConfig::GetInstance().m_RecursiveISOFolder); checkbox->setChecked(SConfig::GetInstance().m_RecursiveISOFolder);


hlayout->addWidget(add); hlayout->addWidget(add);
hlayout->addWidget(remove); hlayout->addWidget(m_remove_path);
vlayout->addLayout(hlayout); vlayout->addLayout(hlayout);
vlayout->addWidget(checkbox); vlayout->addWidget(checkbox);


Expand All @@ -143,7 +148,7 @@ QGroupBox* PathPane::MakeGameFolderBox()
}); });


connect(add, &QPushButton::clicked, this, &PathPane::Browse); 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); game_box->setLayout(vlayout);
return game_box; return game_box;
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/DolphinQt2/Settings/PathPane.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class QGridLayout;
class QGroupBox; class QGroupBox;
class QLineEdit; class QLineEdit;
class QListWidget; class QListWidget;
class QPushButton;


class PathPane final : public QWidget class PathPane final : public QWidget
{ {
Expand All @@ -35,4 +36,6 @@ class PathPane final : public QWidget
QLineEdit* m_nand_edit; QLineEdit* m_nand_edit;
QLineEdit* m_dump_edit; QLineEdit* m_dump_edit;
QLineEdit* m_sdcard_edit; QLineEdit* m_sdcard_edit;

QPushButton* m_remove_path;
}; };

0 comments on commit 79533ef

Please sign in to comment.