Qt: move Render_Info to emu_settings.h

This commit is contained in:
Megamouse 2017-09-19 20:07:04 +02:00 committed by Ivan
parent cc594ad353
commit a84cc1d3bb
14 changed files with 113 additions and 95 deletions

View File

@ -63,9 +63,10 @@ void rpcs3_app::Init()
Emu.Init(); Emu.Init();
guiSettings.reset(new gui_settings()); guiSettings.reset(new gui_settings());
emuSettings.reset(new emu_settings());
// Create the main window // Create the main window
RPCS3MainWin = new main_window(guiSettings, nullptr); RPCS3MainWin = new main_window(guiSettings, emuSettings, nullptr);
// Create callbacks from the emulator, which reference the handlers. // Create callbacks from the emulator, which reference the handlers.
InitializeCallbacks(); InitializeCallbacks();

View File

@ -16,6 +16,7 @@
#include "rpcs3qt/msg_dialog_frame.h" #include "rpcs3qt/msg_dialog_frame.h"
#include "rpcs3qt/main_window.h" #include "rpcs3qt/main_window.h"
#include "rpcs3qt/gui_settings.h" #include "rpcs3qt/gui_settings.h"
#include "rpcs3qt/emu_settings.h"
#include <QApplication> #include <QApplication>
@ -48,5 +49,6 @@ private:
main_window* RPCS3MainWin; main_window* RPCS3MainWin;
std::shared_ptr<gui_settings> guiSettings; std::shared_ptr<gui_settings> guiSettings;
std::shared_ptr<emu_settings> emuSettings;
QWindow* gameWindow = nullptr; //! (Currently) only needed so that pad handlers have a valid target for event filtering. QWindow* gameWindow = nullptr; //! (Currently) only needed so that pad handlers have a valid target for event filtering.
}; };

View File

@ -111,7 +111,7 @@ static QStringList getOptions(cfg_location location)
return values; return values;
} }
Render_Creator::Render_Creator() emu_settings::Render_Creator::Render_Creator()
{ {
// check for dx12 adapters // check for dx12 adapters
#ifdef _MSC_VER #ifdef _MSC_VER
@ -165,9 +165,25 @@ Render_Creator::Render_Creator()
} }
} }
#endif #endif
// Graphics Adapter
D3D12 = Render_Info(name_D3D12, D3D12Adapters, supportsD3D12, emu_settings::D3D12Adapter);
Vulkan = Render_Info(name_Vulkan, vulkanAdapters, supportsVulkan, emu_settings::VulkanAdapter);
OpenGL = Render_Info(name_OpenGL);
NullRender = Render_Info(name_Null);
renderers = { &D3D12, &Vulkan, &OpenGL, &NullRender };
} }
emu_settings::emu_settings(const std::string& path) : QObject() emu_settings::emu_settings() : QObject()
{
}
emu_settings::~emu_settings()
{
}
void emu_settings::LoadSettings(const std::string& path)
{ {
m_path = path; m_path = path;
@ -189,10 +205,6 @@ emu_settings::emu_settings(const std::string& path) : QObject()
} }
} }
emu_settings::~emu_settings()
{
}
void emu_settings::SaveSettings() void emu_settings::SaveSettings()
{ {
YAML::Emitter out; YAML::Emitter out;

View File

@ -13,20 +13,6 @@
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;
struct Render_Creator
{
bool supportsD3D12 = false;
bool supportsVulkan = false;
QStringList D3D12Adapters;
QStringList vulkanAdapters;
QString render_Null = QObject::tr("Null");
QString render_Vulkan = QObject::tr("Vulkan");
QString render_D3D12 = QObject::tr("D3D12[DO NOT USE]");
QString render_OpenGL = QObject::tr("OpenGL");
Render_Creator();
};
// Node location // Node location
using cfg_location = std::vector<const char*>; using cfg_location = std::vector<const char*>;
@ -108,10 +94,44 @@ public:
dev_usb000Location, dev_usb000Location,
}; };
struct Render_Info
{
QString name;
QString old_adapter;
QStringList adapters;
SettingsType type;
bool supported = true;
bool has_adapters = true;
Render_Info() {};
Render_Info(const QString& name) : name(name), has_adapters(false) {};
Render_Info(const QString& name, const QStringList& adapters, bool supported, SettingsType type)
: name(name), adapters(adapters), supported(supported), type(type) {};
};
struct Render_Creator
{
bool supportsD3D12 = false;
bool supportsVulkan = false;
QStringList D3D12Adapters;
QStringList vulkanAdapters;
QString name_Null = tr("Null");
QString name_Vulkan = tr("Vulkan");
QString name_D3D12 = tr("D3D12[DO NOT USE]");
QString name_OpenGL = tr("OpenGL");
Render_Info D3D12;
Render_Info Vulkan;
Render_Info OpenGL;
Render_Info NullRender;
std::vector<Render_Info*> renderers;
Render_Creator();
};
/** Creates a settings object which reads in the config.yml file at rpcs3/bin/%path%/config.yml /** Creates a settings object which reads in the config.yml file at rpcs3/bin/%path%/config.yml
* Settings are only written when SaveSettings is called. * Settings are only written when SaveSettings is called.
*/ */
emu_settings(const std::string& path); emu_settings();
~emu_settings(); ~emu_settings();
/** Connects a combo box with the target settings type*/ /** Connects a combo box with the target settings type*/
@ -131,8 +151,15 @@ public:
/** Sets the setting type to a given value.*/ /** Sets the setting type to a given value.*/
void SetSetting(SettingsType type, const std::string& val); void SetSetting(SettingsType type, const std::string& val);
/** Gets all the renderer info for gpu settings.*/
Render_Creator m_render_creator;
/** Loads the settings from path.*/
void LoadSettings(const std::string& path = "");
public Q_SLOTS: public Q_SLOTS:
/** Writes the unsaved settings to file. Used in settings dialog on accept.*/ /** Writes the unsaved settings to file. Used in settings dialog on accept.*/
void SaveSettings(); void SaveSettings();
private: private:
/** A helper map that keeps track of where a given setting type is located*/ /** A helper map that keeps track of where a given setting type is located*/

