mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Reformat all the things. Have fun with merge conflicts.
This commit is contained in:
@ -14,171 +14,163 @@
|
||||
#include <QSize>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "DolphinQt2/Settings.h"
|
||||
#include "DolphinQt2/Config/PathDialog.h"
|
||||
#include "DolphinQt2/Settings.h"
|
||||
|
||||
PathDialog::PathDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
PathDialog::PathDialog(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Paths"));
|
||||
setWindowTitle(tr("Paths"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->addWidget(MakeGameFolderBox());
|
||||
layout->addLayout(MakePathsLayout());
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->addWidget(MakeGameFolderBox());
|
||||
layout->addLayout(MakePathsLayout());
|
||||
|
||||
QDialogButtonBox* ok_box = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
connect(ok_box, &QDialogButtonBox::accepted, this, &PathDialog::accept);
|
||||
layout->addWidget(ok_box);
|
||||
QDialogButtonBox* ok_box = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
connect(ok_box, &QDialogButtonBox::accepted, this, &PathDialog::accept);
|
||||
layout->addWidget(ok_box);
|
||||
|
||||
setLayout(layout);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void PathDialog::Browse()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select a Directory"),
|
||||
QDir::currentPath());
|
||||
if (!dir.isEmpty())
|
||||
{
|
||||
Settings settings;
|
||||
QStringList game_folders = settings.GetPaths();
|
||||
if (!game_folders.contains(dir))
|
||||
{
|
||||
game_folders << dir;
|
||||
settings.SetPaths(game_folders);
|
||||
m_path_list->addItem(dir);
|
||||
emit PathAdded(dir);
|
||||
}
|
||||
}
|
||||
QString dir =
|
||||
QFileDialog::getExistingDirectory(this, tr("Select a Directory"), QDir::currentPath());
|
||||
if (!dir.isEmpty())
|
||||
{
|
||||
Settings settings;
|
||||
QStringList game_folders = settings.GetPaths();
|
||||
if (!game_folders.contains(dir))
|
||||
{
|
||||
game_folders << dir;
|
||||
settings.SetPaths(game_folders);
|
||||
m_path_list->addItem(dir);
|
||||
emit PathAdded(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PathDialog::BrowseDefaultGame()
|
||||
{
|
||||
QString file = QFileDialog::getOpenFileName(this,
|
||||
tr("Select a Game"),
|
||||
QDir::currentPath(),
|
||||
tr("All GC/Wii files (*.elf *.dol *.gcm *.iso *.wbfs *.ciso *.gcz *.wad);;"
|
||||
"All Files (*)"));
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
m_game_edit->setText(file);
|
||||
Settings().SetDefaultGame(file);
|
||||
}
|
||||
QString file = QFileDialog::getOpenFileName(
|
||||
this, tr("Select a Game"), QDir::currentPath(),
|
||||
tr("All GC/Wii files (*.elf *.dol *.gcm *.iso *.wbfs *.ciso *.gcz *.wad);;"
|
||||
"All Files (*)"));
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
m_game_edit->setText(file);
|
||||
Settings().SetDefaultGame(file);
|
||||
}
|
||||
}
|
||||
|
||||
void PathDialog::BrowseDVDRoot()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select DVD Root"),
|
||||
QDir::currentPath());
|
||||
if (!dir.isEmpty())
|
||||
{
|
||||
m_dvd_edit->setText(dir);
|
||||
Settings().SetDVDRoot(dir);
|
||||
}
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select DVD Root"), QDir::currentPath());
|
||||
if (!dir.isEmpty())
|
||||
{
|
||||
m_dvd_edit->setText(dir);
|
||||
Settings().SetDVDRoot(dir);
|
||||
}
|
||||
}
|
||||
|
||||
void PathDialog::BrowseApploader()
|
||||
{
|
||||
QString file = QFileDialog::getOpenFileName(this,
|
||||
tr("Select an Apploader"),
|
||||
QDir::currentPath(),
|
||||
tr("Apploaders (*.img)"));
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
m_app_edit->setText(file);
|
||||
Settings().SetApploader(file);
|
||||
}
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select an Apploader"), QDir::currentPath(),
|
||||
tr("Apploaders (*.img)"));
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
m_app_edit->setText(file);
|
||||
Settings().SetApploader(file);
|
||||
}
|
||||
}
|
||||
|
||||
void PathDialog::BrowseWiiNAND()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select Wii NAND Root"),
|
||||
QDir::currentPath());
|
||||
if (!dir.isEmpty())
|
||||
{
|
||||
m_nand_edit->setText(dir);
|
||||
Settings().SetWiiNAND(dir);
|
||||
}
|
||||
QString dir =
|
||||
QFileDialog::getExistingDirectory(this, tr("Select Wii NAND Root"), QDir::currentPath());
|
||||
if (!dir.isEmpty())
|
||||
{
|
||||
m_nand_edit->setText(dir);
|
||||
Settings().SetWiiNAND(dir);
|
||||
}
|
||||
}
|
||||
|
||||
QGroupBox* PathDialog::MakeGameFolderBox()
|
||||
{
|
||||
QGroupBox* game_box = new QGroupBox(tr("Game Folders"));
|
||||
game_box->setMinimumSize(QSize(400, 250));
|
||||
QVBoxLayout* vlayout = new QVBoxLayout;
|
||||
QGroupBox* game_box = new QGroupBox(tr("Game Folders"));
|
||||
game_box->setMinimumSize(QSize(400, 250));
|
||||
QVBoxLayout* vlayout = new QVBoxLayout;
|
||||
|
||||
m_path_list = new QListWidget;
|
||||
m_path_list->insertItems(0, Settings().GetPaths());
|
||||
m_path_list->setSpacing(1);
|
||||
vlayout->addWidget(m_path_list);
|
||||
m_path_list = new QListWidget;
|
||||
m_path_list->insertItems(0, Settings().GetPaths());
|
||||
m_path_list->setSpacing(1);
|
||||
vlayout->addWidget(m_path_list);
|
||||
|
||||
QHBoxLayout* hlayout = new QHBoxLayout;
|
||||
QHBoxLayout* hlayout = new QHBoxLayout;
|
||||
|
||||
hlayout->addStretch();
|
||||
QPushButton* add = new QPushButton(tr("Add"));
|
||||
QPushButton* remove = new QPushButton(tr("Remove"));
|
||||
hlayout->addWidget(add);
|
||||
hlayout->addWidget(remove);
|
||||
vlayout->addLayout(hlayout);
|
||||
hlayout->addStretch();
|
||||
QPushButton* add = new QPushButton(tr("Add"));
|
||||
QPushButton* remove = new QPushButton(tr("Remove"));
|
||||
hlayout->addWidget(add);
|
||||
hlayout->addWidget(remove);
|
||||
vlayout->addLayout(hlayout);
|
||||
|
||||
connect(add, &QPushButton::clicked, this, &PathDialog::Browse);
|
||||
connect(remove, &QPushButton::clicked, this, &PathDialog::RemovePath);
|
||||
connect(add, &QPushButton::clicked, this, &PathDialog::Browse);
|
||||
connect(remove, &QPushButton::clicked, this, &PathDialog::RemovePath);
|
||||
|
||||
game_box->setLayout(vlayout);
|
||||
return game_box;
|
||||
game_box->setLayout(vlayout);
|
||||
return game_box;
|
||||
}
|
||||
|
||||
QGridLayout* PathDialog::MakePathsLayout()
|
||||
{
|
||||
QGridLayout* layout = new QGridLayout;
|
||||
layout->setColumnStretch(1, 1);
|
||||
QGridLayout* layout = new QGridLayout;
|
||||
layout->setColumnStretch(1, 1);
|
||||
|
||||
m_game_edit = new QLineEdit(Settings().GetDefaultGame());
|
||||
connect(m_game_edit, &QLineEdit::editingFinished,
|
||||
[=]{ Settings().SetDefaultGame(m_game_edit->text()); });
|
||||
QPushButton* game_open = new QPushButton;
|
||||
connect(game_open, &QPushButton::clicked, this, &PathDialog::BrowseDefaultGame);
|
||||
layout->addWidget(new QLabel(tr("Default Game")), 0, 0);
|
||||
layout->addWidget(m_game_edit, 0, 1);
|
||||
layout->addWidget(game_open, 0, 2);
|
||||
m_game_edit = new QLineEdit(Settings().GetDefaultGame());
|
||||
connect(m_game_edit, &QLineEdit::editingFinished,
|
||||
[=] { Settings().SetDefaultGame(m_game_edit->text()); });
|
||||
QPushButton* game_open = new QPushButton;
|
||||
connect(game_open, &QPushButton::clicked, this, &PathDialog::BrowseDefaultGame);
|
||||
layout->addWidget(new QLabel(tr("Default Game")), 0, 0);
|
||||
layout->addWidget(m_game_edit, 0, 1);
|
||||
layout->addWidget(game_open, 0, 2);
|
||||
|
||||
m_dvd_edit = new QLineEdit(Settings().GetDVDRoot());
|
||||
connect(m_dvd_edit, &QLineEdit::editingFinished,
|
||||
[=]{ Settings().SetDVDRoot(m_dvd_edit->text()); });
|
||||
QPushButton* dvd_open = new QPushButton;
|
||||
connect(dvd_open, &QPushButton::clicked, this, &PathDialog::BrowseDVDRoot);
|
||||
layout->addWidget(new QLabel(tr("DVD Root")), 1, 0);
|
||||
layout->addWidget(m_dvd_edit, 1, 1);
|
||||
layout->addWidget(dvd_open, 1, 2);
|
||||
m_dvd_edit = new QLineEdit(Settings().GetDVDRoot());
|
||||
connect(m_dvd_edit, &QLineEdit::editingFinished,
|
||||
[=] { Settings().SetDVDRoot(m_dvd_edit->text()); });
|
||||
QPushButton* dvd_open = new QPushButton;
|
||||
connect(dvd_open, &QPushButton::clicked, this, &PathDialog::BrowseDVDRoot);
|
||||
layout->addWidget(new QLabel(tr("DVD Root")), 1, 0);
|
||||
layout->addWidget(m_dvd_edit, 1, 1);
|
||||
layout->addWidget(dvd_open, 1, 2);
|
||||
|
||||
m_app_edit = new QLineEdit(Settings().GetApploader());
|
||||
connect(m_app_edit, &QLineEdit::editingFinished,
|
||||
[=]{ Settings().SetApploader(m_app_edit->text()); });
|
||||
QPushButton* app_open = new QPushButton;
|
||||
connect(app_open, &QPushButton::clicked, this, &PathDialog::BrowseApploader);
|
||||
layout->addWidget(new QLabel(tr("Apploader")), 2, 0);
|
||||
layout->addWidget(m_app_edit, 2, 1);
|
||||
layout->addWidget(app_open, 2, 2);
|
||||
m_app_edit = new QLineEdit(Settings().GetApploader());
|
||||
connect(m_app_edit, &QLineEdit::editingFinished,
|
||||
[=] { Settings().SetApploader(m_app_edit->text()); });
|
||||
QPushButton* app_open = new QPushButton;
|
||||
connect(app_open, &QPushButton::clicked, this, &PathDialog::BrowseApploader);
|
||||
layout->addWidget(new QLabel(tr("Apploader")), 2, 0);
|
||||
layout->addWidget(m_app_edit, 2, 1);
|
||||
layout->addWidget(app_open, 2, 2);
|
||||
|
||||
m_nand_edit = new QLineEdit(Settings().GetWiiNAND());
|
||||
connect(m_nand_edit, &QLineEdit::editingFinished,
|
||||
[=]{ Settings().SetWiiNAND(m_nand_edit->text()); });
|
||||
QPushButton* nand_open = new QPushButton;
|
||||
connect(nand_open, &QPushButton::clicked, this, &PathDialog::BrowseWiiNAND);
|
||||
layout->addWidget(new QLabel(tr("Wii NAND Root")), 3, 0);
|
||||
layout->addWidget(m_nand_edit, 3, 1);
|
||||
layout->addWidget(nand_open, 3, 2);
|
||||
m_nand_edit = new QLineEdit(Settings().GetWiiNAND());
|
||||
connect(m_nand_edit, &QLineEdit::editingFinished,
|
||||
[=] { Settings().SetWiiNAND(m_nand_edit->text()); });
|
||||
QPushButton* nand_open = new QPushButton;
|
||||
connect(nand_open, &QPushButton::clicked, this, &PathDialog::BrowseWiiNAND);
|
||||
layout->addWidget(new QLabel(tr("Wii NAND Root")), 3, 0);
|
||||
layout->addWidget(m_nand_edit, 3, 1);
|
||||
layout->addWidget(nand_open, 3, 2);
|
||||
|
||||
return layout;
|
||||
return layout;
|
||||
}
|
||||
|
||||
void PathDialog::RemovePath()
|
||||
{
|
||||
int row = m_path_list->currentRow();
|
||||
if (row < 0)
|
||||
return;
|
||||
emit PathRemoved(m_path_list->takeItem(row)->text());
|
||||
Settings().RemovePath(row);
|
||||
int row = m_path_list->currentRow();
|
||||
if (row < 0)
|
||||
return;
|
||||
emit PathRemoved(m_path_list->takeItem(row)->text());
|
||||
Settings().RemovePath(row);
|
||||
}
|
||||
|
@ -12,29 +12,29 @@
|
||||
|
||||
class PathDialog final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PathDialog(QWidget* parent = nullptr);
|
||||
explicit PathDialog(QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void Browse();
|
||||
void BrowseDefaultGame();
|
||||
void BrowseDVDRoot();
|
||||
void BrowseApploader();
|
||||
void BrowseWiiNAND();
|
||||
void Browse();
|
||||
void BrowseDefaultGame();
|
||||
void BrowseDVDRoot();
|
||||
void BrowseApploader();
|
||||
void BrowseWiiNAND();
|
||||
|
||||
signals:
|
||||
void PathAdded(QString path);
|
||||
void PathRemoved(QString path);
|
||||
void PathAdded(QString path);
|
||||
void PathRemoved(QString path);
|
||||
|
||||
private:
|
||||
QGroupBox* MakeGameFolderBox();
|
||||
QGridLayout* MakePathsLayout();
|
||||
void RemovePath();
|
||||
QGroupBox* MakeGameFolderBox();
|
||||
QGridLayout* MakePathsLayout();
|
||||
void RemovePath();
|
||||
|
||||
QListWidget* m_path_list;
|
||||
QLineEdit* m_game_edit;
|
||||
QLineEdit* m_dvd_edit;
|
||||
QLineEdit* m_app_edit;
|
||||
QLineEdit* m_nand_edit;
|
||||
QListWidget* m_path_list;
|
||||
QLineEdit* m_game_edit;
|
||||
QLineEdit* m_dvd_edit;
|
||||
QLineEdit* m_app_edit;
|
||||
QLineEdit* m_nand_edit;
|
||||
};
|
||||
|
@ -5,89 +5,87 @@
|
||||
#include "DolphinQt2/Settings.h"
|
||||
#include "DolphinQt2/Config/SettingsWindow.h"
|
||||
|
||||
SettingsWindow::SettingsWindow(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
// Set Window Properties
|
||||
setWindowTitle(tr("Settings"));
|
||||
resize(720, 600);
|
||||
// Set Window Properties
|
||||
setWindowTitle(tr("Settings"));
|
||||
resize(720, 600);
|
||||
|
||||
// Main Layout
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
QHBoxLayout* content = new QHBoxLayout;
|
||||
QVBoxLayout* content_inner = new QVBoxLayout;
|
||||
// Content's widgets
|
||||
{
|
||||
// Category list
|
||||
MakeCategoryList();
|
||||
content->addWidget(m_categories);
|
||||
// Main Layout
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
QHBoxLayout* content = new QHBoxLayout;
|
||||
QVBoxLayout* content_inner = new QVBoxLayout;
|
||||
// Content's widgets
|
||||
{
|
||||
// Category list
|
||||
MakeCategoryList();
|
||||
content->addWidget(m_categories);
|
||||
|
||||
// Actual Settings UI
|
||||
SetupSettingsWidget();
|
||||
// Actual Settings UI
|
||||
SetupSettingsWidget();
|
||||
|
||||
MakeUnfinishedWarning();
|
||||
MakeUnfinishedWarning();
|
||||
|
||||
content_inner->addWidget(m_warning_group);
|
||||
content_inner->addWidget(m_settings_outer);
|
||||
content_inner->addWidget(m_warning_group);
|
||||
content_inner->addWidget(m_settings_outer);
|
||||
|
||||
content->addLayout(content_inner);
|
||||
}
|
||||
content->addLayout(content_inner);
|
||||
}
|
||||
|
||||
// Add content to layout before dialog buttons.
|
||||
layout->addLayout(content);
|
||||
// Add content to layout before dialog buttons.
|
||||
layout->addLayout(content);
|
||||
|
||||
// Dialog box buttons
|
||||
QDialogButtonBox* ok_box = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
connect(ok_box, &QDialogButtonBox::accepted, this, &SettingsWindow::accept);
|
||||
layout->addWidget(ok_box);
|
||||
// Dialog box buttons
|
||||
QDialogButtonBox* ok_box = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
connect(ok_box, &QDialogButtonBox::accepted, this, &SettingsWindow::accept);
|
||||
layout->addWidget(ok_box);
|
||||
|
||||
setLayout(layout);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void SettingsWindow::SetupSettingsWidget()
|
||||
{
|
||||
m_settings_outer = new QStackedWidget;
|
||||
m_settings_outer->setCurrentIndex(0);
|
||||
m_settings_outer = new QStackedWidget;
|
||||
m_settings_outer->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void SettingsWindow::MakeUnfinishedWarning()
|
||||
{
|
||||
m_warning_group = new QGroupBox(tr("Warning"));
|
||||
QHBoxLayout* m_warning_group_layout = new QHBoxLayout;
|
||||
QLabel* warning_text = new QLabel(
|
||||
tr("Some categories and settings will not work.\n"
|
||||
"This Settings Window is under active development."));
|
||||
m_warning_group_layout->addWidget(warning_text);
|
||||
m_warning_group->setLayout(m_warning_group_layout);
|
||||
m_warning_group = new QGroupBox(tr("Warning"));
|
||||
QHBoxLayout* m_warning_group_layout = new QHBoxLayout;
|
||||
QLabel* warning_text = new QLabel(tr("Some categories and settings will not work.\n"
|
||||
"This Settings Window is under active development."));
|
||||
m_warning_group_layout->addWidget(warning_text);
|
||||
m_warning_group->setLayout(m_warning_group_layout);
|
||||
}
|
||||
|
||||
void SettingsWindow::AddCategoryToList(const QString& title, const QString& icon)
|
||||
{
|
||||
QListWidgetItem* button = new QListWidgetItem();
|
||||
button->setIcon(QIcon(icon));
|
||||
button->setText(title);
|
||||
button->setTextAlignment(Qt::AlignVCenter);
|
||||
button->setSizeHint(QSize(28, 28));
|
||||
button->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
m_categories->addItem(button);
|
||||
QListWidgetItem* button = new QListWidgetItem();
|
||||
button->setIcon(QIcon(icon));
|
||||
button->setText(title);
|
||||
button->setTextAlignment(Qt::AlignVCenter);
|
||||
button->setSizeHint(QSize(28, 28));
|
||||
button->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
m_categories->addItem(button);
|
||||
}
|
||||
|
||||
void SettingsWindow::MakeCategoryList()
|
||||
{
|
||||
QString dir = Settings().GetThemeDir();
|
||||
QString dir = Settings().GetThemeDir();
|
||||
|
||||
m_categories = new QListWidget;
|
||||
m_categories->setMaximumWidth(175);
|
||||
m_categories->setIconSize(QSize(32, 32));
|
||||
m_categories->setMovement(QListView::Static);
|
||||
m_categories->setSpacing(0);
|
||||
m_categories = new QListWidget;
|
||||
m_categories->setMaximumWidth(175);
|
||||
m_categories->setIconSize(QSize(32, 32));
|
||||
m_categories->setMovement(QListView::Static);
|
||||
m_categories->setSpacing(0);
|
||||
|
||||
connect(m_categories, &QListWidget::currentItemChanged, this, &SettingsWindow::changePage);
|
||||
connect(m_categories, &QListWidget::currentItemChanged, this, &SettingsWindow::changePage);
|
||||
}
|
||||
|
||||
void SettingsWindow::changePage(QListWidgetItem* current, QListWidgetItem* previous)
|
||||
{
|
||||
if (!current)
|
||||
current = previous;
|
||||
m_settings_outer->setCurrentIndex(m_categories->row(current));
|
||||
if (!current)
|
||||
current = previous;
|
||||
m_settings_outer->setCurrentIndex(m_categories->row(current));
|
||||
}
|
||||
|
@ -19,19 +19,19 @@
|
||||
|
||||
class SettingsWindow final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SettingsWindow(QWidget* parent = nullptr);
|
||||
explicit SettingsWindow(QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void changePage(QListWidgetItem* current, QListWidgetItem* previous);
|
||||
void changePage(QListWidgetItem* current, QListWidgetItem* previous);
|
||||
|
||||
private:
|
||||
void MakeCategoryList();
|
||||
void MakeUnfinishedWarning();
|
||||
void AddCategoryToList(const QString& title, const QString& icon);
|
||||
void SetupSettingsWidget();
|
||||
QStackedWidget* m_settings_outer;
|
||||
QListWidget* m_categories;
|
||||
QGroupBox* m_warning_group;
|
||||
void MakeCategoryList();
|
||||
void MakeUnfinishedWarning();
|
||||
void AddCategoryToList(const QString& title, const QString& icon);
|
||||
void SetupSettingsWidget();
|
||||
QStackedWidget* m_settings_outer;
|
||||
QListWidget* m_categories;
|
||||
QGroupBox* m_warning_group;
|
||||
};
|
||||
|
Reference in New Issue
Block a user