mirror of https://github.com/PCSX2/pcsx2.git
Qt: Fix remove game directory button being enabled w/o selection
This commit is contained in:
parent
1881139b0a
commit
7bc5427908
|
@ -40,7 +40,7 @@
|
|||
|
||||
static std::recursive_mutex s_exception_handler_mutex;
|
||||
static bool s_in_exception_handler = false;
|
||||
static bool s_exception_handler_installed = true;
|
||||
static bool s_exception_handler_installed = false;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <mach/task.h>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
static std::recursive_mutex s_exception_handler_mutex;
|
||||
static bool s_in_exception_handler = false;
|
||||
static bool s_exception_handler_installed = true;
|
||||
static bool s_exception_handler_installed = false;
|
||||
|
||||
long __stdcall SysPageFaultExceptionFilter(EXCEPTION_POINTERS* eps)
|
||||
{
|
||||
|
|
|
@ -40,16 +40,14 @@ GameListSettingsWidget::GameListSettingsWidget(SettingsWindow* dialog, QWidget*
|
|||
m_ui.searchDirectoryList->setCurrentIndex({});
|
||||
m_ui.searchDirectoryList->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
|
||||
|
||||
connect(m_ui.searchDirectoryList, &QTableWidget::customContextMenuRequested, this,
|
||||
&GameListSettingsWidget::onDirectoryListContextMenuRequested);
|
||||
connect(m_ui.addSearchDirectoryButton, &QPushButton::clicked, this,
|
||||
&GameListSettingsWidget::onAddSearchDirectoryButtonClicked);
|
||||
connect(m_ui.removeSearchDirectoryButton, &QPushButton::clicked, this,
|
||||
&GameListSettingsWidget::onRemoveSearchDirectoryButtonClicked);
|
||||
connect(m_ui.searchDirectoryList, &QTableWidget::customContextMenuRequested, this, &GameListSettingsWidget::onDirectoryListContextMenuRequested);
|
||||
connect(m_ui.searchDirectoryList, &QTableWidget::itemSelectionChanged, this, &GameListSettingsWidget::onDirectoryListSelectionChanged);
|
||||
connect(m_ui.addSearchDirectoryButton, &QPushButton::clicked, this, &GameListSettingsWidget::onAddSearchDirectoryButtonClicked);
|
||||
connect(m_ui.removeSearchDirectoryButton, &QPushButton::clicked, this, &GameListSettingsWidget::onRemoveSearchDirectoryButtonClicked);
|
||||
connect(m_ui.addExcludedFile, &QPushButton::clicked, this, &GameListSettingsWidget::onAddExcludedFileButtonClicked);
|
||||
connect(m_ui.addExcludedPath, &QPushButton::clicked, this, &GameListSettingsWidget::onAddExcludedPathButtonClicked);
|
||||
connect(m_ui.removeExcludedPath, &QPushButton::clicked, this,
|
||||
&GameListSettingsWidget::onRemoveExcludedPathButtonClicked);
|
||||
connect(m_ui.removeExcludedPath, &QPushButton::clicked, this, &GameListSettingsWidget::onRemoveExcludedPathButtonClicked);
|
||||
connect(m_ui.excludedPaths, &QListWidget::itemSelectionChanged, this, &GameListSettingsWidget::onExcludedPathsSelectionChanged);
|
||||
connect(m_ui.rescanAllGames, &QPushButton::clicked, this, &GameListSettingsWidget::onRescanAllGamesClicked);
|
||||
connect(m_ui.scanForNewGames, &QPushButton::clicked, this, &GameListSettingsWidget::onScanForNewGamesClicked);
|
||||
|
||||
|
@ -77,6 +75,8 @@ void GameListSettingsWidget::refreshExclusionList()
|
|||
const std::vector<std::string> paths(Host::GetBaseStringListSetting("GameList", "ExcludedPaths"));
|
||||
for (const std::string& path : paths)
|
||||
m_ui.excludedPaths->addItem(QString::fromStdString(path));
|
||||
|
||||
m_ui.removeExcludedPath->setEnabled(false);
|
||||
}
|
||||
|
||||
bool GameListSettingsWidget::event(QEvent* event)
|
||||
|
@ -142,6 +142,8 @@ void GameListSettingsWidget::refreshDirectoryList()
|
|||
addPathToTable(entry, true);
|
||||
|
||||
m_ui.searchDirectoryList->sortByColumn(0, Qt::AscendingOrder);
|
||||
|
||||
m_ui.removeSearchDirectoryButton->setEnabled(false);
|
||||
}
|
||||
|
||||
void GameListSettingsWidget::addSearchDirectory(const QString& path, bool recursive)
|
||||
|
@ -185,6 +187,11 @@ void GameListSettingsWidget::onDirectoryListContextMenuRequested(const QPoint& p
|
|||
menu.exec(m_ui.searchDirectoryList->mapToGlobal(point));
|
||||
}
|
||||
|
||||
void GameListSettingsWidget::onDirectoryListSelectionChanged()
|
||||
{
|
||||
m_ui.removeSearchDirectoryButton->setEnabled(m_ui.searchDirectoryList->selectionModel()->hasSelection());
|
||||
}
|
||||
|
||||
void GameListSettingsWidget::addSearchDirectory(QWidget* parent_widget)
|
||||
{
|
||||
QString dir =
|
||||
|
@ -258,6 +265,11 @@ void GameListSettingsWidget::onRemoveExcludedPathButtonClicked()
|
|||
g_main_window->refreshGameList(false);
|
||||
}
|
||||
|
||||
void GameListSettingsWidget::onExcludedPathsSelectionChanged()
|
||||
{
|
||||
m_ui.removeExcludedPath->setEnabled(!m_ui.excludedPaths->selectedItems().isEmpty());
|
||||
}
|
||||
|
||||
void GameListSettingsWidget::onRescanAllGamesClicked()
|
||||
{
|
||||
g_main_window->refreshGameList(true);
|
||||
|
|
|
@ -28,11 +28,13 @@ public Q_SLOTS:
|
|||
|
||||
private Q_SLOTS:
|
||||
void onDirectoryListContextMenuRequested(const QPoint& point);
|
||||
void onDirectoryListSelectionChanged();
|
||||
void onAddSearchDirectoryButtonClicked();
|
||||
void onRemoveSearchDirectoryButtonClicked();
|
||||
void onAddExcludedFileButtonClicked();
|
||||
void onAddExcludedPathButtonClicked();
|
||||
void onRemoveExcludedPathButtonClicked();
|
||||
void onExcludedPathsSelectionChanged();
|
||||
void onScanForNewGamesClicked();
|
||||
void onRescanAllGamesClicked();
|
||||
|
||||
|
|
|
@ -237,12 +237,10 @@ void SetupWizardDialog::setupGameListPage()
|
|||
m_ui.searchDirectoryList->setCurrentIndex({});
|
||||
m_ui.searchDirectoryList->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
|
||||
|
||||
connect(m_ui.searchDirectoryList, &QTableWidget::customContextMenuRequested, this,
|
||||
&SetupWizardDialog::onDirectoryListContextMenuRequested);
|
||||
connect(m_ui.addSearchDirectoryButton, &QPushButton::clicked, this,
|
||||
&SetupWizardDialog::onAddSearchDirectoryButtonClicked);
|
||||
connect(m_ui.removeSearchDirectoryButton, &QPushButton::clicked, this,
|
||||
&SetupWizardDialog::onRemoveSearchDirectoryButtonClicked);
|
||||
connect(m_ui.searchDirectoryList, &QTableWidget::customContextMenuRequested, this, &SetupWizardDialog::onDirectoryListContextMenuRequested);
|
||||
connect(m_ui.searchDirectoryList, &QTableWidget::itemSelectionChanged, this, &SetupWizardDialog::onDirectoryListSelectionChanged);
|
||||
connect(m_ui.addSearchDirectoryButton, &QPushButton::clicked, this, &SetupWizardDialog::onAddSearchDirectoryButtonClicked);
|
||||
connect(m_ui.removeSearchDirectoryButton, &QPushButton::clicked, this, &SetupWizardDialog::onRemoveSearchDirectoryButtonClicked);
|
||||
|
||||
refreshDirectoryList();
|
||||
}
|
||||
|
@ -263,6 +261,11 @@ void SetupWizardDialog::onDirectoryListContextMenuRequested(const QPoint& point)
|
|||
menu.exec(m_ui.searchDirectoryList->mapToGlobal(point));
|
||||
}
|
||||
|
||||
void SetupWizardDialog::onDirectoryListSelectionChanged()
|
||||
{
|
||||
m_ui.removeSearchDirectoryButton->setEnabled(!m_ui.searchDirectoryList->selectedItems().isEmpty());
|
||||
}
|
||||
|
||||
void SetupWizardDialog::onAddSearchDirectoryButtonClicked()
|
||||
{
|
||||
QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, tr("Select Search Directory")));
|
||||
|
@ -349,6 +352,7 @@ void SetupWizardDialog::refreshDirectoryList()
|
|||
addPathToTable(entry, true);
|
||||
|
||||
m_ui.searchDirectoryList->sortByColumn(0, Qt::AscendingOrder);
|
||||
m_ui.removeSearchDirectoryButton->setEnabled(false);
|
||||
}
|
||||
|
||||
void SetupWizardDialog::resizeDirectoryListColumns()
|
||||
|
|
|
@ -33,6 +33,7 @@ private Q_SLOTS:
|
|||
void biosListItemChanged(const QTreeWidgetItem* current, const QTreeWidgetItem* previous);
|
||||
|
||||
void onDirectoryListContextMenuRequested(const QPoint& point);
|
||||
void onDirectoryListSelectionChanged();
|
||||
void onAddSearchDirectoryButtonClicked();
|
||||
void onRemoveSearchDirectoryButtonClicked();
|
||||
void refreshDirectoryList();
|
||||
|
|
Loading…
Reference in New Issue