Qt: Add separate menu items for rescan all/scan for new games

This commit is contained in:
Connor McLaughlin 2020-06-11 01:48:54 +10:00
parent 34d27bad4a
commit 2504d187d3
5 changed files with 44 additions and 12 deletions

View File

@ -218,8 +218,8 @@ GameListSettingsWidget::GameListSettingsWidget(QtHostInterface* host_interface,
&GameListSettingsWidget::onAddSearchDirectoryButtonPressed);
connect(m_ui.removeSearchDirectoryButton, &QToolButton::pressed, this,
&GameListSettingsWidget::onRemoveSearchDirectoryButtonPressed);
connect(m_ui.refreshGameListButton, &QToolButton::pressed, this,
&GameListSettingsWidget::onRefreshGameListButtonPressed);
connect(m_ui.rescanAllGames, &QToolButton::pressed, this, &GameListSettingsWidget::onRescanAllGamesPressed);
connect(m_ui.scanForNewGames, &QToolButton::pressed, this, &GameListSettingsWidget::onScanForNewGamesPressed);
connect(m_ui.updateRedumpDatabase, &QToolButton::pressed, this,
&GameListSettingsWidget::onUpdateRedumpDatabaseButtonPressed);
}
@ -280,9 +280,14 @@ void GameListSettingsWidget::onRemoveSearchDirectoryButtonPressed()
m_search_directories_model->removeEntry(row);
}
void GameListSettingsWidget::onRefreshGameListButtonPressed()
void GameListSettingsWidget::onRescanAllGamesPressed()
{
m_host_interface->refreshGameList(true);
m_host_interface->refreshGameList(true, false);
}
void GameListSettingsWidget::onScanForNewGamesPressed()
{
m_host_interface->refreshGameList(false, false);
}
void GameListSettingsWidget::onUpdateRedumpDatabaseButtonPressed()

View File

@ -23,7 +23,8 @@ private Q_SLOTS:
void onDirectoryListItemClicked(const QModelIndex& index);
void onAddSearchDirectoryButtonPressed();
void onRemoveSearchDirectoryButtonPressed();
void onRefreshGameListButtonPressed();
void onScanForNewGamesPressed();
void onRescanAllGamesPressed();
void onUpdateRedumpDatabaseButtonPressed();
protected:

View File

@ -82,9 +82,23 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="refreshGameListButton">
<widget class="QToolButton" name="scanForNewGames">
<property name="text">
<string>Refresh</string>
<string>Scan New</string>
</property>
<property name="icon">
<iconset resource="resources/icons.qrc">
<normaloff>:/icons/folder-open.png</normaloff>:/icons/folder-open.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="rescanAllGames">
<property name="text">
<string>Rescan All</string>
</property>
<property name="icon">
<iconset resource="resources/icons.qrc">

View File

@ -10,10 +10,10 @@
#include "qthostdisplay.h"
#include "qthostinterface.h"
#include "qtsettingsinterface.h"
#include "qtutils.h"
#include "scmversion/scmversion.h"
#include "settingsdialog.h"
#include "settingwidgetbinder.h"
#include "qtutils.h"
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>
#include <QtCore/QUrl>
@ -524,8 +524,10 @@ void MainWindow::connectSignals()
connect(m_ui.actionReset, &QAction::triggered, m_host_interface, &QtHostInterface::resetSystem);
connect(m_ui.actionPause, &QAction::toggled, m_host_interface, &QtHostInterface::pauseSystem);
connect(m_ui.actionScreenshot, &QAction::triggered, m_host_interface, &QtHostInterface::saveScreenshot);
connect(m_ui.actionRefreshGameList, &QAction::triggered, this,
connect(m_ui.actionScanForNewGames, &QAction::triggered, this,
[this]() { m_host_interface->refreshGameList(false, false); });
connect(m_ui.actionRescanAllGames, &QAction::triggered, this,
[this]() { m_host_interface->refreshGameList(true, false); });
connect(m_ui.actionLoadState, &QAction::triggered, this, [this]() { m_ui.menuLoadState->exec(QCursor::pos()); });
connect(m_ui.actionSaveState, &QAction::triggered, this, [this]() { m_ui.menuSaveState->exec(QCursor::pos()); });
connect(m_ui.actionExit, &QAction::triggered, this, &MainWindow::close);

View File

@ -98,7 +98,8 @@
<addaction name="actionAdvancedSettings"/>
<addaction name="separator"/>
<addaction name="actionAddGameDirectory"/>
<addaction name="actionRefreshGameList"/>
<addaction name="actionScanForNewGames"/>
<addaction name="actionRescanAllGames"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuHelp">
@ -197,13 +198,22 @@
<string>Start &amp;BIOS</string>
</property>
</action>
<action name="actionRefreshGameList">
<action name="actionScanForNewGames">
<property name="icon">
<iconset resource="resources/icons.qrc">
<normaloff>:/icons/folder-open.png</normaloff>:/icons/folder-open.png</iconset>
</property>
<property name="text">
<string>&amp;Refresh Game List</string>
<string>&amp;Scan For New Games</string>
</property>
</action>
<action name="actionRescanAllGames">
<property name="icon">
<iconset resource="resources/icons.qrc">
<normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset>
</property>
<property name="text">
<string>&amp;Rescan All Games</string>
</property>
</action>
<action name="actionPowerOff">