From 9f09efe5c9e6714b509e6bfb2f30b2212a661157 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Apr 2019 17:45:12 +0200 Subject: [PATCH] (UI/QT) Dehardcode some more additions --- menu/menu_setting.c | 1 + ui/drivers/qt/options/latency.cpp | 31 +++++------ ui/drivers/qt/options/playlists.cpp | 14 +++-- ui/drivers/qt/options/video.cpp | 82 ++++++++++++++--------------- 4 files changed, 61 insertions(+), 67 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 15757e38b7..c0f3e9b34c 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -7794,6 +7794,7 @@ static bool setting_append_list( parent_group, general_write_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].offset_by = 1; menu_settings_list_current_add_range(list, list_info, 1, 6, 1, true, true); diff --git a/ui/drivers/qt/options/latency.cpp b/ui/drivers/qt/options/latency.cpp index 664e0785a2..ffecde9f21 100644 --- a/ui/drivers/qt/options/latency.cpp +++ b/ui/drivers/qt/options/latency.cpp @@ -23,32 +23,27 @@ LatencyPage::LatencyPage(QObject *parent) : QWidget *LatencyPage::widget() { - QWidget *widget = new QWidget; - - FormLayout *layout = new FormLayout; - + QWidget *widget = new QWidget; + FormLayout *layout = new FormLayout; CheckableSettingsGroup *runAheadGpuSync = new CheckableSettingsGroup(MENU_ENUM_LABEL_RUN_AHEAD_ENABLED); + rarch_setting_t *hardSyncSetting = menu_setting_find_enum(MENU_ENUM_LABEL_VIDEO_HARD_SYNC); + if (hardSyncSetting) { - rarch_setting_t *hardSyncSetting = menu_setting_find_enum(MENU_ENUM_LABEL_VIDEO_HARD_SYNC); + CheckableSettingsGroup *hardSyncGroup = new CheckableSettingsGroup(hardSyncSetting); - if (hardSyncSetting) - { - CheckableSettingsGroup *hardSyncGroup = new CheckableSettingsGroup(hardSyncSetting); + hardSyncGroup->add(MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES); - hardSyncGroup->addUIntSpinBox(MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES); - - layout->addRow(hardSyncGroup); - } + layout->addRow(hardSyncGroup); } - layout->addUIntSpinBox(MENU_ENUM_LABEL_VIDEO_FRAME_DELAY); - layout->addUIntSpinBox(MENU_ENUM_LABEL_AUDIO_LATENCY); - layout->addUIntComboBox(MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR); + layout->add(MENU_ENUM_LABEL_VIDEO_FRAME_DELAY); + layout->add(MENU_ENUM_LABEL_AUDIO_LATENCY); + layout->add(MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR); - runAheadGpuSync->addUIntComboBox(MENU_ENUM_LABEL_RUN_AHEAD_FRAMES); - runAheadGpuSync->addCheckBox(MENU_ENUM_LABEL_RUN_AHEAD_SECONDARY_INSTANCE); - runAheadGpuSync->addCheckBox(MENU_ENUM_LABEL_RUN_AHEAD_HIDE_WARNINGS); + runAheadGpuSync->add(MENU_ENUM_LABEL_RUN_AHEAD_FRAMES); + runAheadGpuSync->add(MENU_ENUM_LABEL_RUN_AHEAD_SECONDARY_INSTANCE); + runAheadGpuSync->add(MENU_ENUM_LABEL_RUN_AHEAD_HIDE_WARNINGS); layout->addRow(runAheadGpuSync); widget->setLayout(layout); diff --git a/ui/drivers/qt/options/playlists.cpp b/ui/drivers/qt/options/playlists.cpp index 3670684b5b..63c74368b5 100644 --- a/ui/drivers/qt/options/playlists.cpp +++ b/ui/drivers/qt/options/playlists.cpp @@ -23,19 +23,17 @@ PlaylistsPage::PlaylistsPage(QObject *parent) : QWidget *PlaylistsPage::widget() { - QWidget *widget = new QWidget; - - FormLayout *layout = new FormLayout; - + QWidget *widget = new QWidget; + FormLayout *layout = new FormLayout; CheckableSettingsGroup *history = new CheckableSettingsGroup(MENU_ENUM_LABEL_HISTORY_LIST_ENABLE); - history->addUIntSpinBox(MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE); + history->add(MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE); layout->addRow(history); - layout->addCheckBox(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME); - layout->addCheckBox(MENU_ENUM_LABEL_PLAYLIST_ENTRY_REMOVE); - layout->addCheckBox(MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT); + layout->add(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME); + layout->add(MENU_ENUM_LABEL_PLAYLIST_ENTRY_REMOVE); + layout->add(MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT); widget->setLayout(layout); diff --git a/ui/drivers/qt/options/video.cpp b/ui/drivers/qt/options/video.cpp index b962a8e97c..a948277118 100644 --- a/ui/drivers/qt/options/video.cpp +++ b/ui/drivers/qt/options/video.cpp @@ -36,36 +36,36 @@ VideoPage::VideoPage(QObject *parent) : QWidget *VideoPage::widget() { - QWidget *widget = new QWidget; + QWidget *widget = new QWidget; - QVBoxLayout *layout = new QVBoxLayout; + QVBoxLayout *layout = new QVBoxLayout; - SettingsGroup *outputGroup = new SettingsGroup("Output"); - SettingsGroup *aspectGroup = new SettingsGroup("Scaling"); + SettingsGroup *outputGroup = new SettingsGroup("Output"); + SettingsGroup *aspectGroup = new SettingsGroup("Scaling"); - SettingsGroup *fullscreenGroup = new SettingsGroup("Fullscreen Mode"); - SettingsGroup *windowedGroup = new SettingsGroup("Windowed Mode"); + SettingsGroup *fullscreenGroup = new SettingsGroup("Fullscreen Mode"); + SettingsGroup *windowedGroup = new SettingsGroup("Windowed Mode"); - QHBoxLayout *fullcreenSizeLayout = new QHBoxLayout; - FormLayout *leftFullscreenSizeForm = new FormLayout; + QHBoxLayout *fullcreenSizeLayout = new QHBoxLayout; + FormLayout *leftFullscreenSizeForm = new FormLayout; FormLayout *rightFullscreenSizeForm = new FormLayout; - QHBoxLayout *windowedSizeLayout = new QHBoxLayout; - FormLayout *leftWindowedSizeForm = new FormLayout; - FormLayout *rightWindowedSizeForm = new FormLayout; + QHBoxLayout *windowedSizeLayout = new QHBoxLayout; + FormLayout *leftWindowedSizeForm = new FormLayout; + FormLayout *rightWindowedSizeForm = new FormLayout; - SettingsGroup *syncGroup = new SettingsGroup("Synchronization"); - CheckableSettingsGroup *vSyncGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_VIDEO_VSYNC); + SettingsGroup *syncGroup = new SettingsGroup("Synchronization"); + CheckableSettingsGroup *vSyncGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_VIDEO_VSYNC); - QHBoxLayout *outputScalingLayout = new QHBoxLayout; - QHBoxLayout *modeLayout = new QHBoxLayout; - QHBoxLayout *syncMiscLayout = new QHBoxLayout; + QHBoxLayout *outputScalingLayout = new QHBoxLayout; + QHBoxLayout *modeLayout = new QHBoxLayout; + QHBoxLayout *syncMiscLayout = new QHBoxLayout; - SettingsGroup *miscGroup = new SettingsGroup("Miscellaneous"); - SettingsGroup *filterGroup = new SettingsGroup("Video Filter"); + SettingsGroup *miscGroup = new SettingsGroup("Miscellaneous"); + SettingsGroup *filterGroup = new SettingsGroup("Video Filter"); - unsigned i, size = 0; - struct video_display_config *list = (struct video_display_config*) video_display_server_get_resolution_list(&size); + unsigned i, size = 0; + struct video_display_config *list = (struct video_display_config*) video_display_server_get_resolution_list(&size); if (list) { @@ -84,14 +84,14 @@ QWidget *VideoPage::widget() free(list); } - outputGroup->addStringComboBox(MENU_ENUM_LABEL_VIDEO_DRIVER); - outputGroup->addUIntSpinBox(MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX); - outputGroup->addUIntComboBox(MENU_ENUM_LABEL_VIDEO_ROTATION); + outputGroup->add(MENU_ENUM_LABEL_VIDEO_DRIVER); + outputGroup->add(MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX); + outputGroup->add(MENU_ENUM_LABEL_VIDEO_ROTATION); outputGroup->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION), m_resolutionCombo); - outputGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE); + outputGroup->add(MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE); - fullscreenGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_FULLSCREEN); - fullscreenGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN); + fullscreenGroup->add(MENU_ENUM_LABEL_VIDEO_FULLSCREEN); + fullscreenGroup->add(MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN); leftFullscreenSizeForm->addRow("Width:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_FULLSCREEN_X)); rightFullscreenSizeForm->addRow("Height:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_FULLSCREEN_Y)); @@ -101,7 +101,7 @@ QWidget *VideoPage::widget() fullscreenGroup->addRow(fullcreenSizeLayout); - aspectGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER); + aspectGroup->add(MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER); aspectGroup->addRow(new AspectRatioGroup("Aspect Ratio")); leftWindowedSizeForm->addRow("Scale:", new FloatSpinBox(MENU_ENUM_LABEL_VIDEO_SCALE)); @@ -115,12 +115,12 @@ QWidget *VideoPage::widget() windowedGroup->addRow(windowedSizeLayout); - windowedGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS); - windowedGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION); + windowedGroup->add(MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS); + windowedGroup->add(MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION); - vSyncGroup->addUIntSpinBox(MENU_ENUM_LABEL_VIDEO_SWAP_INTERVAL); - vSyncGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_ADAPTIVE_VSYNC); - vSyncGroup->addUIntSpinBox(MENU_ENUM_LABEL_VIDEO_FRAME_DELAY); + vSyncGroup->add(MENU_ENUM_LABEL_VIDEO_SWAP_INTERVAL); + vSyncGroup->add(MENU_ENUM_LABEL_VIDEO_ADAPTIVE_VSYNC); + vSyncGroup->add(MENU_ENUM_LABEL_VIDEO_FRAME_DELAY); syncGroup->addRow(vSyncGroup); { @@ -130,25 +130,25 @@ QWidget *VideoPage::widget() { CheckableSettingsGroup *hardSyncGroup = new CheckableSettingsGroup(hardSyncSetting); - hardSyncGroup->addUIntSpinBox(hardSyncSetting->enum_idx); + hardSyncGroup->add(MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES); syncGroup->addRow(hardSyncGroup); } } - syncGroup->addUIntSpinBox(MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES); + syncGroup->add(MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES); - miscGroup->addCheckBox(MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE); - miscGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_THREADED); - miscGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION); - miscGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT); - miscGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_CROP_OVERSCAN); - miscGroup->addCheckBox(MENU_ENUM_LABEL_VIDEO_SMOOTH); + miscGroup->add(MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE); + miscGroup->add(MENU_ENUM_LABEL_VIDEO_THREADED); + miscGroup->add(MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION); + miscGroup->add(MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT); + miscGroup->add(MENU_ENUM_LABEL_VIDEO_CROP_OVERSCAN); + miscGroup->add(MENU_ENUM_LABEL_VIDEO_SMOOTH); syncMiscLayout->addWidget(syncGroup); syncMiscLayout->addWidget(miscGroup); - filterGroup->addFileSelector(MENU_ENUM_LABEL_VIDEO_FILTER); + filterGroup->add(MENU_ENUM_LABEL_VIDEO_FILTER); modeLayout->addWidget(fullscreenGroup); modeLayout->addWidget(windowedGroup);