mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-21 01:55:40 -04:00
UI: Massive revamp, new features and improvements
This commit is contained in:
@ -5,8 +5,8 @@
|
||||
#include "settingsdialog.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
|
||||
static QCheckBox* addBooleanTweakOption(QtHostInterface* host_interface, QTableWidget* table, QString name,
|
||||
std::string section, std::string key, bool default_value)
|
||||
static QCheckBox* addBooleanTweakOption(SettingsDialog* dialog, QTableWidget* table, QString name, std::string section,
|
||||
std::string key, bool default_value)
|
||||
{
|
||||
const int row = table->rowCount();
|
||||
|
||||
@ -18,7 +18,10 @@ static QCheckBox* addBooleanTweakOption(QtHostInterface* host_interface, QTableW
|
||||
|
||||
QCheckBox* cb = new QCheckBox(table);
|
||||
if (!section.empty() || !key.empty())
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(host_interface, cb, std::move(section), std::move(key), default_value);
|
||||
{
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(dialog->getSettingsInterface(), cb, std::move(section), std::move(key),
|
||||
default_value);
|
||||
}
|
||||
|
||||
table->setCellWidget(row, 1, cb);
|
||||
return cb;
|
||||
@ -33,9 +36,8 @@ static QCheckBox* setBooleanTweakOption(QTableWidget* table, int row, bool value
|
||||
return cb;
|
||||
}
|
||||
|
||||
static QSpinBox* addIntRangeTweakOption(QtHostInterface* host_interface, QTableWidget* table, QString name,
|
||||
std::string section, std::string key, int min_value, int max_value,
|
||||
int default_value)
|
||||
static QSpinBox* addIntRangeTweakOption(SettingsDialog* dialog, QTableWidget* table, QString name, std::string section,
|
||||
std::string key, int min_value, int max_value, int default_value)
|
||||
{
|
||||
const int row = table->rowCount();
|
||||
|
||||
@ -49,7 +51,10 @@ static QSpinBox* addIntRangeTweakOption(QtHostInterface* host_interface, QTableW
|
||||
cb->setMinimum(min_value);
|
||||
cb->setMaximum(max_value);
|
||||
if (!section.empty() || !key.empty())
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(host_interface, cb, std::move(section), std::move(key), default_value);
|
||||
{
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(dialog->getSettingsInterface(), cb, std::move(section), std::move(key),
|
||||
default_value);
|
||||
}
|
||||
|
||||
table->setCellWidget(row, 1, cb);
|
||||
return cb;
|
||||
@ -64,7 +69,7 @@ static QSpinBox* setIntRangeTweakOption(QTableWidget* table, int row, int value)
|
||||
return cb;
|
||||
}
|
||||
|
||||
static QDoubleSpinBox* addFloatRangeTweakOption(QtHostInterface* host_interface, QTableWidget* table, QString name,
|
||||
static QDoubleSpinBox* addFloatRangeTweakOption(SettingsDialog* dialog, QTableWidget* table, QString name,
|
||||
std::string section, std::string key, float min_value, float max_value,
|
||||
float step_value, float default_value)
|
||||
{
|
||||
@ -83,8 +88,8 @@ static QDoubleSpinBox* addFloatRangeTweakOption(QtHostInterface* host_interface,
|
||||
|
||||
if (!section.empty() || !key.empty())
|
||||
{
|
||||
SettingWidgetBinder::BindWidgetToFloatSetting(host_interface, cb, std::move(section), std::move(key),
|
||||
default_value);
|
||||
SettingWidgetBinder::BindWidgetToFloatSetting(dialog->getSettingsInterface(), cb, std::move(section),
|
||||
std::move(key), default_value);
|
||||
}
|
||||
|
||||
table->setCellWidget(row, 1, cb);
|
||||
@ -101,9 +106,8 @@ static QDoubleSpinBox* setFloatRangeTweakOption(QTableWidget* table, int row, fl
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static QComboBox* addChoiceTweakOption(QtHostInterface* host_interface, QTableWidget* table, QString name,
|
||||
std::string section, std::string key,
|
||||
std::optional<T> (*parse_callback)(const char*),
|
||||
static QComboBox* addChoiceTweakOption(SettingsDialog* dialog, QTableWidget* table, QString name, std::string section,
|
||||
std::string key, std::optional<T> (*parse_callback)(const char*),
|
||||
const char* (*get_value_callback)(T), const char* (*get_display_callback)(T),
|
||||
const char* tr_context, u32 num_values, T default_value)
|
||||
{
|
||||
@ -121,8 +125,8 @@ static QComboBox* addChoiceTweakOption(QtHostInterface* host_interface, QTableWi
|
||||
|
||||
if (!section.empty() || !key.empty())
|
||||
{
|
||||
SettingWidgetBinder::BindWidgetToEnumSetting(host_interface, cb, std::move(section), std::move(key), parse_callback,
|
||||
get_value_callback, default_value);
|
||||
SettingWidgetBinder::BindWidgetToEnumSetting(dialog->getSettingsInterface(), cb, std::move(section), std::move(key),
|
||||
parse_callback, get_value_callback, default_value);
|
||||
}
|
||||
|
||||
table->setCellWidget(row, 1, cb);
|
||||
@ -138,7 +142,7 @@ static void setChoiceTweakOption(QTableWidget* table, int row, T value)
|
||||
cb->setCurrentIndex(static_cast<int>(value));
|
||||
}
|
||||
|
||||
static void addMSAATweakOption(QtHostInterface* host_interface, QTableWidget* table, const QString& name)
|
||||
static void addMSAATweakOption(SettingsDialog* dialog, QTableWidget* table, const QString& name)
|
||||
{
|
||||
const int row = table->rowCount();
|
||||
|
||||
@ -150,113 +154,111 @@ static void addMSAATweakOption(QtHostInterface* host_interface, QTableWidget* ta
|
||||
|
||||
QComboBox* msaa = new QComboBox(table);
|
||||
QtUtils::FillComboBoxWithMSAAModes(msaa);
|
||||
const QVariant current_msaa_mode(QtUtils::GetMSAAModeValue(
|
||||
static_cast<uint>(QtHostInterface::GetInstance()->GetIntSettingValue("GPU", "Multisamples", 1)),
|
||||
QtHostInterface::GetInstance()->GetBoolSettingValue("GPU", "PerSampleShading", false)));
|
||||
const QVariant current_msaa_mode(
|
||||
QtUtils::GetMSAAModeValue(static_cast<uint>(dialog->getEffectiveIntValue("GPU", "Multisamples", 1)),
|
||||
dialog->getEffectiveBoolValue("GPU", "PerSampleShading", false)));
|
||||
const int current_msaa_index = msaa->findData(current_msaa_mode);
|
||||
if (current_msaa_index >= 0)
|
||||
msaa->setCurrentIndex(current_msaa_index);
|
||||
msaa->connect(msaa, QOverload<int>::of(&QComboBox::currentIndexChanged), [msaa](int index) {
|
||||
msaa->connect(msaa, QOverload<int>::of(&QComboBox::currentIndexChanged), [dialog, msaa](int index) {
|
||||
uint multisamples;
|
||||
bool ssaa;
|
||||
QtUtils::DecodeMSAAModeValue(msaa->itemData(index), &multisamples, &ssaa);
|
||||
QtHostInterface::GetInstance()->SetIntSettingValue("GPU", "Multisamples", static_cast<int>(multisamples));
|
||||
QtHostInterface::GetInstance()->SetBoolSettingValue("GPU", "PerSampleShading", ssaa);
|
||||
QtHostInterface::GetInstance()->applySettings(false);
|
||||
dialog->setIntSettingValue("GPU", "Multisamples", static_cast<int>(multisamples));
|
||||
dialog->setBoolSettingValue("GPU", "PerSampleShading", ssaa);
|
||||
g_emu_thread->applySettings(false);
|
||||
});
|
||||
|
||||
table->setCellWidget(row, 1, msaa);
|
||||
}
|
||||
|
||||
AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog)
|
||||
: QWidget(parent), m_host_interface(host_interface)
|
||||
AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsDialog* dialog, QWidget* parent)
|
||||
: QWidget(parent), m_dialog(dialog)
|
||||
{
|
||||
SettingsInterface* sif = dialog->getSettingsInterface();
|
||||
|
||||
m_ui.setupUi(this);
|
||||
|
||||
for (u32 i = 0; i < static_cast<u32>(LOGLEVEL_COUNT); i++)
|
||||
m_ui.logLevel->addItem(qApp->translate("LogLevel", Settings::GetLogLevelDisplayName(static_cast<LOGLEVEL>(i))));
|
||||
|
||||
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.logLevel, "Logging", "LogLevel",
|
||||
&Settings::ParseLogLevelName, &Settings::GetLogLevelName,
|
||||
Settings::DEFAULT_LOG_LEVEL);
|
||||
SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, m_ui.logFilter, "Logging", "LogFilter");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToConsole, "Logging", "LogToConsole");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToDebug, "Logging", "LogToDebug");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToWindow, "Logging", "LogToWindow");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToFile, "Logging", "LogToFile");
|
||||
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.logLevel, "Logging", "LogLevel", &Settings::ParseLogLevelName,
|
||||
&Settings::GetLogLevelName, Settings::DEFAULT_LOG_LEVEL);
|
||||
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.logFilter, "Logging", "LogFilter");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToConsole, "Logging", "LogToConsole", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToDebug, "Logging", "LogToDebug", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToWindow, "Logging", "LogToWindow", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToFile, "Logging", "LogToFile", false);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showDebugMenu, "Main", "ShowDebugMenu");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showDebugMenu, "Main", "ShowDebugMenu", false);
|
||||
|
||||
connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::onResetToDefaultClicked);
|
||||
connect(m_ui.showDebugMenu, &QCheckBox::toggled, m_host_interface->getMainWindow(),
|
||||
&MainWindow::updateDebugMenuVisibility, Qt::QueuedConnection);
|
||||
connect(m_ui.showDebugMenu, &QCheckBox::toggled, g_main_window, &MainWindow::updateDebugMenuVisibility,
|
||||
Qt::QueuedConnection);
|
||||
|
||||
m_ui.tweakOptionTable->setColumnWidth(0, 380);
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Disable All Enhancements"), "Main",
|
||||
"DisableAllEnhancements", false);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Show Status Indicators"), "Display",
|
||||
"ShowStatusIndicators", true);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Show Enhancement Settings"), "Display",
|
||||
"ShowEnhancements", false);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Controller Enhanced Mode (PS4/PS5)"), "Main",
|
||||
"ControllerEnhancedMode", false);
|
||||
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000,
|
||||
0);
|
||||
|
||||
addMSAATweakOption(host_interface, m_ui.tweakOptionTable, tr("Multisample Antialiasing"));
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP Vertex Cache"), "GPU", "PGXPVertexCache",
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Disable All Enhancements"), "Main", "DisableAllEnhancements",
|
||||
false);
|
||||
addFloatRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP Geometry Tolerance"), "GPU",
|
||||
"PGXPTolerance", -1.0f, 100.0f, 0.25f, -1.0f);
|
||||
addFloatRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP Depth Clear Threshold"), "GPU",
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Show Status Indicators"), "Display", "ShowStatusIndicators",
|
||||
true);
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Show Enhancement Settings"), "Display", "ShowEnhancements",
|
||||
false);
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Controller Enhanced Mode (PS4/PS5)"), "Main",
|
||||
"ControllerEnhancedMode", false);
|
||||
addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000, 0);
|
||||
|
||||
addMSAATweakOption(dialog, m_ui.tweakOptionTable, tr("Multisample Antialiasing"));
|
||||
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("PGXP Vertex Cache"), "GPU", "PGXPVertexCache", false);
|
||||
addFloatRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("PGXP Geometry Tolerance"), "GPU", "PGXPTolerance", -1.0f,
|
||||
100.0f, 0.25f, -1.0f);
|
||||
addFloatRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("PGXP Depth Clear Threshold"), "GPU",
|
||||
"PGXPDepthClearThreshold", 0.0f, 4096.0f, 1.0f, Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD);
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable Recompiler Memory Exceptions"), "CPU",
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Enable Recompiler Memory Exceptions"), "CPU",
|
||||
"RecompilerMemoryExceptions", false);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable Recompiler Block Linking"), "CPU",
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Enable Recompiler Block Linking"), "CPU",
|
||||
"RecompilerBlockLinking", true);
|
||||
addChoiceTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable Recompiler Fast Memory Access"), "CPU",
|
||||
"FastmemMode", Settings::ParseCPUFastmemMode, Settings::GetCPUFastmemModeName,
|
||||
addChoiceTweakOption(dialog, m_ui.tweakOptionTable, tr("Enable Recompiler Fast Memory Access"), "CPU", "FastmemMode",
|
||||
Settings::ParseCPUFastmemMode, Settings::GetCPUFastmemModeName,
|
||||
Settings::GetCPUFastmemModeDisplayName, "CPUFastmemMode",
|
||||
static_cast<u32>(CPUFastmemMode::Count), Settings::DEFAULT_CPU_FASTMEM_MODE);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable Recompiler ICache"), "CPU",
|
||||
"RecompilerICache", false);
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Enable Recompiler ICache"), "CPU", "RecompilerICache",
|
||||
false);
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable VRAM Write Texture Replacement"),
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Enable VRAM Write Texture Replacement"),
|
||||
"TextureReplacements", "EnableVRAMWriteReplacements", false);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Preload Texture Replacements"),
|
||||
"TextureReplacements", "PreloadTextures", false);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Dump Replaceable VRAM Writes"),
|
||||
"TextureReplacements", "DumpVRAMWrites", false);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Set Dumped VRAM Write Alpha Channel"),
|
||||
"TextureReplacements", "DumpVRAMWriteForceAlphaChannel", true);
|
||||
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Minimum Dumped VRAM Write Width"),
|
||||
"TextureReplacements", "DumpVRAMWriteWidthThreshold", 1, VRAM_WIDTH,
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Preload Texture Replacements"), "TextureReplacements",
|
||||
"PreloadTextures", false);
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Dump Replaceable VRAM Writes"), "TextureReplacements",
|
||||
"DumpVRAMWrites", false);
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Set Dumped VRAM Write Alpha Channel"), "TextureReplacements",
|
||||
"DumpVRAMWriteForceAlphaChannel", true);
|
||||
addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("Minimum Dumped VRAM Write Width"), "TextureReplacements",
|
||||
"DumpVRAMWriteWidthThreshold", 1, VRAM_WIDTH,
|
||||
Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD);
|
||||
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Minimum Dumped VRAM Write Height"),
|
||||
"TextureReplacements", "DumpVRAMWriteHeightThreshold", 1, VRAM_HEIGHT,
|
||||
addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("Minimum Dumped VRAM Write Height"), "TextureReplacements",
|
||||
"DumpVRAMWriteHeightThreshold", 1, VRAM_HEIGHT,
|
||||
Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD);
|
||||
|
||||
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("DMA Max Slice Ticks"), "Hacks",
|
||||
"DMAMaxSliceTicks", 100, 10000, Settings::DEFAULT_DMA_MAX_SLICE_TICKS);
|
||||
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("DMA Halt Ticks"), "Hacks", "DMAHaltTicks", 100,
|
||||
10000, Settings::DEFAULT_DMA_HALT_TICKS);
|
||||
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("GPU FIFO Size"), "Hacks", "GPUFIFOSize", 16, 4096,
|
||||
addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("DMA Max Slice Ticks"), "Hacks", "DMAMaxSliceTicks", 100,
|
||||
10000, Settings::DEFAULT_DMA_MAX_SLICE_TICKS);
|
||||
addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("DMA Halt Ticks"), "Hacks", "DMAHaltTicks", 100, 10000,
|
||||
Settings::DEFAULT_DMA_HALT_TICKS);
|
||||
addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("GPU FIFO Size"), "Hacks", "GPUFIFOSize", 16, 4096,
|
||||
Settings::DEFAULT_GPU_FIFO_SIZE);
|
||||
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("GPU Max Run-Ahead"), "Hacks", "GPUMaxRunAhead", 0,
|
||||
1000, Settings::DEFAULT_GPU_MAX_RUN_AHEAD);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Use Debug Host GPU Device"), "GPU",
|
||||
"UseDebugDevice", false);
|
||||
addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("GPU Max Run-Ahead"), "Hacks", "GPUMaxRunAhead", 0, 1000,
|
||||
Settings::DEFAULT_GPU_MAX_RUN_AHEAD);
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Use Debug Host GPU Device"), "GPU", "UseDebugDevice", false);
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Increase Timer Resolution"), "Main",
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Increase Timer Resolution"), "Main",
|
||||
"IncreaseTimerResolution", true);
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Allow Booting Without SBI File"), "CDROM",
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Allow Booting Without SBI File"), "CDROM",
|
||||
"AllowBootingWithoutSBIFile", false);
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Create Save State Backups"), "General",
|
||||
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Create Save State Backups"), "General",
|
||||
"CreateSaveStateBackups", false);
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.logLevel, tr("Log Level"), tr("Information"),
|
||||
|
Reference in New Issue
Block a user