View File

@ -30,8 +30,8 @@ static const std::string m_class_name = "GameViewer";
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); } inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
inline QSize sizeFromSlider(const int& pos) { return GUI::gl_icon_size_min + (GUI::gl_icon_size_max - GUI::gl_icon_size_min) * (pos / (float)GUI::gl_max_slider_pos); } inline QSize sizeFromSlider(const int& pos) { return GUI::gl_icon_size_min + (GUI::gl_icon_size_max - GUI::gl_icon_size_min) * (pos / (float)GUI::gl_max_slider_pos); }
game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, const Render_Creator& r_Creator, QWidget *parent) game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget *parent)
: QDockWidget(tr("Game List"), parent), xgui_settings(settings), m_Render_Creator(r_Creator) : QDockWidget(tr("Game List"), parent), xgui_settings(guiSettings), xemu_settings(emuSettings)
{ {
setAcceptDrops(true); setAcceptDrops(true);
@ -663,7 +663,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
}); });
connect(configure, &QAction::triggered, [=] connect(configure, &QAction::triggered, [=]
{ {
settings_dialog dlg(xgui_settings, m_Render_Creator, 0, this, &currGame); settings_dialog dlg(xgui_settings, xemu_settings, 0, this, &currGame);
connect(&dlg, &QDialog::accepted, [this] connect(&dlg, &QDialog::accepted, [this]
{ {
Refresh(true, false); Refresh(true, false);

View File

@ -193,7 +193,7 @@ class game_list_frame : public QDockWidget
Q_OBJECT Q_OBJECT
public: public:
explicit game_list_frame(std::shared_ptr<gui_settings> settings, const Render_Creator& r_Creator, QWidget *parent = nullptr); explicit game_list_frame(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget *parent = nullptr);
~game_list_frame(); ~game_list_frame();
/** Refresh the gamelist with/without loading game data from files. Public so that main frame can refresh after vfs or install */ /** Refresh the gamelist with/without loading game data from files. Public so that main frame can refresh after vfs or install */
@ -298,6 +298,7 @@ private:
// TODO: Reorganize this into a sensible order for private variables. // TODO: Reorganize this into a sensible order for private variables.
std::shared_ptr<gui_settings> xgui_settings; std::shared_ptr<gui_settings> xgui_settings;
std::shared_ptr<emu_settings> xemu_settings;
int m_sortColumn; int m_sortColumn;
Qt::SortOrder m_colSortOrder; Qt::SortOrder m_colSortOrder;
@ -312,7 +313,6 @@ private:
qreal m_Text_Factor; qreal m_Text_Factor;
QStringList m_categoryFilters; QStringList m_categoryFilters;
QString m_searchText; QString m_searchText;
Render_Creator m_Render_Creator;
uint m_games_per_row = 0; uint m_games_per_row = 0;
}; };

View File

@ -47,7 +47,8 @@
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); } inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
main_window::main_window(std::shared_ptr<gui_settings> guiSettings, QWidget *parent) : QMainWindow(parent), guiSettings(guiSettings), m_sys_menu_opened(false), ui(new Ui::main_window) main_window::main_window(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget *parent)
: QMainWindow(parent), guiSettings(guiSettings), emuSettings(emuSettings), m_sys_menu_opened(false), ui(new Ui::main_window)
{ {
} }
@ -1207,7 +1208,7 @@ void main_window::CreateConnects()
auto openSettings = [=](int tabIndex) auto openSettings = [=](int tabIndex)
{ {
settings_dialog dlg(guiSettings, m_Render_Creator, tabIndex, this); settings_dialog dlg(guiSettings, emuSettings, tabIndex, this);
connect(&dlg, &settings_dialog::GuiSettingsSaveRequest, this, &main_window::SaveWindowState); connect(&dlg, &settings_dialog::GuiSettingsSaveRequest, this, &main_window::SaveWindowState);
connect(&dlg, &settings_dialog::GuiSettingsSyncRequest, [=]() {ConfigureGuiFromSettings(true); }); connect(&dlg, &settings_dialog::GuiSettingsSyncRequest, [=]() {ConfigureGuiFromSettings(true); });
connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange); connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange);
@ -1235,7 +1236,7 @@ void main_window::CreateConnects()
connect(ui->confVFSDialogAct, &QAction::triggered, [=] connect(ui->confVFSDialogAct, &QAction::triggered, [=]
{ {
vfs_dialog dlg(this); vfs_dialog dlg(guiSettings, emuSettings, this);
dlg.exec(); dlg.exec();
m_gameListFrame->Refresh(true); // dev-hdd0 may have changed. Refresh just in case. m_gameListFrame->Refresh(true); // dev-hdd0 may have changed. Refresh just in case.
}); });
@ -1445,7 +1446,7 @@ void main_window::CreateDockWindows()
// new mainwindow widget because existing seems to be bugged for now // new mainwindow widget because existing seems to be bugged for now
m_mw = new QMainWindow(); m_mw = new QMainWindow();
m_gameListFrame = new game_list_frame(guiSettings, m_Render_Creator, m_mw); m_gameListFrame = new game_list_frame(guiSettings, emuSettings, m_mw);
m_gameListFrame->setObjectName("gamelist"); m_gameListFrame->setObjectName("gamelist");
m_debuggerFrame = new debugger_frame(guiSettings, m_mw); m_debuggerFrame = new debugger_frame(guiSettings, m_mw);
m_debuggerFrame->setObjectName("debugger"); m_debuggerFrame->setObjectName("debugger");

View File

@ -32,8 +32,6 @@ class main_window : public QMainWindow
bool m_sys_menu_opened; bool m_sys_menu_opened;
bool m_save_slider_pos = false; bool m_save_slider_pos = false;
Render_Creator m_Render_Creator;
QIcon m_appIcon; QIcon m_appIcon;
QIcon m_icon_play; QIcon m_icon_play;
QIcon m_icon_pause; QIcon m_icon_pause;
@ -58,7 +56,7 @@ class main_window : public QMainWindow
#endif #endif
public: public:
explicit main_window(std::shared_ptr<gui_settings> guiSettings, QWidget *parent = 0); explicit main_window(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget *parent = 0);
void Init(); void Init();
~main_window(); ~main_window();
void CreateThumbnailToolbar(); void CreateThumbnailToolbar();
@ -117,4 +115,5 @@ private:
debugger_frame *m_debuggerFrame; debugger_frame *m_debuggerFrame;
game_list_frame *m_gameListFrame; game_list_frame *m_gameListFrame;
std::shared_ptr<gui_settings> guiSettings; std::shared_ptr<gui_settings> guiSettings;
std::shared_ptr<emu_settings> emuSettings;
}; };

View File

@ -26,8 +26,8 @@
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); } inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); } inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); }
settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const Render_Creator& r_Creator, const int& tabIndex, QWidget *parent, const GameInfo* game) settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, const int& tabIndex, QWidget *parent, const GameInfo* game)
: QDialog(parent), xgui_settings(xSettings), ui(new Ui::settings_dialog), m_tab_Index(tabIndex) : QDialog(parent), xgui_settings(guiSettings), xemu_settings(emuSettings), ui(new Ui::settings_dialog), m_tab_Index(tabIndex)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->cancelButton->setDefault(true); ui->cancelButton->setDefault(true);
@ -69,15 +69,14 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
QJsonObject json_debug = json_obj.value("debug").toObject(); QJsonObject json_debug = json_obj.value("debug").toObject();
std::shared_ptr<emu_settings> xemu_settings;
if (game) if (game)
{ {
xemu_settings.reset(new emu_settings("data/" + game->serial)); xemu_settings->LoadSettings("data/" + game->serial);
setWindowTitle(tr("Settings: [") + qstr(game->serial) + "] " + qstr(game->name)); setWindowTitle(tr("Settings: [") + qstr(game->serial) + "] " + qstr(game->name));
} }
else else
{ {
xemu_settings.reset(new emu_settings("")); xemu_settings->LoadSettings();
setWindowTitle(tr("Settings")); setWindowTitle(tr("Settings"));
} }
@ -333,6 +332,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
// | |__| | | | |__| | | | (_| | |_) | // | |__| | | | |__| | | | (_| | |_) |
// \_____|_| \____/ |_|\__,_|_.__/ // \_____|_| \____/ |_|\__,_|_.__/
emu_settings::Render_Creator render_creator = xemu_settings.get()->m_render_creator;
// Comboboxes // Comboboxes
ui->graphicsAdapterBox->setToolTip(json_gpu_cbo["graphicsAdapterBox"].toString()); ui->graphicsAdapterBox->setToolTip(json_gpu_cbo["graphicsAdapterBox"].toString());
@ -343,7 +344,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
{ {
if (ui->renderBox->itemText(i) == "D3D12") if (ui->renderBox->itemText(i) == "D3D12")
{ {
ui->renderBox->setItemText(i, r_Creator.render_D3D12); ui->renderBox->setItemText(i, render_creator.name_D3D12);
break; break;
} }
} }
@ -376,16 +377,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
xemu_settings->EnhanceCheckBox(ui->scrictModeRendering, emu_settings::StrictRenderingMode); xemu_settings->EnhanceCheckBox(ui->scrictModeRendering, emu_settings::StrictRenderingMode);
ui->scrictModeRendering->setToolTip(json_gpu_main["scrictModeRendering"].toString()); ui->scrictModeRendering->setToolTip(json_gpu_main["scrictModeRendering"].toString());
// Graphics Adapter
m_D3D12 = Render_Info(r_Creator.render_D3D12, r_Creator.D3D12Adapters, r_Creator.supportsD3D12, emu_settings::D3D12Adapter);
m_Vulkan = Render_Info(r_Creator.render_Vulkan, r_Creator.vulkanAdapters, r_Creator.supportsVulkan, emu_settings::VulkanAdapter);
m_OpenGL = Render_Info(r_Creator.render_OpenGL);
m_NullRender = Render_Info(r_Creator.render_Null);
std::vector<Render_Info*> Render_List = { &m_D3D12, &m_Vulkan, &m_OpenGL, &m_NullRender };
// Remove renderers from the renderer Combobox if not supported // Remove renderers from the renderer Combobox if not supported
for (auto renderer : Render_List) for (const auto& renderer : render_creator.renderers)
{ {
if (renderer->supported) if (renderer->supported)
{ {
@ -412,10 +405,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
{ {
if (text.isEmpty()) return; if (text.isEmpty()) return;
auto switchTo = [=](Render_Info renderer) auto switchTo = [=](emu_settings::Render_Info renderer)
{ {
// Reset other adapters to old config // Reset other adapters to old config
for (const auto& render : Render_List) for (const auto& render : render_creator.renderers)
{ {
if (renderer.name != render->name && render->has_adapters && render->supported) if (renderer.name != render->name && render->has_adapters && render->supported)
{ {
@ -453,12 +446,12 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
xemu_settings->SetSetting(renderer.type, sstr(ui->graphicsAdapterBox->currentText())); xemu_settings->SetSetting(renderer.type, sstr(ui->graphicsAdapterBox->currentText()));
}; };
for (auto render : Render_List) for (const auto& renderer : render_creator.renderers)
{ {
if (render->name == text) if (renderer->name == text)
{ {
switchTo(*render); switchTo(*renderer);
ui->graphicsAdapterBox->setEnabled(render->has_adapters); ui->graphicsAdapterBox->setEnabled(renderer->has_adapters);
} }
} }
}; };
@ -474,7 +467,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
m_oldRender = newRender; m_oldRender = newRender;
return; return;
} }
for (const auto& render : Render_List) for (const auto& render : render_creator.renderers)
{ {
if (render->name == newRender && render->has_adapters && render->adapters.contains(text)) if (render->name == newRender && render->has_adapters && render->adapters.contains(text))
{ {
@ -494,7 +487,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
auto fixGLLegacy = [=](const QString& text) auto fixGLLegacy = [=](const QString& text)
{ {
ui->glLegacyBuffers->setEnabled(text == m_OpenGL.name); ui->glLegacyBuffers->setEnabled(text == render_creator.name_OpenGL);
}; };
// Handle connects to disable specific checkboxes that depend on GUI state. // Handle connects to disable specific checkboxes that depend on GUI state.

View File

@ -15,27 +15,12 @@ namespace Ui
class settings_dialog; class settings_dialog;
} }
struct Render_Info
{
QString name;
QString old_adapter;
QStringList adapters;
emu_settings::SettingsType type;
bool supported = true;
bool has_adapters = true;
Render_Info(){};
Render_Info(const QString& name) : name(name), has_adapters(false){};
Render_Info(const QString& name, const QStringList& adapters, bool supported, const emu_settings::SettingsType& type)
: name(name), adapters(adapters), supported(supported), type(type) {};
};
class settings_dialog : public QDialog class settings_dialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit settings_dialog(std::shared_ptr<gui_settings> xSettings, const Render_Creator& r_Creator, const int& tabIndex = 0, QWidget *parent = 0, const GameInfo *game = nullptr); explicit settings_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, const int& tabIndex = 0, QWidget *parent = 0, const GameInfo *game = nullptr);
~settings_dialog(); ~settings_dialog();
int exec(); int exec();
Q_SIGNALS: Q_SIGNALS:
@ -56,12 +41,8 @@ private:
//gpu tab //gpu tab
QString m_oldRender = ""; QString m_oldRender = "";
Render_Info m_D3D12;
Render_Info m_Vulkan;
Render_Info m_OpenGL;
Render_Info m_NullRender;
int m_tab_Index; int m_tab_Index;
Ui::settings_dialog *ui; Ui::settings_dialog *ui;
std::shared_ptr<gui_settings> xgui_settings; std::shared_ptr<gui_settings> xgui_settings;
std::shared_ptr<emu_settings> xemu_settings;
}; };

View File

@ -9,27 +9,29 @@
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); } inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
vfs_dialog::vfs_dialog(QWidget* parent) : QDialog(parent), vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget* parent)
m_gui_settings(), m_emu_settings("") : QDialog(parent), m_gui_settings(guiSettings), m_emu_settings(emuSettings)
{ {
QTabWidget* tabs = new QTabWidget(); QTabWidget* tabs = new QTabWidget();
tabs->setUsesScrollButtons(false); tabs->setUsesScrollButtons(false);
m_emu_settings->LoadSettings();
// Create tabs // Create tabs
vfs_dialog_tab* emulator_tab = new vfs_dialog_tab({ "$(EmulatorDir)", emu_settings::emulatorLocation, GUI::fs_emulator_dir_list, &g_cfg.vfs.emulator_dir }, vfs_dialog_tab* emulator_tab = new vfs_dialog_tab({ "$(EmulatorDir)", emu_settings::emulatorLocation, GUI::fs_emulator_dir_list, &g_cfg.vfs.emulator_dir },
&m_gui_settings, &m_emu_settings, this); m_gui_settings, m_emu_settings, this);
vfs_dialog_tab* dev_hdd0_tab = new vfs_dialog_tab({ "dev_hdd0", emu_settings::dev_hdd0Location, GUI::fs_dev_hdd0_list, &g_cfg.vfs.dev_hdd0 }, vfs_dialog_tab* dev_hdd0_tab = new vfs_dialog_tab({ "dev_hdd0", emu_settings::dev_hdd0Location, GUI::fs_dev_hdd0_list, &g_cfg.vfs.dev_hdd0 },
&m_gui_settings, &m_emu_settings, this); m_gui_settings, m_emu_settings, this);
vfs_dialog_tab* dev_hdd1_tab = new vfs_dialog_tab({ "dev_hdd1", emu_settings::dev_hdd1Location, GUI::fs_dev_hdd1_list, &g_cfg.vfs.dev_hdd1 }, vfs_dialog_tab* dev_hdd1_tab = new vfs_dialog_tab({ "dev_hdd1", emu_settings::dev_hdd1Location, GUI::fs_dev_hdd1_list, &g_cfg.vfs.dev_hdd1 },
&m_gui_settings, &m_emu_settings, this); m_gui_settings, m_emu_settings, this);
vfs_dialog_tab* dev_flash_tab = new vfs_dialog_tab({ "dev_flash", emu_settings::dev_flashLocation, GUI::fs_dev_flash_list, &g_cfg.vfs.dev_flash }, vfs_dialog_tab* dev_flash_tab = new vfs_dialog_tab({ "dev_flash", emu_settings::dev_flashLocation, GUI::fs_dev_flash_list, &g_cfg.vfs.dev_flash },
&m_gui_settings, &m_emu_settings, this); m_gui_settings, m_emu_settings, this);
vfs_dialog_tab* dev_usb000_tab = new vfs_dialog_tab({ "dev_usb000", emu_settings::dev_usb000Location, GUI::fs_dev_usb000_list, &g_cfg.vfs.dev_usb000 }, vfs_dialog_tab* dev_usb000_tab = new vfs_dialog_tab({ "dev_usb000", emu_settings::dev_usb000Location, GUI::fs_dev_usb000_list, &g_cfg.vfs.dev_usb000 },
&m_gui_settings, &m_emu_settings, this); m_gui_settings, m_emu_settings, this);
tabs->addTab(emulator_tab, "$(EmulatorDir)"); tabs->addTab(emulator_tab, "$(EmulatorDir)");
tabs->addTab(dev_hdd0_tab, "dev_hdd0"); tabs->addTab(dev_hdd0_tab, "dev_hdd0");

View File

@ -11,8 +11,8 @@ class vfs_dialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit vfs_dialog(QWidget* parent = nullptr); explicit vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget* parent = nullptr);
private: private:
gui_settings m_gui_settings; std::shared_ptr<gui_settings> m_gui_settings;
emu_settings m_emu_settings; std::shared_ptr<emu_settings> m_emu_settings;
}; };

View File

@ -7,8 +7,8 @@
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); } inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
vfs_dialog_tab::vfs_dialog_tab(const vfs_settings_info& settingsInfo, gui_settings* guiSettings, emu_settings* emuSettings, QWidget* parent) : QWidget(parent), vfs_dialog_tab::vfs_dialog_tab(const vfs_settings_info& settingsInfo, std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget* parent)
m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings) : QWidget(parent), m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings)
{ {
m_dirList = new QListWidget(this); m_dirList = new QListWidget(this);
@ -19,7 +19,7 @@ m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings)
{ {
new QListWidgetItem(EmuConfigDir(), m_dirList); new QListWidgetItem(EmuConfigDir(), m_dirList);
} }
for (QString dir : alldirs) for (const QString& dir : alldirs)
{ {
new QListWidgetItem(dir, m_dirList); new QListWidgetItem(dir, m_dirList);
} }

View File

@ -23,7 +23,7 @@ class vfs_dialog_tab : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit vfs_dialog_tab(const vfs_settings_info& info, gui_settings* guiSettings, emu_settings* emuSettings, QWidget* parent = nullptr); explicit vfs_dialog_tab(const vfs_settings_info& info, std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget* parent = nullptr);
void SaveSettings(); void SaveSettings();
void AddNewDirectory(); void AddNewDirectory();
@ -34,8 +34,8 @@ private:
const QString EmptyPath = "Empty Path"; const QString EmptyPath = "Empty Path";
vfs_settings_info m_info; vfs_settings_info m_info;
gui_settings* m_gui_settings; std::shared_ptr<gui_settings> m_gui_settings;
emu_settings* m_emu_settings; std::shared_ptr<emu_settings> m_emu_settings;
// UI variables needed in higher scope // UI variables needed in higher scope
QListWidget* m_dirList; QListWidget* m_dirList;