lime3ds-gui: move Layout section to its own tab called Layout

This commit is contained in:
Reg Tiangha 2024-04-30 11:19:57 -06:00 committed by OpenSauce
parent ad1d545890
commit ab30f76444
9 changed files with 604 additions and 454 deletions

View File

@ -48,6 +48,9 @@ add_executable(lime-qt
configuration/configure_enhancements.cpp configuration/configure_enhancements.cpp
configuration/configure_enhancements.h configuration/configure_enhancements.h
configuration/configure_enhancements.ui configuration/configure_enhancements.ui
configuration/configure_layout.cpp
configuration/configure_layout.h
configuration/configure_layout.ui
configuration/configure_dialog.cpp configuration/configure_dialog.cpp
configuration/configure_dialog.h configuration/configure_dialog.h
configuration/configure_general.cpp configuration/configure_general.cpp

View File

@ -15,6 +15,7 @@
#include "lime_qt/configuration/configure_graphics.h" #include "lime_qt/configuration/configure_graphics.h"
#include "lime_qt/configuration/configure_hotkeys.h" #include "lime_qt/configuration/configure_hotkeys.h"
#include "lime_qt/configuration/configure_input.h" #include "lime_qt/configuration/configure_input.h"
#include "lime_qt/configuration/configure_layout.h"
#include "lime_qt/configuration/configure_storage.h" #include "lime_qt/configuration/configure_storage.h"
#include "lime_qt/configuration/configure_system.h" #include "lime_qt/configuration/configure_system.h"
#include "lime_qt/configuration/configure_ui.h" #include "lime_qt/configuration/configure_ui.h"
@ -34,6 +35,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, Cor
graphics_tab{ graphics_tab{
std::make_unique<ConfigureGraphics>(gl_renderer, physical_devices, is_powered_on, this)}, std::make_unique<ConfigureGraphics>(gl_renderer, physical_devices, is_powered_on, this)},
enhancements_tab{std::make_unique<ConfigureEnhancements>(this)}, enhancements_tab{std::make_unique<ConfigureEnhancements>(this)},
layout_tab{std::make_unique<ConfigureLayout>(this)},
audio_tab{std::make_unique<ConfigureAudio>(is_powered_on, this)}, audio_tab{std::make_unique<ConfigureAudio>(is_powered_on, this)},
camera_tab{std::make_unique<ConfigureCamera>(this)}, camera_tab{std::make_unique<ConfigureCamera>(this)},
debug_tab{std::make_unique<ConfigureDebug>(is_powered_on, this)}, debug_tab{std::make_unique<ConfigureDebug>(is_powered_on, this)},
@ -49,6 +51,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, Cor
ui->tabWidget->addTab(hotkeys_tab.get(), tr("Hotkeys")); ui->tabWidget->addTab(hotkeys_tab.get(), tr("Hotkeys"));
ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics")); ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
ui->tabWidget->addTab(enhancements_tab.get(), tr("Enhancements")); ui->tabWidget->addTab(enhancements_tab.get(), tr("Enhancements"));
ui->tabWidget->addTab(layout_tab.get(), tr("Layout"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio")); ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
ui->tabWidget->addTab(camera_tab.get(), tr("Camera")); ui->tabWidget->addTab(camera_tab.get(), tr("Camera"));
ui->tabWidget->addTab(debug_tab.get(), tr("Debug")); ui->tabWidget->addTab(debug_tab.get(), tr("Debug"));
@ -86,6 +89,7 @@ void ConfigureDialog::SetConfiguration() {
input_tab->LoadConfiguration(); input_tab->LoadConfiguration();
graphics_tab->SetConfiguration(); graphics_tab->SetConfiguration();
enhancements_tab->SetConfiguration(); enhancements_tab->SetConfiguration();
layout_tab->SetConfiguration();
audio_tab->SetConfiguration(); audio_tab->SetConfiguration();
camera_tab->SetConfiguration(); camera_tab->SetConfiguration();
debug_tab->SetConfiguration(); debug_tab->SetConfiguration();
@ -102,6 +106,7 @@ void ConfigureDialog::ApplyConfiguration() {
hotkeys_tab->ApplyConfiguration(registry); hotkeys_tab->ApplyConfiguration(registry);
graphics_tab->ApplyConfiguration(); graphics_tab->ApplyConfiguration();
enhancements_tab->ApplyConfiguration(); enhancements_tab->ApplyConfiguration();
layout_tab->ApplyConfiguration();
audio_tab->ApplyConfiguration(); audio_tab->ApplyConfiguration();
camera_tab->ApplyConfiguration(); camera_tab->ApplyConfiguration();
debug_tab->ApplyConfiguration(); debug_tab->ApplyConfiguration();
@ -120,7 +125,7 @@ void ConfigureDialog::PopulateSelectionList() {
const std::array<std::pair<QString, QList<QWidget*>>, 5> items{ const std::array<std::pair<QString, QList<QWidget*>>, 5> items{
{{tr("General"), {general_tab.get(), web_tab.get(), debug_tab.get(), ui_tab.get()}}, {{tr("General"), {general_tab.get(), web_tab.get(), debug_tab.get(), ui_tab.get()}},
{tr("System"), {system_tab.get(), camera_tab.get(), storage_tab.get()}}, {tr("System"), {system_tab.get(), camera_tab.get(), storage_tab.get()}},
{tr("Graphics"), {enhancements_tab.get(), graphics_tab.get()}}, {tr("Graphics"), {enhancements_tab.get(), layout_tab.get(), graphics_tab.get()}},
{tr("Audio"), {audio_tab.get()}}, {tr("Audio"), {audio_tab.get()}},
{tr("Controls"), {input_tab.get(), hotkeys_tab.get()}}}}; {tr("Controls"), {input_tab.get(), hotkeys_tab.get()}}}};
@ -155,6 +160,7 @@ void ConfigureDialog::RetranslateUI() {
hotkeys_tab->RetranslateUI(); hotkeys_tab->RetranslateUI();
graphics_tab->RetranslateUI(); graphics_tab->RetranslateUI();
enhancements_tab->RetranslateUI(); enhancements_tab->RetranslateUI();
layout_tab->RetranslateUI();
audio_tab->RetranslateUI(); audio_tab->RetranslateUI();
camera_tab->RetranslateUI(); camera_tab->RetranslateUI();
debug_tab->RetranslateUI(); debug_tab->RetranslateUI();
@ -173,6 +179,7 @@ void ConfigureDialog::UpdateVisibleTabs() {
{input_tab.get(), tr("Input")}, {input_tab.get(), tr("Input")},
{hotkeys_tab.get(), tr("Hotkeys")}, {hotkeys_tab.get(), tr("Hotkeys")},
{enhancements_tab.get(), tr("Enhancements")}, {enhancements_tab.get(), tr("Enhancements")},
{layout_tab.get(), tr("Layout")},
{graphics_tab.get(), tr("Advanced")}, {graphics_tab.get(), tr("Advanced")},
{audio_tab.get(), tr("Audio")}, {audio_tab.get(), tr("Audio")},
{camera_tab.get(), tr("Camera")}, {camera_tab.get(), tr("Camera")},

View File

@ -24,6 +24,7 @@ class ConfigureSystem;
class ConfigureInput; class ConfigureInput;
class ConfigureHotkeys; class ConfigureHotkeys;
class ConfigureGraphics; class ConfigureGraphics;
class ConfigureLayout;
class ConfigureEnhancements; class ConfigureEnhancements;
class ConfigureAudio; class ConfigureAudio;
class ConfigureCamera; class ConfigureCamera;
@ -66,6 +67,7 @@ private:
std::unique_ptr<ConfigureHotkeys> hotkeys_tab; std::unique_ptr<ConfigureHotkeys> hotkeys_tab;
std::unique_ptr<ConfigureGraphics> graphics_tab; std::unique_ptr<ConfigureGraphics> graphics_tab;
std::unique_ptr<ConfigureEnhancements> enhancements_tab; std::unique_ptr<ConfigureEnhancements> enhancements_tab;
std::unique_ptr<ConfigureLayout> layout_tab;
std::unique_ptr<ConfigureAudio> audio_tab; std::unique_ptr<ConfigureAudio> audio_tab;
std::unique_ptr<ConfigureCamera> camera_tab; std::unique_ptr<ConfigureCamera> camera_tab;
std::unique_ptr<ConfigureDebug> debug_tab; std::unique_ptr<ConfigureDebug> debug_tab;

View File

@ -18,37 +18,15 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
SetupPerGameUI(); SetupPerGameUI();
SetConfiguration(); SetConfiguration();
ui->layout_group->setEnabled(!Settings::values.custom_layout);
const auto graphics_api = Settings::values.graphics_api.GetValue(); const auto graphics_api = Settings::values.graphics_api.GetValue();
const bool res_scale_enabled = graphics_api != Settings::GraphicsAPI::Software; const bool res_scale_enabled = graphics_api != Settings::GraphicsAPI::Software;
ui->resolution_factor_combobox->setEnabled(res_scale_enabled); ui->resolution_factor_combobox->setEnabled(res_scale_enabled);
ui->custom_layout_group->setEnabled(
(Settings::values.layout_option.GetValue() == Settings::LayoutOption::CustomLayout));
connect(ui->layout_combobox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
[this](int currentIndex) {
ui->custom_layout_group->setEnabled(ui->layout_combobox->currentIndex() == 5);
});
connect(ui->render_3d_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this, connect(ui->render_3d_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this,
[this](int currentIndex) { [this](int currentIndex) {
updateShaders(static_cast<Settings::StereoRenderOption>(currentIndex)); updateShaders(static_cast<Settings::StereoRenderOption>(currentIndex));
}); });
connect(ui->bg_button, &QPushButton::clicked, this, [this] {
const QColor new_bg_color = QColorDialog::getColor(bg_color);
if (!new_bg_color.isValid()) {
return;
}
bg_color = new_bg_color;
QPixmap pixmap(ui->bg_button->size());
pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
});
ui->toggle_preload_textures->setEnabled(ui->toggle_custom_textures->isChecked()); ui->toggle_preload_textures->setEnabled(ui->toggle_custom_textures->isChecked());
ui->toggle_async_custom_loading->setEnabled(ui->toggle_custom_textures->isChecked()); ui->toggle_async_custom_loading->setEnabled(ui->toggle_custom_textures->isChecked());
connect(ui->toggle_custom_textures, &QCheckBox::toggled, this, [this] { connect(ui->toggle_custom_textures, &QCheckBox::toggled, this, [this] {
@ -70,13 +48,9 @@ void ConfigureEnhancements::SetConfiguration() {
&Settings::values.texture_filter); &Settings::values.texture_filter);
ConfigurationShared::SetHighlight(ui->widget_texture_filter, ConfigurationShared::SetHighlight(ui->widget_texture_filter,
!Settings::values.texture_filter.UsingGlobal()); !Settings::values.texture_filter.UsingGlobal());
ConfigurationShared::SetPerGameSetting(ui->layout_combobox,
&Settings::values.layout_option);
} else { } else {
ui->resolution_factor_combobox->setCurrentIndex( ui->resolution_factor_combobox->setCurrentIndex(
Settings::values.resolution_factor.GetValue()); Settings::values.resolution_factor.GetValue());
ui->layout_combobox->setCurrentIndex(
static_cast<int>(Settings::values.layout_option.GetValue()));
ui->texture_filter_combobox->setCurrentIndex( ui->texture_filter_combobox->setCurrentIndex(
static_cast<int>(Settings::values.texture_filter.GetValue())); static_cast<int>(Settings::values.texture_filter.GetValue()));
} }
@ -88,30 +62,10 @@ void ConfigureEnhancements::SetConfiguration() {
static_cast<int>(Settings::values.mono_render_option.GetValue())); static_cast<int>(Settings::values.mono_render_option.GetValue()));
updateShaders(Settings::values.render_3d.GetValue()); updateShaders(Settings::values.render_3d.GetValue());
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue()); ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue());
ui->toggle_swap_screen->setChecked(Settings::values.swap_screen.GetValue());
ui->toggle_upright_screen->setChecked(Settings::values.upright_screen.GetValue());
ui->large_screen_proportion->setValue(Settings::values.large_screen_proportion.GetValue());
ui->custom_top_left->setValue(Settings::values.custom_top_left.GetValue());
ui->custom_top_top->setValue(Settings::values.custom_top_top.GetValue());
ui->custom_top_right->setValue(Settings::values.custom_top_right.GetValue());
ui->custom_top_bottom->setValue(Settings::values.custom_top_bottom.GetValue());
ui->custom_bottom_left->setValue(Settings::values.custom_bottom_left.GetValue());
ui->custom_bottom_top->setValue(Settings::values.custom_bottom_top.GetValue());
ui->custom_bottom_right->setValue(Settings::values.custom_bottom_right.GetValue());
ui->custom_bottom_bottom->setValue(Settings::values.custom_bottom_bottom.GetValue());
ui->custom_second_layer_opacity->setValue(
Settings::values.custom_second_layer_opacity.GetValue());
ui->toggle_dump_textures->setChecked(Settings::values.dump_textures.GetValue()); ui->toggle_dump_textures->setChecked(Settings::values.dump_textures.GetValue());
ui->toggle_custom_textures->setChecked(Settings::values.custom_textures.GetValue()); ui->toggle_custom_textures->setChecked(Settings::values.custom_textures.GetValue());
ui->toggle_preload_textures->setChecked(Settings::values.preload_textures.GetValue()); ui->toggle_preload_textures->setChecked(Settings::values.preload_textures.GetValue());
ui->toggle_async_custom_loading->setChecked(Settings::values.async_custom_loading.GetValue()); ui->toggle_async_custom_loading->setChecked(Settings::values.async_custom_loading.GetValue());
bg_color =
QColor::fromRgbF(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(),
Settings::values.bg_blue.GetValue());
QPixmap pixmap(ui->bg_button->size());
pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
} }
void ConfigureEnhancements::updateShaders(Settings::StereoRenderOption stereo_option) { void ConfigureEnhancements::updateShaders(Settings::StereoRenderOption stereo_option) {
@ -166,27 +120,11 @@ void ConfigureEnhancements::ApplyConfiguration() {
Settings::values.pp_shader_name = Settings::values.pp_shader_name =
ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString(); ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString();
} }
Settings::values.large_screen_proportion = ui->large_screen_proportion->value();
Settings::values.custom_top_left = ui->custom_top_left->value();
Settings::values.custom_top_top = ui->custom_top_top->value();
Settings::values.custom_top_right = ui->custom_top_right->value();
Settings::values.custom_top_bottom = ui->custom_top_bottom->value();
Settings::values.custom_bottom_left = ui->custom_bottom_left->value();
Settings::values.custom_bottom_top = ui->custom_bottom_top->value();
Settings::values.custom_bottom_right = ui->custom_bottom_right->value();
Settings::values.custom_bottom_bottom = ui->custom_bottom_bottom->value();
Settings::values.custom_second_layer_opacity = ui->custom_second_layer_opacity->value();
ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode, ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode,
ui->toggle_linear_filter, linear_filter); ui->toggle_linear_filter, linear_filter);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.texture_filter, ConfigurationShared::ApplyPerGameSetting(&Settings::values.texture_filter,
ui->texture_filter_combobox); ui->texture_filter_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.layout_option, ui->layout_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.swap_screen, ui->toggle_swap_screen,
swap_screen);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.upright_screen,
ui->toggle_upright_screen, upright_screen);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.dump_textures, ConfigurationShared::ApplyPerGameSetting(&Settings::values.dump_textures,
ui->toggle_dump_textures, dump_textures); ui->toggle_dump_textures, dump_textures);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.custom_textures, ConfigurationShared::ApplyPerGameSetting(&Settings::values.custom_textures,
@ -195,10 +133,6 @@ void ConfigureEnhancements::ApplyConfiguration() {
ui->toggle_preload_textures, preload_textures); ui->toggle_preload_textures, preload_textures);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.async_custom_loading, ConfigurationShared::ApplyPerGameSetting(&Settings::values.async_custom_loading,
ui->toggle_async_custom_loading, async_custom_loading); ui->toggle_async_custom_loading, async_custom_loading);
Settings::values.bg_red = static_cast<float>(bg_color.redF());
Settings::values.bg_green = static_cast<float>(bg_color.greenF());
Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
} }
void ConfigureEnhancements::SetupPerGameUI() { void ConfigureEnhancements::SetupPerGameUI() {
@ -207,8 +141,6 @@ void ConfigureEnhancements::SetupPerGameUI() {
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal()); ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal()); ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal());
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal()); ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
ui->toggle_swap_screen->setEnabled(Settings::values.swap_screen.UsingGlobal());
ui->toggle_upright_screen->setEnabled(Settings::values.upright_screen.UsingGlobal());
ui->toggle_dump_textures->setEnabled(Settings::values.dump_textures.UsingGlobal()); ui->toggle_dump_textures->setEnabled(Settings::values.dump_textures.UsingGlobal());
ui->toggle_custom_textures->setEnabled(Settings::values.custom_textures.UsingGlobal()); ui->toggle_custom_textures->setEnabled(Settings::values.custom_textures.UsingGlobal());
ui->toggle_preload_textures->setEnabled(Settings::values.preload_textures.UsingGlobal()); ui->toggle_preload_textures->setEnabled(Settings::values.preload_textures.UsingGlobal());
@ -219,14 +151,9 @@ void ConfigureEnhancements::SetupPerGameUI() {
ui->stereo_group->setVisible(false); ui->stereo_group->setVisible(false);
ui->widget_shader->setVisible(false); ui->widget_shader->setVisible(false);
ui->bg_color_group->setVisible(false);
ConfigurationShared::SetColoredTristate(ui->toggle_linear_filter, Settings::values.filter_mode, ConfigurationShared::SetColoredTristate(ui->toggle_linear_filter, Settings::values.filter_mode,
linear_filter); linear_filter);
ConfigurationShared::SetColoredTristate(ui->toggle_swap_screen, Settings::values.swap_screen,
swap_screen);
ConfigurationShared::SetColoredTristate(ui->toggle_upright_screen,
Settings::values.upright_screen, upright_screen);
ConfigurationShared::SetColoredTristate(ui->toggle_dump_textures, ConfigurationShared::SetColoredTristate(ui->toggle_dump_textures,
Settings::values.dump_textures, dump_textures); Settings::values.dump_textures, dump_textures);
ConfigurationShared::SetColoredTristate(ui->toggle_custom_textures, ConfigurationShared::SetColoredTristate(ui->toggle_custom_textures,
@ -244,8 +171,4 @@ void ConfigureEnhancements::SetupPerGameUI() {
ConfigurationShared::SetColoredComboBox( ConfigurationShared::SetColoredComboBox(
ui->texture_filter_combobox, ui->widget_texture_filter, ui->texture_filter_combobox, ui->widget_texture_filter,
static_cast<int>(Settings::values.texture_filter.GetValue(true))); static_cast<int>(Settings::values.texture_filter.GetValue(true)));
ConfigurationShared::SetColoredComboBox(
ui->layout_combobox, ui->widget_layout,
static_cast<int>(Settings::values.layout_option.GetValue(true)));
} }

View File

@ -39,8 +39,6 @@ private:
std::unique_ptr<Ui::ConfigureEnhancements> ui; std::unique_ptr<Ui::ConfigureEnhancements> ui;
ConfigurationShared::CheckState linear_filter; ConfigurationShared::CheckState linear_filter;
ConfigurationShared::CheckState swap_screen;
ConfigurationShared::CheckState upright_screen;
ConfigurationShared::CheckState dump_textures; ConfigurationShared::CheckState dump_textures;
ConfigurationShared::CheckState custom_textures; ConfigurationShared::CheckState custom_textures;
ConfigurationShared::CheckState preload_textures; ConfigurationShared::CheckState preload_textures;

View File

@ -335,375 +335,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="layout_group">
<property name="title">
<string>Layout</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QWidget" name="widget_layout" native="true">
<layout class="QHBoxLayout" name="screen_layout_group">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="layout_label">
<property name="text">
<string>Screen Layout:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="layout_combobox">
<item>
<property name="text">
<string>Default</string>
</property>
</item>
<item>
<property name="text">
<string>Single Screen</string>
</property>
</item>
<item>
<property name="text">
<string>Large Screen</string>
</property>
</item>
<item>
<property name="text">
<string>Side by Side</string>
</property>
</item>
<item>
<property name="text">
<string>Separate Windows</string>
</property>
</item>
<item>
<property name="text">
<string>Custom Layout</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_swap_screen">
<property name="text">
<string>Swap Screens</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_upright_screen">
<property name="text">
<string>Rotate Screens Upright</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="proportion_layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Large Screen Proportion:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="large_screen_proportion">
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>16.000000000000000</double>
</property>
<property name="value">
<double>4.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="bg_color_group" native="true">
<layout class="QHBoxLayout" name="bg_color_group_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="bg_label">
<property name="text">
<string>Background Color:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bg_button">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="custom_layout_group">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Custom Layout</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QGroupBox" name="gb_top_screen">
<property name="title">
<string>Top Screen</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="lb_top_left">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="custom_top_left">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_top_top">
<property name="text">
<string>Top</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="custom_top_top">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lb_top_right">
<property name="text">
<string>Right</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="custom_top_right">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lb_top_bottom">
<property name="text">
<string>Bottom</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="custom_top_bottom">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_bottom_screen">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Bottom Screen</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lb_bottom_left">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="custom_bottom_left">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_bottom_top">
<property name="text">
<string>Top</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="custom_bottom_top">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lb_bottom_right">
<property name="text">
<string>Right</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="custom_bottom_right">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lb_bottom_bottom">
<property name="text">
<string>Bottom</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="custom_bottom_bottom">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;NOTE: Values are in pixels starting from the top left corner of the display. Positive numbers only.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="lb_opacity_second_layer">
<property name="text">
<string>Bottom Screen Opacity (OpenGL Only):</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="custom_second_layer_opacity">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::PlusMinus</enum>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="utilityBox"> <widget class="QGroupBox" name="utilityBox">
<property name="title"> <property name="title">
@ -767,11 +398,6 @@
<tabstop>render_3d_combobox</tabstop> <tabstop>render_3d_combobox</tabstop>
<tabstop>factor_3d</tabstop> <tabstop>factor_3d</tabstop>
<tabstop>mono_rendering_eye</tabstop> <tabstop>mono_rendering_eye</tabstop>
<tabstop>layout_combobox</tabstop>
<tabstop>toggle_swap_screen</tabstop>
<tabstop>toggle_upright_screen</tabstop>
<tabstop>large_screen_proportion</tabstop>
<tabstop>bg_button</tabstop>
<tabstop>toggle_custom_textures</tabstop> <tabstop>toggle_custom_textures</tabstop>
<tabstop>toggle_dump_textures</tabstop> <tabstop>toggle_dump_textures</tabstop>
<tabstop>toggle_preload_textures</tabstop> <tabstop>toggle_preload_textures</tabstop>

View File

@ -0,0 +1,124 @@
// Copyright 2019 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <QColorDialog>
#include "common/settings.h"
#include "lime_qt/configuration/configuration_shared.h"
#include "lime_qt/configuration/configure_layout.h"
#include "ui_configure_layout.h"
#ifdef ENABLE_OPENGL
#include "video_core/renderer_opengl/post_processing_opengl.h"
#endif
ConfigureLayout::ConfigureLayout(QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureLayout>()) {
ui->setupUi(this);
SetupPerGameUI();
SetConfiguration();
ui->layout_group->setEnabled(!Settings::values.custom_layout);
ui->custom_layout_group->setEnabled(
(Settings::values.layout_option.GetValue() == Settings::LayoutOption::CustomLayout));
connect(ui->layout_combobox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
[this](int currentIndex) {
ui->custom_layout_group->setEnabled(ui->layout_combobox->currentIndex() == 5);
});
connect(ui->bg_button, &QPushButton::clicked, this, [this] {
const QColor new_bg_color = QColorDialog::getColor(bg_color);
if (!new_bg_color.isValid()) {
return;
}
bg_color = new_bg_color;
QPixmap pixmap(ui->bg_button->size());
pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
});
}
ConfigureLayout::~ConfigureLayout() = default;
void ConfigureLayout::SetConfiguration() {
if (!Settings::IsConfiguringGlobal()) {
ConfigurationShared::SetPerGameSetting(ui->layout_combobox,
&Settings::values.layout_option);
} else {
ui->layout_combobox->setCurrentIndex(
static_cast<int>(Settings::values.layout_option.GetValue()));
}
ui->toggle_swap_screen->setChecked(Settings::values.swap_screen.GetValue());
ui->toggle_upright_screen->setChecked(Settings::values.upright_screen.GetValue());
ui->large_screen_proportion->setValue(Settings::values.large_screen_proportion.GetValue());
ui->custom_top_left->setValue(Settings::values.custom_top_left.GetValue());
ui->custom_top_top->setValue(Settings::values.custom_top_top.GetValue());
ui->custom_top_right->setValue(Settings::values.custom_top_right.GetValue());
ui->custom_top_bottom->setValue(Settings::values.custom_top_bottom.GetValue());
ui->custom_bottom_left->setValue(Settings::values.custom_bottom_left.GetValue());
ui->custom_bottom_top->setValue(Settings::values.custom_bottom_top.GetValue());
ui->custom_bottom_right->setValue(Settings::values.custom_bottom_right.GetValue());
ui->custom_bottom_bottom->setValue(Settings::values.custom_bottom_bottom.GetValue());
ui->custom_second_layer_opacity->setValue(
Settings::values.custom_second_layer_opacity.GetValue());
bg_color =
QColor::fromRgbF(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(),
Settings::values.bg_blue.GetValue());
QPixmap pixmap(ui->bg_button->size());
pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
}
void ConfigureLayout::RetranslateUI() {
ui->retranslateUi(this);
}
void ConfigureLayout::ApplyConfiguration() {
Settings::values.large_screen_proportion = ui->large_screen_proportion->value();
Settings::values.custom_top_left = ui->custom_top_left->value();
Settings::values.custom_top_top = ui->custom_top_top->value();
Settings::values.custom_top_right = ui->custom_top_right->value();
Settings::values.custom_top_bottom = ui->custom_top_bottom->value();
Settings::values.custom_bottom_left = ui->custom_bottom_left->value();
Settings::values.custom_bottom_top = ui->custom_bottom_top->value();
Settings::values.custom_bottom_right = ui->custom_bottom_right->value();
Settings::values.custom_bottom_bottom = ui->custom_bottom_bottom->value();
Settings::values.custom_second_layer_opacity = ui->custom_second_layer_opacity->value();
ConfigurationShared::ApplyPerGameSetting(&Settings::values.layout_option, ui->layout_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.swap_screen, ui->toggle_swap_screen,
swap_screen);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.upright_screen,
ui->toggle_upright_screen, upright_screen);
Settings::values.bg_red = static_cast<float>(bg_color.redF());
Settings::values.bg_green = static_cast<float>(bg_color.greenF());
Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
}
void ConfigureLayout::SetupPerGameUI() {
// Block the global settings if a game is currently running that overrides them
if (Settings::IsConfiguringGlobal()) {
ui->toggle_swap_screen->setEnabled(Settings::values.swap_screen.UsingGlobal());
ui->toggle_upright_screen->setEnabled(Settings::values.upright_screen.UsingGlobal());
return;
}
ui->bg_color_group->setVisible(false);
ConfigurationShared::SetColoredTristate(ui->toggle_swap_screen, Settings::values.swap_screen,
swap_screen);
ConfigurationShared::SetColoredTristate(ui->toggle_upright_screen,
Settings::values.upright_screen, upright_screen);
ConfigurationShared::SetColoredComboBox(
ui->layout_combobox, ui->widget_layout,
static_cast<int>(Settings::values.layout_option.GetValue(true)));
}

View File

@ -0,0 +1,44 @@
// Copyright 2019 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <QWidget>
#include "common/common_types.h"
namespace Settings {
enum class StereoRenderOption : u32;
}
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui {
class ConfigureLayout;
}
class ConfigureLayout : public QWidget {
Q_OBJECT
public:
explicit ConfigureLayout(QWidget* parent = nullptr);
~ConfigureLayout();
void ApplyConfiguration();
void RetranslateUI();
void SetConfiguration();
void SetupPerGameUI();
private:
void updateShaders(Settings::StereoRenderOption stereo_option);
void updateTextureFilter(int index);
std::unique_ptr<Ui::ConfigureLayout> ui;
ConfigurationShared::CheckState swap_screen;
ConfigurationShared::CheckState upright_screen;
QColor bg_color;
};

View File

@ -0,0 +1,423 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigureLayout</class>
<widget class="QWidget" name="ConfigureLayout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>950</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="minimumSize">
<size>
<width>0</width>
<height>480</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>422</width>
<height>932</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="layout_group">
<property name="title">
<string>Screens</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QWidget" name="widget_layout" native="true">
<layout class="QHBoxLayout" name="screen_layout_group">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="layout_label">
<property name="text">
<string>Screen Layout:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="layout_combobox">
<item>
<property name="text">
<string>Default</string>
</property>
</item>
<item>
<property name="text">
<string>Single Screen</string>
</property>
</item>
<item>
<property name="text">
<string>Large Screen</string>
</property>
</item>
<item>
<property name="text">
<string>Side by Side</string>
</property>
</item>
<item>
<property name="text">
<string>Separate Windows</string>
</property>
</item>
<item>
<property name="text">
<string>Custom Layout</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_swap_screen">
<property name="text">
<string>Swap Screens</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_upright_screen">
<property name="text">
<string>Rotate Screens Upright</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="proportion_layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Large Screen Proportion:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="large_screen_proportion">
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>16.000000000000000</double>
</property>
<property name="value">
<double>4.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="bg_color_group" native="true">
<layout class="QHBoxLayout" name="bg_color_group_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="bg_label">
<property name="text">
<string>Background Color:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bg_button">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="custom_layout_group">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Custom Layout</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QGroupBox" name="gb_top_screen">
<property name="title">
<string>Top Screen</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="lb_top_left">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="custom_top_left">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_top_top">
<property name="text">
<string>Top</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="custom_top_top">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lb_top_right">
<property name="text">
<string>Right</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="custom_top_right">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lb_top_bottom">
<property name="text">
<string>Bottom</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="custom_top_bottom">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_bottom_screen">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Bottom Screen</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lb_bottom_left">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="custom_bottom_left">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_bottom_top">
<property name="text">
<string>Top</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="custom_bottom_top">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lb_bottom_right">
<property name="text">
<string>Right</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="custom_bottom_right">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lb_bottom_bottom">
<property name="text">
<string>Bottom</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="custom_bottom_bottom">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lb_opacity_second_layer">
<property name="text">
<string>Bottom Screen Opacity:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="custom_second_layer_opacity">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::PlusMinus</enum>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>layout_combobox</tabstop>
<tabstop>toggle_swap_screen</tabstop>
<tabstop>toggle_upright_screen</tabstop>
<tabstop>large_screen_proportion</tabstop>
<tabstop>bg_button</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>