(QT/UI) By default, a CONFIG_FLOAT setting becomes a 'spinbox' UI type.

If a range is specified, it becomes a 'slider and spinbox' UI type.
This commit is contained in:
twinaphex 2019-04-14 18:24:27 +02:00
parent 0feb657e29
commit 051c877c62
4 changed files with 24 additions and 21 deletions

View File

@ -2474,6 +2474,10 @@ void menu_settings_list_current_add_range(
{
unsigned idx = list_info->index - 1;
if ((*list)[idx].type == ST_FLOAT)
(*list)[list_info->index - 1].ui_type
= ST_UI_TYPE_FLOAT_SLIDER_AND_SPINBOX;
(*list)[idx].min = min;
(*list)[idx].step = step;
(*list)[idx].max = max;

View File

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

View File

@ -25,19 +25,18 @@ NotificationsPage::NotificationsPage(QObject *parent) :
QWidget *NotificationsPage::widget()
{
QWidget *widget = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
QWidget *widget = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
CheckableSettingsGroup *notificationsGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_VIDEO_FONT_ENABLE);
CheckableSettingsGroup *bgGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE);
CheckableSettingsGroup *bgGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE);
notificationsGroup->addCheckBox(MENU_ENUM_LABEL_FPS_SHOW);
notificationsGroup->addCheckBox(MENU_ENUM_LABEL_FRAMECOUNT_SHOW);
notificationsGroup->addCheckBox(MENU_ENUM_LABEL_MEMORY_SHOW);
notificationsGroup->addFontSelector(MENU_ENUM_LABEL_VIDEO_FONT_PATH);
notificationsGroup->addFloatSpinBox(MENU_ENUM_LABEL_VIDEO_FONT_SIZE);
notificationsGroup->addFloatSliderAndSpinBox(MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X);
notificationsGroup->addFloatSliderAndSpinBox(MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y);
notificationsGroup->add(MENU_ENUM_LABEL_FPS_SHOW);
notificationsGroup->add(MENU_ENUM_LABEL_FRAMECOUNT_SHOW);
notificationsGroup->add(MENU_ENUM_LABEL_MEMORY_SHOW);
notificationsGroup->add(MENU_ENUM_LABEL_VIDEO_FONT_PATH);
notificationsGroup->add(MENU_ENUM_LABEL_VIDEO_FONT_SIZE);
notificationsGroup->add(MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X);
notificationsGroup->add(MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y);
notificationsGroup->addRow("Notification Color: ", new FloatColorButton(
MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_RED,
MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_GREEN,
@ -68,22 +67,22 @@ OverlayPage::OverlayPage(QObject *parent) :
QWidget *OverlayPage::widget()
{
QWidget *widget = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
QWidget *widget = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
CheckableSettingsGroup *overlayGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE);
CheckableSettingsGroup *inputsGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS);
CheckableSettingsGroup *inputsGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS);
overlayGroup->addCheckBox(MENU_ENUM_LABEL_OVERLAY_AUTOLOAD_PREFERRED);
overlayGroup->addCheckBox(MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU);
overlayGroup->add(MENU_ENUM_LABEL_OVERLAY_AUTOLOAD_PREFERRED);
overlayGroup->add(MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU);
inputsGroup->addUIntSpinBox(MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT);
overlayGroup->addRow(inputsGroup);
overlayGroup->addFileSelector(MENU_ENUM_LABEL_OVERLAY_PRESET);
overlayGroup->addFloatSliderAndSpinBox(MENU_ENUM_LABEL_OVERLAY_OPACITY);
overlayGroup->addFloatSliderAndSpinBox(MENU_ENUM_LABEL_OVERLAY_SCALE);
overlayGroup->add(MENU_ENUM_LABEL_OVERLAY_PRESET);
overlayGroup->add(MENU_ENUM_LABEL_OVERLAY_OPACITY);
overlayGroup->add(MENU_ENUM_LABEL_OVERLAY_SCALE);
layout->addWidget(overlayGroup);

View File

@ -181,7 +181,7 @@ public:
this->addFloatSliderAndSpinBox(enum_idx);
break;
case ST_UI_TYPE_SIZE_SPINBOX:
this->addSizeSpinBox(enum_idx);
/* TODO/FIXME */
break;
case ST_UI_TYPE_BIND_BUTTON:
/* TODO/FIXME - Why is the returntype void here and bool