Qt/PathPane: Various fixes
This commit is contained in:
parent
0cd46f4d21
commit
fcb80646ed
|
@ -11,6 +11,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
|
||||||
#include "DolphinQt2/Settings.h"
|
#include "DolphinQt2/Settings.h"
|
||||||
|
@ -38,52 +39,72 @@ void PathPane::Browse()
|
||||||
|
|
||||||
void PathPane::BrowseDefaultGame()
|
void PathPane::BrowseDefaultGame()
|
||||||
{
|
{
|
||||||
|
auto& default_iso = SConfig::GetInstance().m_strDefaultISO;
|
||||||
|
|
||||||
QString file = QFileDialog::getOpenFileName(
|
QString file = QFileDialog::getOpenFileName(
|
||||||
this, tr("Select a Game"), QDir::currentPath(),
|
this, tr("Select a Game"), QString::fromStdString(default_iso),
|
||||||
tr("All GC/Wii files (*.elf *.dol *.gcm *.iso *.tgc *.wbfs *.ciso *.gcz *.wad);;"
|
tr("All GC/Wii files (*.elf *.dol *.gcm *.iso *.tgc *.wbfs *.ciso *.gcz *.wad);;"
|
||||||
"All Files (*)"));
|
"All Files (*)"));
|
||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
{
|
{
|
||||||
m_game_edit->setText(file);
|
m_game_edit->setText(file);
|
||||||
SConfig::GetInstance().m_strDefaultISO = file.toStdString();
|
default_iso = file.toStdString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathPane::BrowseWiiNAND()
|
void PathPane::BrowseWiiNAND()
|
||||||
{
|
{
|
||||||
QString dir =
|
QString dir = QFileDialog::getExistingDirectory(
|
||||||
QFileDialog::getExistingDirectory(this, tr("Select Wii NAND Root"), QDir::currentPath());
|
this, tr("Select Wii NAND Root"), QString::fromStdString(SConfig::GetInstance().m_NANDPath));
|
||||||
if (!dir.isEmpty())
|
if (!dir.isEmpty())
|
||||||
{
|
{
|
||||||
m_nand_edit->setText(dir);
|
m_nand_edit->setText(dir);
|
||||||
SConfig::GetInstance().m_NANDPath = dir.toStdString();
|
OnNANDPathChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathPane::BrowseDump()
|
void PathPane::BrowseDump()
|
||||||
{
|
{
|
||||||
QString dir =
|
auto& dump_path = SConfig::GetInstance().m_DumpPath;
|
||||||
QFileDialog::getExistingDirectory(this, tr("Select Dump Path"), QDir::currentPath());
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Dump Path"),
|
||||||
|
QString::fromStdString(dump_path));
|
||||||
if (!dir.isEmpty())
|
if (!dir.isEmpty())
|
||||||
{
|
{
|
||||||
m_dump_edit->setText(dir);
|
m_dump_edit->setText(dir);
|
||||||
SConfig::GetInstance().m_DumpPath = dir.toStdString();
|
dump_path = dir.toStdString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathPane::BrowseSDCard()
|
void PathPane::BrowseSDCard()
|
||||||
{
|
{
|
||||||
QString file =
|
QString file = QFileDialog::getOpenFileName(
|
||||||
QFileDialog::getOpenFileName(this, tr("Select a SD Card Image"), QDir::currentPath(),
|
this, tr("Select a SD Card Image"),
|
||||||
tr("SD Card Image (*.raw);;"
|
QString::fromStdString(SConfig::GetInstance().m_strWiiSDCardPath),
|
||||||
"All Files (*)"));
|
tr("SD Card Image (*.raw);;"
|
||||||
|
"All Files (*)"));
|
||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
{
|
{
|
||||||
m_sdcard_edit->setText(file);
|
m_sdcard_edit->setText(file);
|
||||||
SConfig::GetInstance().m_strWiiSDCardPath = file.toStdString();
|
OnSDCardPathChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathPane::OnSDCardPathChanged()
|
||||||
|
{
|
||||||
|
const auto sd_card_path = m_sdcard_edit->text().toStdString();
|
||||||
|
|
||||||
|
SConfig::GetInstance().m_strWiiSDCardPath = sd_card_path;
|
||||||
|
File::SetUserPath(F_WIISDCARD_IDX, sd_card_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathPane::OnNANDPathChanged()
|
||||||
|
{
|
||||||
|
const auto nand_path = m_nand_edit->text().toStdString();
|
||||||
|
|
||||||
|
SConfig::GetInstance().m_NANDPath = nand_path;
|
||||||
|
File::SetUserPath(D_WIIROOT_IDX, nand_path);
|
||||||
|
}
|
||||||
|
|
||||||
QGroupBox* PathPane::MakeGameFolderBox()
|
QGroupBox* PathPane::MakeGameFolderBox()
|
||||||
{
|
{
|
||||||
QGroupBox* game_box = new QGroupBox(tr("Game Folders"));
|
QGroupBox* game_box = new QGroupBox(tr("Game Folders"));
|
||||||
|
@ -145,8 +166,7 @@ QGridLayout* PathPane::MakePathsLayout()
|
||||||
layout->addWidget(game_open, 0, 2);
|
layout->addWidget(game_open, 0, 2);
|
||||||
|
|
||||||
m_nand_edit = new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_NANDPath));
|
m_nand_edit = new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_NANDPath));
|
||||||
connect(m_nand_edit, &QLineEdit::editingFinished,
|
connect(m_nand_edit, &QLineEdit::editingFinished, this, &PathPane::OnNANDPathChanged);
|
||||||
[=] { SConfig::GetInstance().m_NANDPath = m_nand_edit->text().toStdString(); });
|
|
||||||
QPushButton* nand_open = new QPushButton;
|
QPushButton* nand_open = new QPushButton;
|
||||||
connect(nand_open, &QPushButton::clicked, this, &PathPane::BrowseWiiNAND);
|
connect(nand_open, &QPushButton::clicked, this, &PathPane::BrowseWiiNAND);
|
||||||
layout->addWidget(new QLabel(tr("Wii NAND Root:")), 1, 0);
|
layout->addWidget(new QLabel(tr("Wii NAND Root:")), 1, 0);
|
||||||
|
@ -163,8 +183,7 @@ QGridLayout* PathPane::MakePathsLayout()
|
||||||
layout->addWidget(dump_open, 2, 2);
|
layout->addWidget(dump_open, 2, 2);
|
||||||
|
|
||||||
m_sdcard_edit = new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_strWiiSDCardPath));
|
m_sdcard_edit = new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_strWiiSDCardPath));
|
||||||
connect(m_sdcard_edit, &QLineEdit::editingFinished,
|
connect(m_sdcard_edit, &QLineEdit::editingFinished, this, &PathPane::OnSDCardPathChanged);
|
||||||
[=] { SConfig::GetInstance().m_strWiiSDCardPath = m_sdcard_edit->text().toStdString(); });
|
|
||||||
QPushButton* sdcard_open = new QPushButton;
|
QPushButton* sdcard_open = new QPushButton;
|
||||||
connect(sdcard_open, &QPushButton::clicked, this, &PathPane::BrowseSDCard);
|
connect(sdcard_open, &QPushButton::clicked, this, &PathPane::BrowseSDCard);
|
||||||
layout->addWidget(new QLabel(tr("SD Card Path:")), 3, 0);
|
layout->addWidget(new QLabel(tr("SD Card Path:")), 3, 0);
|
||||||
|
|
|
@ -26,6 +26,9 @@ private:
|
||||||
QGridLayout* MakePathsLayout();
|
QGridLayout* MakePathsLayout();
|
||||||
void RemovePath();
|
void RemovePath();
|
||||||
|
|
||||||
|
void OnSDCardPathChanged();
|
||||||
|
void OnNANDPathChanged();
|
||||||
|
|
||||||
QListWidget* m_path_list;
|
QListWidget* m_path_list;
|
||||||
QLineEdit* m_game_edit;
|
QLineEdit* m_game_edit;
|
||||||
QLineEdit* m_nand_edit;
|
QLineEdit* m_nand_edit;
|
||||||
|
|
Loading…
Reference in New Issue