mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
QT: Add ISO folder browser
This commit is contained in:
@ -57,6 +57,7 @@ DMainWindow::DMainWindow(QWidget* parent_widget)
|
||||
connect(this, SIGNAL(CoreStateChanged(Core::EState)), this, SLOT(OnCoreStateChanged(Core::EState)));
|
||||
|
||||
connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(OnOpen()));
|
||||
connect(m_ui->actionBrowse, SIGNAL(triggered()), this, SLOT(OnBrowse()));
|
||||
connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(OnExit()));
|
||||
|
||||
connect(m_ui->actionListView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged()));
|
||||
@ -143,6 +144,13 @@ QString DMainWindow::ShowFileDialog()
|
||||
.arg(SL("*.gcm *.iso *.ciso *.gcz *.wbfs *.elf *.dol *.dff *.tmd *.wad")));
|
||||
}
|
||||
|
||||
QString DMainWindow::ShowFolderDialog()
|
||||
{
|
||||
return QFileDialog::getExistingDirectory(this, tr("Browse for a directory to add"),
|
||||
QDir::homePath(),
|
||||
QFileDialog::ShowDirsOnly);
|
||||
}
|
||||
|
||||
void DMainWindow::DoStartPause()
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
@ -166,6 +174,23 @@ void DMainWindow::OnOpen()
|
||||
StartGame(filename);
|
||||
}
|
||||
|
||||
void DMainWindow::OnBrowse()
|
||||
{
|
||||
std::string path = ShowFolderDialog().toStdString();
|
||||
std::vector<std::string>& iso_folder = SConfig::GetInstance().m_ISOFolder;
|
||||
if (!path.empty())
|
||||
{
|
||||
auto itResult = std::find(iso_folder.begin(), iso_folder.end(), path);
|
||||
|
||||
if (itResult == iso_folder.end())
|
||||
{
|
||||
iso_folder.push_back(path);
|
||||
SConfig::GetInstance().SaveSettings();
|
||||
}
|
||||
}
|
||||
m_game_tracker->ScanForGames();
|
||||
}
|
||||
|
||||
void DMainWindow::OnExit()
|
||||
{
|
||||
close();
|
||||
|
Reference in New Issue
Block a user