(UI/QT) Create 'add' function for SettingsGroup and LayoutForm

This commit is contained in:
twinaphex 2019-04-14 17:10:13 +02:00
parent 0cb94aef85
commit 95f77a2288
7 changed files with 226 additions and 87 deletions

View File

@ -4955,6 +4955,7 @@ static bool setting_append_list(
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_RADIO_BUTTONS;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
menu_settings_list_current_add_range(list, list_info, 0, 3, 1.0, true, true); menu_settings_list_current_add_range(list, list_info, 0, 3, 1.0, true, true);
(*list)[list_info->index - 1].get_string_representation = (*list)[list_info->index - 1].get_string_representation =
@ -6532,6 +6533,7 @@ static bool setting_append_list(
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation = (*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_crt_switch_resolutions; &setting_get_string_representation_uint_crt_switch_resolutions;
@ -6566,6 +6568,7 @@ static bool setting_append_list(
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_SPINBOX;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].offset_by = -3; (*list)[list_info->index - 1].offset_by = -3;
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
@ -6825,6 +6828,7 @@ static bool setting_append_list(
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation = (*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_audio_resampler_quality; &setting_get_string_representation_uint_audio_resampler_quality;
@ -6916,6 +6920,7 @@ static bool setting_append_list(
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_STRING_LINE_EDIT;
(*list)[list_info->index - 1].action_left = &setting_string_action_left_audio_device; (*list)[list_info->index - 1].action_left = &setting_string_action_left_audio_device;
(*list)[list_info->index - 1].action_right = &setting_string_action_right_audio_device; (*list)[list_info->index - 1].action_right = &setting_string_action_right_audio_device;
#endif #endif
@ -7112,6 +7117,7 @@ static bool setting_append_list(
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation = (*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_poll_type_behavior; &setting_get_string_representation_poll_type_behavior;
@ -7213,6 +7219,7 @@ static bool setting_append_list(
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation = (*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_toggle_gamepad_combo; &setting_get_string_representation_toggle_gamepad_combo;
@ -7457,6 +7464,7 @@ static bool setting_append_list(
&group_info, &group_info,
&subgroup_info, &subgroup_info,
parent_group); parent_group);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_BIND_BUTTON;
(*list)[list_info->index - 1].index = user_value; (*list)[list_info->index - 1].index = user_value;
(*list)[list_info->index - 1].index_offset = user; (*list)[list_info->index - 1].index_offset = user;
@ -7693,7 +7701,8 @@ static bool setting_append_list(
strdup(input_config_bind_map_get_desc(i)), strdup(input_config_bind_map_get_desc(i)),
&retro_keybinds_1[i], &retro_keybinds_1[i],
&group_info, &subgroup_info, parent_group); &group_info, &subgroup_info, parent_group);
(*list)[list_info->index - 1].bind_type = i + MENU_SETTINGS_BIND_BEGIN; (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_BIND_BUTTON;
(*list)[list_info->index - 1].bind_type = i + MENU_SETTINGS_BIND_BEGIN;
menu_settings_list_current_add_enum_idx(list, list_info, menu_settings_list_current_add_enum_idx(list, list_info,
(enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i)); (enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i));
} }

View File

@ -1949,6 +1949,7 @@ bool CONFIG_FLOAT(
if (!(settings_list_append(list, list_info))) if (!(settings_list_append(list, list_info)))
return false; return false;
(*list)[list_info->index++] = value; (*list)[list_info->index++] = value;
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FLOAT_SLIDER_AND_SPINBOX;
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx); menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);

View File

@ -26,28 +26,26 @@ AudioPage::AudioPage(QObject *parent) :
QWidget *AudioPage::widget() QWidget *AudioPage::widget()
{ {
QWidget *widget = new QWidget; QWidget *widget = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
QVBoxLayout *layout = new QVBoxLayout; SettingsGroup *outputGroup = new SettingsGroup("Output");
SettingsGroup *outputGroup = new SettingsGroup("Output");
SettingsGroup *resamplerGroup = new SettingsGroup("Resampler"); SettingsGroup *resamplerGroup = new SettingsGroup("Resampler");
SettingsGroup *syncGroup = new SettingsGroup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_AUDIO_SYNC)); SettingsGroup *syncGroup = new SettingsGroup(msg_hash_to_str(
SettingsGroup *dspGroup = new SettingsGroup("DSP plugin"); MENU_ENUM_LABEL_VALUE_AUDIO_SYNC));
SettingsGroup *volumeGroup = new SettingsGroup("Volume"); SettingsGroup *dspGroup = new SettingsGroup("DSP plugin");
SettingsGroup *volumeGroup = new SettingsGroup("Volume");
QHBoxLayout *volumeLayout = new QHBoxLayout();
QHBoxLayout *volumeLayout = new QHBoxLayout(); outputGroup->add(MENU_ENUM_LABEL_AUDIO_ENABLE);
outputGroup->add(MENU_ENUM_LABEL_AUDIO_DRIVER);
outputGroup->add(MENU_ENUM_LABEL_AUDIO_DEVICE);
outputGroup->add(MENU_ENUM_LABEL_AUDIO_LATENCY);
outputGroup->addCheckBox(MENU_ENUM_LABEL_AUDIO_ENABLE); resamplerGroup->add(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER);
outputGroup->addStringComboBox(MENU_ENUM_LABEL_AUDIO_DRIVER); resamplerGroup->add(MENU_ENUM_LABEL_AUDIO_RESAMPLER_QUALITY);
outputGroup->addStringLineEdit(MENU_ENUM_LABEL_AUDIO_DEVICE); resamplerGroup->add(MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE);
outputGroup->addUIntSpinBox(MENU_ENUM_LABEL_AUDIO_LATENCY);
resamplerGroup->addStringComboBox(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER); syncGroup->add(MENU_ENUM_LABEL_AUDIO_SYNC);
resamplerGroup->addUIntComboBox(MENU_ENUM_LABEL_AUDIO_RESAMPLER_QUALITY);
resamplerGroup->addUIntSpinBox(MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE);
syncGroup->addCheckBox(MENU_ENUM_LABEL_AUDIO_SYNC);
syncGroup->addFloatSpinBox(MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW); syncGroup->addFloatSpinBox(MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW);
syncGroup->addFloatSpinBox(MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA); syncGroup->addFloatSpinBox(MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA);
@ -82,11 +80,11 @@ QWidget *MenuSoundsPage::widget()
FormLayout *layout = new FormLayout; FormLayout *layout = new FormLayout;
layout->addCheckBox(MENU_ENUM_LABEL_AUDIO_ENABLE_MENU); layout->add(MENU_ENUM_LABEL_AUDIO_ENABLE_MENU);
layout->addCheckBox(MENU_ENUM_LABEL_MENU_SOUND_OK); layout->add(MENU_ENUM_LABEL_MENU_SOUND_OK);
layout->addCheckBox(MENU_ENUM_LABEL_MENU_SOUND_CANCEL); layout->add(MENU_ENUM_LABEL_MENU_SOUND_CANCEL);
layout->addCheckBox(MENU_ENUM_LABEL_MENU_SOUND_NOTICE); layout->add(MENU_ENUM_LABEL_MENU_SOUND_NOTICE);
layout->addCheckBox(MENU_ENUM_LABEL_MENU_SOUND_BGM); layout->add(MENU_ENUM_LABEL_MENU_SOUND_BGM);
widget->setLayout(layout); widget->setLayout(layout);

View File

@ -36,25 +36,24 @@ InputPage::InputPage(QObject *parent) :
QWidget *InputPage::widget() QWidget *InputPage::widget()
{ {
QWidget *widget = new QWidget; QWidget *widget = new QWidget;
FormLayout *layout = new FormLayout; FormLayout *layout = new FormLayout;
layout->addUIntSpinBox(MENU_ENUM_LABEL_INPUT_MAX_USERS); layout->add(MENU_ENUM_LABEL_INPUT_MAX_USERS);
layout->addCheckBox(MENU_ENUM_LABEL_INPUT_UNIFIED_MENU_CONTROLS); layout->add(MENU_ENUM_LABEL_INPUT_UNIFIED_MENU_CONTROLS);
layout->addUIntComboBox(MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR); layout->add(MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR);
layout->addUIntComboBox(MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO); layout->add(MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO);
layout->addCheckBox(MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL); layout->add(MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL);
layout->addCheckBox(MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU); layout->add(MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU);
layout->addCheckBox(MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE); layout->add(MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE);
layout->addCheckBox(MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE); layout->add(MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE);
layout->addFloatSliderAndSpinBox(MENU_ENUM_LABEL_INPUT_BUTTON_AXIS_THRESHOLD); layout->add(MENU_ENUM_LABEL_INPUT_BUTTON_AXIS_THRESHOLD);
layout->addFloatSliderAndSpinBox(MENU_ENUM_LABEL_INPUT_ANALOG_DEADZONE); layout->add(MENU_ENUM_LABEL_INPUT_ANALOG_DEADZONE);
layout->addFloatSliderAndSpinBox(MENU_ENUM_LABEL_INPUT_ANALOG_SENSITIVITY); layout->add(MENU_ENUM_LABEL_INPUT_ANALOG_SENSITIVITY);
layout->addUIntSpinBox(MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT); layout->add(MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT);
layout->addUIntSpinBox(MENU_ENUM_LABEL_INPUT_BIND_HOLD); layout->add(MENU_ENUM_LABEL_INPUT_BIND_HOLD);
layout->addUIntSpinBox(MENU_ENUM_LABEL_INPUT_TURBO_PERIOD); layout->add(MENU_ENUM_LABEL_INPUT_TURBO_PERIOD);
layout->addUIntSpinBox(MENU_ENUM_LABEL_INPUT_DUTY_CYCLE); layout->add(MENU_ENUM_LABEL_INPUT_DUTY_CYCLE);
widget->setLayout(layout); widget->setLayout(layout);
@ -69,25 +68,25 @@ HotkeyBindsPage::HotkeyBindsPage(QObject *parent) :
QWidget *HotkeyBindsPage::widget() QWidget *HotkeyBindsPage::widget()
{ {
QWidget *widget = new QWidget;
QHBoxLayout *layout = new QHBoxLayout;
FormLayout *leftLayout = new FormLayout;
FormLayout *rightLayout = new FormLayout;
unsigned i; unsigned i;
unsigned count = 0; unsigned count = 0;
unsigned half = 40 / 2; /* TODO unhardcode */ unsigned half = 40 / 2; /* TODO unhardcode */
QWidget *widget = new QWidget;
QHBoxLayout *layout = new QHBoxLayout;
FormLayout *leftLayout = new FormLayout;
FormLayout *rightLayout = new FormLayout;
for (i = 0; i < RARCH_BIND_LIST_END; i++) for (i = 0; i < RARCH_BIND_LIST_END; i++)
{ {
enum msg_hash_enums lbl = (enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i);
if (count < half) if (count < half)
{ {
if (leftLayout->addBindButton((enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i))) if (leftLayout->add(lbl))
count++; count++;
} }
else else
rightLayout->addBindButton((enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i)); rightLayout->add(lbl);
} }
layout->addLayout(leftLayout); layout->addLayout(leftLayout);
@ -107,15 +106,12 @@ UserBindsPage::UserBindsPage(QObject *parent) :
QWidget *UserBindsPage::widget() QWidget *UserBindsPage::widget()
{ {
QWidget *widget = new QWidget;
QGridLayout *layout = new QGridLayout;
unsigned count = 0;
unsigned p, retro_id; unsigned p, retro_id;
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS)); unsigned count = 0;
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
QComboBox *userCombo = new QComboBox; QWidget *widget = new QWidget;
QGridLayout *layout = new QGridLayout;
QComboBox *userCombo = new QComboBox;
QStackedWidget *stack = new QStackedWidget; QStackedWidget *stack = new QStackedWidget;
for (p = 0; p < max_users; p++) for (p = 0; p < max_users; p++)
@ -128,12 +124,10 @@ QWidget *UserBindsPage::widget()
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 20; retro_id++) for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 20; retro_id++)
{ {
char descriptor[300]; char descriptor[300];
const struct retro_keybind *auto_bind = NULL; const struct retro_keybind *keybind =
const struct retro_keybind *keybind = NULL; &input_config_binds[p][retro_id];
const struct retro_keybind *auto_bind =
keybind = &input_config_binds[p][retro_id]; (const struct retro_keybind*)
auto_bind = (const struct retro_keybind*)
input_config_get_bind_auto(p, retro_id); input_config_get_bind_auto(p, retro_id);
input_config_get_bind_string(descriptor, input_config_get_bind_string(descriptor,
@ -144,14 +138,17 @@ QWidget *UserBindsPage::widget()
QString label = msg_hash_to_str(keyptr->enum_idx); QString label = msg_hash_to_str(keyptr->enum_idx);
form->addRow(QString(msg_hash_to_str(keyptr->enum_idx)), new QPushButton(QString(descriptor))); form->addRow(QString(msg_hash_to_str(keyptr->enum_idx)),
new QPushButton(QString(descriptor)));
} }
uWidget->setLayout(form); uWidget->setLayout(form);
stack->addWidget(uWidget); stack->addWidget(uWidget);
} }
connect(userCombo, SIGNAL(activated(int)), stack, SLOT(setCurrentIndex(int))); connect(userCombo, SIGNAL(activated(int)),
stack, SLOT(setCurrentIndex(int)));
layout->addWidget(userCombo, 0, 0); layout->addWidget(userCombo, 0, 0);
layout->addWidget(stack, 1, 0); layout->addWidget(stack, 1, 0);

View File

@ -23,13 +23,12 @@ LoggingPage::LoggingPage(QObject *parent) :
QWidget *LoggingPage::widget() QWidget *LoggingPage::widget()
{ {
QWidget *widget = new QWidget; QWidget *widget = new QWidget;
FormLayout *layout = new FormLayout; FormLayout *layout = new FormLayout;
layout->addCheckBox(MENU_ENUM_LABEL_LOG_VERBOSITY); layout->add(MENU_ENUM_LABEL_LOG_VERBOSITY);
layout->addUIntRadioButtons(MENU_ENUM_LABEL_LIBRETRO_LOG_LEVEL); layout->add(MENU_ENUM_LABEL_LIBRETRO_LOG_LEVEL);
layout->addCheckBox(MENU_ENUM_LABEL_PERFCNT_ENABLE); layout->add(MENU_ENUM_LABEL_PERFCNT_ENABLE);
widget->setLayout(layout); widget->setLayout(layout);

View File

@ -175,17 +175,16 @@ AspectRatioGroup::AspectRatioGroup(const QString &title, QWidget *parent) :
,m_radioButton(new AspectRatioRadioButton(ASPECT_RATIO_4_3, ASPECT_RATIO_32_9)) ,m_radioButton(new AspectRatioRadioButton(ASPECT_RATIO_4_3, ASPECT_RATIO_32_9))
,m_comboBox(new UIntComboBox(MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX, ASPECT_RATIO_4_3, ASPECT_RATIO_32_9)) ,m_comboBox(new UIntComboBox(MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX, ASPECT_RATIO_4_3, ASPECT_RATIO_32_9))
{ {
QHBoxLayout *aspectLayout = new QHBoxLayout; QHBoxLayout *aspectLayout = new QHBoxLayout;
FormLayout *leftAspectForm = new FormLayout; QHBoxLayout *preset = new QHBoxLayout;
QHBoxLayout *custom = new QHBoxLayout;
QVBoxLayout *customRadio = new QVBoxLayout;
QHBoxLayout *config = new QHBoxLayout;
QHBoxLayout *aspectL = new QHBoxLayout;
FormLayout *leftAspectForm = new FormLayout;
FormLayout *rightAspectForm = new FormLayout; FormLayout *rightAspectForm = new FormLayout;
QHBoxLayout *preset = new QHBoxLayout; FormLayout *leftAspect = new FormLayout;
//AspectRatioRadioButton *aspectRadioButton = new AspectRatioRadioButton(ASPECT_RATIO_4_3, ASPECT_RATIO_32_9); FormLayout *rightAspect = new FormLayout;
QHBoxLayout *custom = new QHBoxLayout;
QVBoxLayout *customRadio = new QVBoxLayout;
QHBoxLayout *config = new QHBoxLayout;
QHBoxLayout *aspectL = new QHBoxLayout;
FormLayout *leftAspect = new FormLayout;
FormLayout *rightAspect = new FormLayout;
leftAspectForm->addRow("X Pos.:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_X)); leftAspectForm->addRow("X Pos.:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_X));
leftAspectForm->addRow("Width:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH)); leftAspectForm->addRow("Width:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH));
@ -267,8 +266,7 @@ CrtSwitchresPage::CrtSwitchresPage(QObject *parent) :
QWidget *CrtSwitchresPage::widget() QWidget *CrtSwitchresPage::widget()
{ {
QWidget *widget = new QWidget; QWidget *widget = new QWidget;
FormLayout *layout = new FormLayout; FormLayout *layout = new FormLayout;
m_crtSuperResolutionCombo->addItem(msg_hash_to_str(MSG_NATIVE), 0); m_crtSuperResolutionCombo->addItem(msg_hash_to_str(MSG_NATIVE), 0);
@ -276,10 +274,10 @@ QWidget *CrtSwitchresPage::widget()
m_crtSuperResolutionCombo->addItem("2560", 2560); m_crtSuperResolutionCombo->addItem("2560", 2560);
m_crtSuperResolutionCombo->addItem("3840", 3840); m_crtSuperResolutionCombo->addItem("3840", 3840);
layout->addUIntComboBox(MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION); layout->add(MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION);
layout->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER), m_crtSuperResolutionCombo); layout->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER), m_crtSuperResolutionCombo);
layout->addUIntSpinBox(MENU_ENUM_LABEL_CRT_SWITCH_X_AXIS_CENTERING); layout->add(MENU_ENUM_LABEL_CRT_SWITCH_X_AXIS_CENTERING);
layout->addCheckBox(MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE); layout->add(MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE);
connect(m_crtSuperResolutionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onCrtSuperResolutionComboIndexChanged(int))); connect(m_crtSuperResolutionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onCrtSuperResolutionComboIndexChanged(int)));

View File

@ -49,6 +49,73 @@ public:
void addFloatSliderAndSpinBox(msg_hash_enums enum_idx); void addFloatSliderAndSpinBox(msg_hash_enums enum_idx);
void addUIntColorButton(const QString &title, msg_hash_enums r, msg_hash_enums g, msg_hash_enums b); void addUIntColorButton(const QString &title, msg_hash_enums r, msg_hash_enums g, msg_hash_enums b);
bool addBindButton(msg_hash_enums enum_idx); bool addBindButton(msg_hash_enums enum_idx);
bool add(msg_hash_enums enum_idx)
{
rarch_setting_t *setting = menu_setting_find_enum(enum_idx);
enum ui_setting_type ui_type = ST_UI_TYPE_NONE;
if (!setting)
return false;
ui_type = setting->ui_type;
switch (ui_type)
{
case ST_UI_TYPE_CHECKBOX:
this->addCheckBox(enum_idx);
break;
case ST_UI_TYPE_UINT_COLOR_BUTTON:
/* TODO/FIXME */
break;
case ST_UI_TYPE_UINT_SPINBOX:
this->addUIntSpinBox(enum_idx);
break;
case ST_UI_TYPE_UINT_COMBOBOX:
this->addUIntComboBox(enum_idx);
break;
case ST_UI_TYPE_UINT_RADIO_BUTTONS:
this->addUIntRadioButtons(enum_idx);
break;
case ST_UI_TYPE_FLOAT_COLOR_BUTTON:
/* TODO/FIXME */
break;
case ST_UI_TYPE_FLOAT_SPINBOX:
this->addFloatSpinBox(enum_idx);
break;
case ST_UI_TYPE_FLOAT_SLIDER_AND_SPINBOX:
this->addFloatSliderAndSpinBox(enum_idx);
break;
case ST_UI_TYPE_SIZE_SPINBOX:
/* TODO/FIXME */
break;
case ST_UI_TYPE_BIND_BUTTON:
return this->addBindButton(enum_idx);
case ST_UI_TYPE_DIRECTORY_SELECTOR:
this->addDirectorySelector(enum_idx);
break;
case ST_UI_TYPE_FILE_SELECTOR:
this->addFileSelector(enum_idx);
break;
case ST_UI_TYPE_FONT_SELECTOR:
this->addFontSelector(enum_idx);
break;
case ST_UI_TYPE_STRING_COMBOBOX:
this->addStringComboBox(enum_idx);
break;
case ST_UI_TYPE_STRING_LINE_EDIT:
this->addStringLineEdit(enum_idx);
break;
case ST_UI_TYPE_PASSWORD_LINE_EDIT:
this->addPasswordLineEdit(enum_idx);
break;
case ST_UI_TYPE_NONE:
default:
break;
}
return true;
}
}; };
class SettingsGroup : public QGroupBox class SettingsGroup : public QGroupBox
@ -76,6 +143,76 @@ public:
void addFloatSliderAndSpinBox(msg_hash_enums enum_idx); void addFloatSliderAndSpinBox(msg_hash_enums enum_idx);
void addUIntColorButton(const QString &title, msg_hash_enums r, msg_hash_enums g, msg_hash_enums b); void addUIntColorButton(const QString &title, msg_hash_enums r, msg_hash_enums g, msg_hash_enums b);
void addBindButton(msg_hash_enums enum_idx); void addBindButton(msg_hash_enums enum_idx);
bool add(msg_hash_enums enum_idx)
{
rarch_setting_t *setting = menu_setting_find_enum(enum_idx);
enum ui_setting_type ui_type = ST_UI_TYPE_NONE;
if (!setting)
return false;
ui_type = setting->ui_type;
switch (ui_type)
{
case ST_UI_TYPE_CHECKBOX:
this->addCheckBox(enum_idx);
break;
case ST_UI_TYPE_UINT_COLOR_BUTTON:
/* TODO/FIXME */
break;
case ST_UI_TYPE_UINT_SPINBOX:
this->addUIntSpinBox(enum_idx);
break;
case ST_UI_TYPE_UINT_COMBOBOX:
this->addUIntComboBox(enum_idx);
break;
case ST_UI_TYPE_UINT_RADIO_BUTTONS:
this->addUIntRadioButtons(enum_idx);
break;
case ST_UI_TYPE_FLOAT_COLOR_BUTTON:
/* TODO/FIXME */
break;
case ST_UI_TYPE_FLOAT_SPINBOX:
this->addFloatSpinBox(enum_idx);
break;
case ST_UI_TYPE_FLOAT_SLIDER_AND_SPINBOX:
this->addFloatSliderAndSpinBox(enum_idx);
break;
case ST_UI_TYPE_SIZE_SPINBOX:
/* TODO/FIXME */
break;
case ST_UI_TYPE_BIND_BUTTON:
/* TODO/FIXME - Why is the returntype void here and bool
* for Layout? */
this->addBindButton(enum_idx);
break;
case ST_UI_TYPE_DIRECTORY_SELECTOR:
this->addDirectorySelector(enum_idx);
break;
case ST_UI_TYPE_FILE_SELECTOR:
this->addFileSelector(enum_idx);
break;
case ST_UI_TYPE_FONT_SELECTOR:
this->addFontSelector(enum_idx);
break;
case ST_UI_TYPE_STRING_COMBOBOX:
this->addStringComboBox(enum_idx);
break;
case ST_UI_TYPE_STRING_LINE_EDIT:
this->addStringLineEdit(enum_idx);
break;
case ST_UI_TYPE_PASSWORD_LINE_EDIT:
this->addPasswordLineEdit(enum_idx);
break;
case ST_UI_TYPE_NONE:
default:
break;
}
return true;
}
private: private:
FormLayout *m_layout; FormLayout *m_layout;
}; };