QT: Add ISO folder browser
This commit is contained in:
parent
629f45f1a5
commit
29a9c24b73
|
@ -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();
|
||||
|
|
|
@ -44,6 +44,7 @@ private slots:
|
|||
|
||||
// Main toolbar
|
||||
void OnOpen();
|
||||
void OnBrowse();
|
||||
void OnExit();
|
||||
void OnPlay();
|
||||
|
||||
|
@ -67,6 +68,7 @@ private:
|
|||
// Emulation
|
||||
QString RequestBootFilename();
|
||||
QString ShowFileDialog();
|
||||
QString ShowFolderDialog();
|
||||
void DoStartPause();
|
||||
bool Stop();
|
||||
|
||||
|
|
|
@ -40,6 +40,10 @@
|
|||
<string>Fi&le</string>
|
||||
</property>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionBrowse"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="mnuEmulation">
|
||||
<property name="title">
|
||||
|
@ -199,6 +203,16 @@
|
|||
<string>&Icon view</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBrowse">
|
||||
<property name="text">
|
||||
<string>&Browse for ISOs...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Reference in New Issue