mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-02 17:28:33 +00:00
QT: Add ISO folder browser
This commit is contained in:
parent
629f45f1a5
commit
29a9c24b73
3 changed files with 41 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue