mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
use new range for combobox, remove obsolete code
This commit is contained in:
parent
54d2e8bfdd
commit
ae440a92ac
3 changed files with 18 additions and 24 deletions
|
@ -207,12 +207,24 @@ void emu_settings::SaveSettings()
|
||||||
config.write(out.c_str(), out.size());
|
config.write(out.c_str(), out.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type)
|
void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged)
|
||||||
|
{
|
||||||
|
if (is_ranged)
|
||||||
|
{
|
||||||
|
QStringList range = GetSettingOptions(type);
|
||||||
|
|
||||||
|
for (int i = range.first().toInt(); i <= range.last().toInt(); i++)
|
||||||
|
{
|
||||||
|
combobox->addItem(QString::number(i), QVariant(QString::number(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (QString setting : GetSettingOptions(type))
|
for (QString setting : GetSettingOptions(type))
|
||||||
{
|
{
|
||||||
combobox->addItem(tr(setting.toStdString().c_str()), QVariant(setting));
|
combobox->addItem(tr(setting.toStdString().c_str()), QVariant(setting));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString selected = qstr(GetSetting(type));
|
QString selected = qstr(GetSetting(type));
|
||||||
int index = combobox->findData(selected);
|
int index = combobox->findData(selected);
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
~emu_settings();
|
~emu_settings();
|
||||||
|
|
||||||
/** Connects a combo box with the target settings type*/
|
/** Connects a combo box with the target settings type*/
|
||||||
void EnhanceComboBox(QComboBox* combobox, SettingsType type);
|
void EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged = false);
|
||||||
|
|
||||||
/** Connects a check box with the target settings type*/
|
/** Connects a check box with the target settings type*/
|
||||||
void EnhanceCheckBox(QCheckBox* checkbox, SettingsType type);
|
void EnhanceCheckBox(QCheckBox* checkbox, SettingsType type);
|
||||||
|
|
|
@ -123,27 +123,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
|
||||||
|
|
||||||
// Comboboxes
|
// Comboboxes
|
||||||
|
|
||||||
// TODO implement enhancement for combobox / spinbox with proper range
|
xemu_settings->EnhanceComboBox(ui->preferredSPUThreads, emu_settings::PreferredSPUThreads, true);
|
||||||
//xemu_settings->EnhanceComboBox(ui->preferredSPUThreads, emu_settings::PreferredSPUThreads);
|
|
||||||
const QString Auto = tr("Auto");
|
|
||||||
ui->preferredSPUThreads->setToolTip(json_cpu_cbo["preferredSPUThreads"].toString());
|
ui->preferredSPUThreads->setToolTip(json_cpu_cbo["preferredSPUThreads"].toString());
|
||||||
for (int i = 0; i <= 6; i++)
|
ui->preferredSPUThreads->setItemText(ui->preferredSPUThreads->findData("0"), tr("Auto"));
|
||||||
{
|
|
||||||
ui->preferredSPUThreads->addItem( i == 0 ? Auto : QString::number(i), QVariant(i) );
|
|
||||||
}
|
|
||||||
const QString valueOf_PreferredSPUThreads = qstr(xemu_settings->GetSetting(emu_settings::PreferredSPUThreads));
|
|
||||||
int index = ui->preferredSPUThreads->findData(valueOf_PreferredSPUThreads == "0" ? Auto : valueOf_PreferredSPUThreads);
|
|
||||||
if (index == -1)
|
|
||||||
{
|
|
||||||
LOG_WARNING(GENERAL, "Current setting not found while creating preferredSPUThreads");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->preferredSPUThreads->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
connect(ui->preferredSPUThreads, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index) {
|
|
||||||
xemu_settings->SetSetting(emu_settings::PreferredSPUThreads, std::to_string(ui->preferredSPUThreads->itemData(index).toInt()));
|
|
||||||
});
|
|
||||||
|
|
||||||
// PPU tool tips
|
// PPU tool tips
|
||||||
ui->ppu_precise->setToolTip(json_cpu_ppu["precise"].toString());
|
ui->ppu_precise->setToolTip(json_cpu_ppu["precise"].toString());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue