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(this, SIGNAL(CoreStateChanged(Core::EState)), this, SLOT(OnCoreStateChanged(Core::EState)));
|
||||||
|
|
||||||
connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(OnOpen()));
|
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->actionExit, SIGNAL(triggered()), this, SLOT(OnExit()));
|
||||||
|
|
||||||
connect(m_ui->actionListView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged()));
|
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")));
|
.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()
|
void DMainWindow::DoStartPause()
|
||||||
{
|
{
|
||||||
if (Core::GetState() == Core::CORE_RUN)
|
if (Core::GetState() == Core::CORE_RUN)
|
||||||
|
@ -166,6 +174,23 @@ void DMainWindow::OnOpen()
|
||||||
StartGame(filename);
|
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()
|
void DMainWindow::OnExit()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
|
|
@ -44,6 +44,7 @@ private slots:
|
||||||
|
|
||||||
// Main toolbar
|
// Main toolbar
|
||||||
void OnOpen();
|
void OnOpen();
|
||||||
|
void OnBrowse();
|
||||||
void OnExit();
|
void OnExit();
|
||||||
void OnPlay();
|
void OnPlay();
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ private:
|
||||||
// Emulation
|
// Emulation
|
||||||
QString RequestBootFilename();
|
QString RequestBootFilename();
|
||||||
QString ShowFileDialog();
|
QString ShowFileDialog();
|
||||||
|
QString ShowFolderDialog();
|
||||||
void DoStartPause();
|
void DoStartPause();
|
||||||
bool Stop();
|
bool Stop();
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,10 @@
|
||||||
<string>Fi&le</string>
|
<string>Fi&le</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionOpen"/>
|
<addaction name="actionOpen"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionBrowse"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionExit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="mnuEmulation">
|
<widget class="QMenu" name="mnuEmulation">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -199,6 +203,16 @@
|
||||||
<string>&Icon view</string>
|
<string>&Icon view</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
Loading…
Reference in New Issue