mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
Qt: Hook up 'Add Game List Directory' function
This commit is contained in:
parent
98eb71aa3f
commit
0200b9ffc1
|
@ -232,9 +232,9 @@ void GameListSettingsWidget::onDirectoryListItemClicked(const QModelIndex& index
|
||||||
m_search_directories_model->setEntryRecursive(row, !m_search_directories_model->isEntryRecursive(row));
|
m_search_directories_model->setEntryRecursive(row, !m_search_directories_model->isEntryRecursive(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListSettingsWidget::onAddSearchDirectoryButtonPressed()
|
void GameListSettingsWidget::addSearchDirectory(QWidget* parent_widget)
|
||||||
{
|
{
|
||||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Search Directory"));
|
QString dir = QFileDialog::getExistingDirectory(parent_widget, tr("Select Search Directory"));
|
||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -251,6 +251,11 @@ void GameListSettingsWidget::onAddSearchDirectoryButtonPressed()
|
||||||
m_search_directories_model->addEntry(dir, recursive);
|
m_search_directories_model->addEntry(dir, recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameListSettingsWidget::onAddSearchDirectoryButtonPressed()
|
||||||
|
{
|
||||||
|
addSearchDirectory(this);
|
||||||
|
}
|
||||||
|
|
||||||
void GameListSettingsWidget::onRemoveSearchDirectoryButtonPressed()
|
void GameListSettingsWidget::onRemoveSearchDirectoryButtonPressed()
|
||||||
{
|
{
|
||||||
QModelIndexList selection = m_ui.searchDirectoryList->selectionModel()->selectedIndexes();
|
QModelIndexList selection = m_ui.searchDirectoryList->selectionModel()->selectedIndexes();
|
||||||
|
|
|
@ -16,6 +16,9 @@ public:
|
||||||
GameListSettingsWidget(QtHostInterface* host_interface, QWidget* parent = nullptr);
|
GameListSettingsWidget(QtHostInterface* host_interface, QWidget* parent = nullptr);
|
||||||
~GameListSettingsWidget();
|
~GameListSettingsWidget();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void addSearchDirectory(QWidget* parent_widget);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onDirectoryListItemClicked(const QModelIndex& index);
|
void onDirectoryListItemClicked(const QModelIndex& index);
|
||||||
void onAddSearchDirectoryButtonPressed();
|
void onAddSearchDirectoryButtonPressed();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "core/game_list.h"
|
#include "core/game_list.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
|
#include "gamelistsettingswidget.h"
|
||||||
#include "gamelistwidget.h"
|
#include "gamelistwidget.h"
|
||||||
#include "qthostinterface.h"
|
#include "qthostinterface.h"
|
||||||
#include "qtsettingsinterface.h"
|
#include "qtsettingsinterface.h"
|
||||||
|
@ -160,8 +161,6 @@ void MainWindow::onStartBiosActionTriggered()
|
||||||
m_host_interface->bootSystem(QString(), QString());
|
m_host_interface->bootSystem(QString(), QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onOpenDirectoryActionTriggered() {}
|
|
||||||
|
|
||||||
void MainWindow::onExitActionTriggered() {}
|
void MainWindow::onExitActionTriggered() {}
|
||||||
|
|
||||||
void MainWindow::onGitHubRepositoryActionTriggered() {}
|
void MainWindow::onGitHubRepositoryActionTriggered() {}
|
||||||
|
@ -213,7 +212,6 @@ void MainWindow::updateEmulationActions(bool starting, bool running)
|
||||||
{
|
{
|
||||||
m_ui.actionStartDisc->setDisabled(starting || running);
|
m_ui.actionStartDisc->setDisabled(starting || running);
|
||||||
m_ui.actionStartBios->setDisabled(starting || running);
|
m_ui.actionStartBios->setDisabled(starting || running);
|
||||||
m_ui.actionOpenDirectory->setDisabled(starting || running);
|
|
||||||
m_ui.actionPowerOff->setDisabled(starting || running);
|
m_ui.actionPowerOff->setDisabled(starting || running);
|
||||||
|
|
||||||
m_ui.actionPowerOff->setDisabled(starting || !running);
|
m_ui.actionPowerOff->setDisabled(starting || !running);
|
||||||
|
@ -271,7 +269,8 @@ void MainWindow::connectSignals()
|
||||||
connect(m_ui.actionChangeDiscFromFile, &QAction::triggered, this, &MainWindow::onChangeDiscFromFileActionTriggered);
|
connect(m_ui.actionChangeDiscFromFile, &QAction::triggered, this, &MainWindow::onChangeDiscFromFileActionTriggered);
|
||||||
connect(m_ui.actionChangeDiscFromGameList, &QAction::triggered, this,
|
connect(m_ui.actionChangeDiscFromGameList, &QAction::triggered, this,
|
||||||
&MainWindow::onChangeDiscFromGameListActionTriggered);
|
&MainWindow::onChangeDiscFromGameListActionTriggered);
|
||||||
connect(m_ui.actionOpenDirectory, &QAction::triggered, this, &MainWindow::onOpenDirectoryActionTriggered);
|
connect(m_ui.actionAddGameDirectory, &QAction::triggered,
|
||||||
|
[this]() { getSettingsDialog()->getGameListSettingsWidget()->addSearchDirectory(this); });
|
||||||
connect(m_ui.actionPowerOff, &QAction::triggered, m_host_interface, &QtHostInterface::powerOffSystem);
|
connect(m_ui.actionPowerOff, &QAction::triggered, m_host_interface, &QtHostInterface::powerOffSystem);
|
||||||
connect(m_ui.actionReset, &QAction::triggered, m_host_interface, &QtHostInterface::resetSystem);
|
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.actionPause, &QAction::toggled, m_host_interface, &QtHostInterface::pauseSystem);
|
||||||
|
@ -333,19 +332,25 @@ void MainWindow::connectSignals()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::doSettings(SettingsDialog::Category category)
|
SettingsDialog* MainWindow::getSettingsDialog()
|
||||||
{
|
{
|
||||||
if (!m_settings_dialog)
|
if (!m_settings_dialog)
|
||||||
m_settings_dialog = new SettingsDialog(m_host_interface, this);
|
m_settings_dialog = new SettingsDialog(m_host_interface, this);
|
||||||
|
|
||||||
if (!m_settings_dialog->isVisible())
|
return m_settings_dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::doSettings(SettingsDialog::Category category)
|
||||||
|
{
|
||||||
|
SettingsDialog* dlg = getSettingsDialog();
|
||||||
|
if (!dlg->isVisible())
|
||||||
{
|
{
|
||||||
m_settings_dialog->setModal(false);
|
dlg->setModal(false);
|
||||||
m_settings_dialog->show();
|
dlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (category != SettingsDialog::Category::Count)
|
if (category != SettingsDialog::Category::Count)
|
||||||
m_settings_dialog->setCategory(category);
|
dlg->setCategory(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateDebugMenuGPURenderer()
|
void MainWindow::updateDebugMenuGPURenderer()
|
||||||
|
|
|
@ -35,7 +35,6 @@ private Q_SLOTS:
|
||||||
void onChangeDiscFromFileActionTriggered();
|
void onChangeDiscFromFileActionTriggered();
|
||||||
void onChangeDiscFromGameListActionTriggered();
|
void onChangeDiscFromGameListActionTriggered();
|
||||||
void onStartBiosActionTriggered();
|
void onStartBiosActionTriggered();
|
||||||
void onOpenDirectoryActionTriggered();
|
|
||||||
void onExitActionTriggered();
|
void onExitActionTriggered();
|
||||||
void onGitHubRepositoryActionTriggered();
|
void onGitHubRepositoryActionTriggered();
|
||||||
void onIssueTrackerActionTriggered();
|
void onIssueTrackerActionTriggered();
|
||||||
|
@ -47,6 +46,7 @@ private:
|
||||||
void updateEmulationActions(bool starting, bool running);
|
void updateEmulationActions(bool starting, bool running);
|
||||||
void switchToGameListView();
|
void switchToGameListView();
|
||||||
void switchToEmulationView();
|
void switchToEmulationView();
|
||||||
|
SettingsDialog* getSettingsDialog();
|
||||||
void doSettings(SettingsDialog::Category category = SettingsDialog::Category::Count);
|
void doSettings(SettingsDialog::Category category = SettingsDialog::Category::Count);
|
||||||
void updateDebugMenuGPURenderer();
|
void updateDebugMenuGPURenderer();
|
||||||
void populateLoadSaveStateMenus(QString game_code);
|
void populateLoadSaveStateMenus(QString game_code);
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
<addaction name="actionGPUSettings"/>
|
<addaction name="actionGPUSettings"/>
|
||||||
<addaction name="actionAudioSettings"/>
|
<addaction name="actionAudioSettings"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionOpenDirectory"/>
|
<addaction name="actionAddGameDirectory"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuHelp">
|
<widget class="QMenu" name="menuHelp">
|
||||||
|
@ -150,7 +150,6 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<addaction name="actionStartDisc"/>
|
<addaction name="actionStartDisc"/>
|
||||||
<addaction name="actionStartBios"/>
|
<addaction name="actionStartBios"/>
|
||||||
<addaction name="actionOpenDirectory"/>
|
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionPowerOff"/>
|
<addaction name="actionPowerOff"/>
|
||||||
<addaction name="actionReset"/>
|
<addaction name="actionReset"/>
|
||||||
|
@ -351,13 +350,13 @@
|
||||||
<string>Game List Settings...</string>
|
<string>Game List Settings...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionOpenDirectory">
|
<action name="actionAddGameDirectory">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources/icons.qrc">
|
<iconset resource="resources/icons.qrc">
|
||||||
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
|
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Open Directory...</string>
|
<string>Add Game Directory...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSettings">
|
<action name="actionSettings">
|
||||||
|
|
|
@ -30,6 +30,13 @@ public:
|
||||||
SettingsDialog(QtHostInterface* host_interface, QWidget* parent = nullptr);
|
SettingsDialog(QtHostInterface* host_interface, QWidget* parent = nullptr);
|
||||||
~SettingsDialog();
|
~SettingsDialog();
|
||||||
|
|
||||||
|
ConsoleSettingsWidget* getConsoleSettingsWidget() const { return m_console_settings; }
|
||||||
|
GameListSettingsWidget* getGameListSettingsWidget() const { return m_game_list_settings; }
|
||||||
|
HotkeySettingsWidget* getHotkeySettingsWidget() const { return m_hotkey_settings; }
|
||||||
|
PortSettingsWidget* getPortSettingsWidget() const { return m_port_settings; }
|
||||||
|
GPUSettingsWidget* getGPUSettingsWidget() const { return m_gpu_settings; }
|
||||||
|
QWidget* getAudioSettingsWidget() const { return m_audio_settings; }
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setCategory(Category category);
|
void setCategory(Category category);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue