2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

configure_graphics: Implement highlighted overrides

This commit is contained in:
lat9nq 2020-07-13 21:32:10 -04:00
parent bf25d583c6
commit c4246b80f8
2 changed files with 200 additions and 134 deletions

View file

@ -32,7 +32,12 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
SetConfiguration(); SetConfiguration();
connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this, connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this,
[this] { UpdateDeviceComboBox(); }); [this] {
UpdateDeviceComboBox();
if (!Settings::configuring_global) {
ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX);
}
});
connect(ui->device, qOverload<int>(&QComboBox::activated), this, connect(ui->device, qOverload<int>(&QComboBox::activated), this,
[this](int device) { UpdateDeviceSelection(device); }); [this](int device) { UpdateDeviceSelection(device); });
@ -65,25 +70,23 @@ void ConfigureGraphics::SetConfiguration() {
ui->api->setEnabled(runtime_lock); ui->api->setEnabled(runtime_lock);
ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock);
ui->use_disk_shader_cache->setEnabled(runtime_lock); ui->use_disk_shader_cache->setEnabled(runtime_lock);
ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue());
ui->use_asynchronous_gpu_emulation->setChecked(
Settings::values.use_asynchronous_gpu_emulation.GetValue());
if (Settings::configuring_global) { if (Settings::configuring_global) {
ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue()));
ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue());
ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue());
ui->use_asynchronous_gpu_emulation->setChecked(
Settings::values.use_asynchronous_gpu_emulation.GetValue());
} else { } else {
ConfigurationShared::SetPerGameSetting(ui->use_disk_shader_cache,
&Settings::values.use_disk_shader_cache);
ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_gpu_emulation,
&Settings::values.use_asynchronous_gpu_emulation);
ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend);
ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox, ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox,
&Settings::values.aspect_ratio); &Settings::values.aspect_ratio);
ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1);
ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal());
ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", !Settings::values.aspect_ratio.UsingGlobal());
ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", !Settings::values.bg_red.UsingGlobal());
// FIXME: ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", !Settings::values.renderer_backend.UsingGlobal());
} }
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(),
@ -240,11 +243,23 @@ void ConfigureGraphics::SetupPerGameUI() {
return; return;
} }
connect(ui->aspect_ratio_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [this](int index) {
ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", index != 0);
});
connect(ui->bg_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, connect(ui->bg_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this,
[this](int index) { ui->bg_button->setEnabled(index == 1); }); [this](int index) {
ui->bg_button->setEnabled(index == 1);
ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", index == 1);
});
ui->use_disk_shader_cache->setTristate(true); ConfigurationShared::SetColoredTristate(ui->use_disk_shader_cache, "use_disk_shader_cache",
ui->use_asynchronous_gpu_emulation->setTristate(true); Settings::values.use_disk_shader_cache,
ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox); ConfigurationShared::trackers.use_disk_shader_cache);
ConfigurationShared::InsertGlobalItem(ui->api); ConfigurationShared::SetColoredTristate(
ui->use_asynchronous_gpu_emulation, "use_asynchronous_gpu_emulation",
Settings::values.use_asynchronous_gpu_emulation,
ConfigurationShared::trackers.use_asynchronous_gpu_emulation);
ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox, ui->aspect_ratio_combobox->itemText(Settings::values.aspect_ratio.GetValue(true)));
ConfigurationShared::InsertGlobalItem(ui->api, ui->api->itemText(static_cast<int>(Settings::values.renderer_backend.GetValue(true))));
} }

View file

@ -23,43 +23,57 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <widget class="QWidget" name="api_layout" native="true">
<item> <layout class="QVBoxLayout" name="verticalLayout_5">
<widget class="QLabel" name="label_2"> <property name="leftMargin">
<property name="text"> <number>0</number>
<string>API:</string> </property>
</property> <property name="topMargin">
</widget> <number>0</number>
</item> </property>
<item> <property name="rightMargin">
<widget class="QComboBox" name="api"> <number>0</number>
<item> </property>
<property name="text"> <property name="bottomMargin">
<string notr="true">OpenGL</string> <number>0</number>
</property> </property>
</item> <item>
<item> <layout class="QGridLayout" name="gridLayout">
<property name="text"> <item row="0" column="1">
<string notr="true">Vulkan</string> <widget class="QComboBox" name="api">
</property> <item>
</item> <property name="text">
</widget> <string notr="true">OpenGL</string>
</item> </property>
</layout> </item>
</item> <item>
<item> <property name="text">
<layout class="QHBoxLayout" name="horizontalLayout_5"> <string notr="true">Vulkan</string>
<item> </property>
<widget class="QLabel" name="label_3"> </item>
<property name="text"> </widget>
<string>Device:</string> </item>
</property> <item row="0" column="0">
</widget> <widget class="QLabel" name="label_2">
</item> <property name="text">
<item> <string>API:</string>
<widget class="QComboBox" name="device"/> </property>
</item> </widget>
</layout> </item>
<item row="1" column="1">
<widget class="QComboBox" name="device"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Device:</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -85,96 +99,133 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <widget class="QWidget" name="aspect_ratio_layout" native="true">
<item> <layout class="QHBoxLayout" name="horizontalLayout_6">
<widget class="QLabel" name="ar_label"> <property name="leftMargin">
<property name="text"> <number>0</number>
<string>Aspect Ratio:</string> </property>
</property> <property name="topMargin">
</widget> <number>0</number>
</item> </property>
<item> <property name="rightMargin">
<widget class="QComboBox" name="aspect_ratio_combobox"> <number>0</number>
<item> </property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="ar_label">
<property name="text"> <property name="text">
<string>Default (16:9)</string> <string>Aspect Ratio:</string>
</property> </property>
</item> </widget>
<item> </item>
<property name="text"> <item>
<string>Force 4:3</string> <widget class="QComboBox" name="aspect_ratio_combobox">
</property> <item>
</item> <property name="text">
<item> <string>Default (16:9)</string>
<property name="text"> </property>
<string>Force 21:9</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Force 4:3</string>
<property name="text"> </property>
<string>Stretch to Window</string> </item>
</property> <item>
</item> <property name="text">
</widget> <string>Force 21:9</string>
</item> </property>
</layout> </item>
<item>
<property name="text">
<string>Stretch to Window</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <widget class="QWidget" name="bg_layout" native="true">
<item> <property name="sizePolicy">
<widget class="QComboBox" name="bg_combobox"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<property name="currentText"> <horstretch>0</horstretch>
<string>Use global background color</string> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="currentIndex"> </property>
<number>0</number> <layout class="QHBoxLayout" name="horizontalLayout_3">
</property> <property name="spacing">
<property name="maxVisibleItems"> <number>6</number>
<number>10</number> </property>
</property> <property name="leftMargin">
<item> <number>0</number>
<property name="text"> </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="QComboBox" name="bg_combobox">
<property name="currentText">
<string>Use global background color</string> <string>Use global background color</string>
</property> </property>
</item> <property name="currentIndex">
<item> <number>0</number>
<property name="text">
<string>Set background color:</string>
</property> </property>
</item> <property name="maxVisibleItems">
</widget> <number>10</number>
</item> </property>
<item> <item>
<widget class="QLabel" name="bg_label"> <property name="text">
<property name="text"> <string>Use global background color</string>
<string>Background Color:</string> </property>
</property> </item>
</widget> <item>
</item> <property name="text">
<item> <string>Set background color:</string>
<spacer name="horizontalSpacer"> </property>
<property name="orientation"> </item>
<enum>Qt::Horizontal</enum> </widget>
</property> </item>
<property name="sizeHint" stdset="0"> <item>
<size> <widget class="QLabel" name="bg_label">
<width>40</width> <property name="text">
<height>20</height> <string>Background Color:</string>
</size> </property>
</property> </widget>
</spacer> </item>
</item> <item>
<item> <spacer name="horizontalSpacer">
<widget class="QPushButton" name="bg_button"> <property name="orientation">
<property name="maximumSize"> <enum>Qt::Horizontal</enum>
<size> </property>
<width>40</width> <property name="sizeHint" stdset="0">
<height>16777215</height> <size>
</size> <width>40</width>
</property> <height>20</height>
</widget> </size>
</item> </property>
</layout> </spacer>
</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>
</layout> </layout>
</widget> </widget>