forked from eden-emu/eden
		
	yuzu-qt: Screenshots depend more on the graphics settings
This commit is contained in:
		
							parent
							
								
									96c98d09cb
								
							
						
					
					
						commit
						6fe51b48e9
					
				
					 12 changed files with 127 additions and 142 deletions
				
			
		|  | @ -146,8 +146,6 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); | |||
| 
 | ||||
| ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); | ||||
| 
 | ||||
| ENUM(ScreenshotAspectRatio, Auto, Unspecified, R16_9, R4_3, R21_9, R16_10); | ||||
| 
 | ||||
| template <typename Type> | ||||
| inline std::string CanonicalizeEnum(Type id) { | ||||
|     const auto group = EnumMetadata<Type>::Canonicalizations(); | ||||
|  |  | |||
|  | @ -932,13 +932,8 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { | |||
|                                                                  : Layout::ScreenUndocked::Height; | ||||
|             height *= Settings::values.resolution_info.up_factor; | ||||
|         } | ||||
|         const auto selected_ratio = UISettings::values.screenshot_aspect_ratio.GetValue(); | ||||
|         const u32 width = | ||||
|             selected_ratio == Settings::ScreenshotAspectRatio::Unspecified | ||||
|                 ? UISettings::values.screenshot_width.GetValue() | ||||
|                 : UISettings::CalculateWidth( | ||||
|                       height, UISettings::ConvertScreenshotRatioToRatio( | ||||
|                                   UISettings::values.screenshot_aspect_ratio.GetValue())); | ||||
|             UISettings::CalculateWidth(height, Settings::values.aspect_ratio.GetValue()); | ||||
|         return Layout::DefaultFrameLayout(width, height); | ||||
|     }()}; | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
| #include <memory> | ||||
| #include "common/logging/log.h" | ||||
| #include "common/settings.h" | ||||
| #include "common/settings_enums.h" | ||||
| #include "core/core.h" | ||||
| #include "ui_configure.h" | ||||
| #include "vk_device_info.h" | ||||
|  | @ -41,16 +42,19 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, | |||
|       general_tab{std::make_unique<ConfigureGeneral>(system_, nullptr, *builder, this)}, | ||||
|       graphics_advanced_tab{ | ||||
|           std::make_unique<ConfigureGraphicsAdvanced>(system_, nullptr, *builder, this)}, | ||||
|       ui_tab{std::make_unique<ConfigureUi>(system_, this)}, | ||||
|       graphics_tab{std::make_unique<ConfigureGraphics>( | ||||
|           system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, | ||||
|           [this](Settings::AspectRatio ratio, Settings::ResolutionSetup setup) { | ||||
|               ui_tab->UpdateScreenshotInfo(ratio, setup); | ||||
|           }, | ||||
|           nullptr, *builder, this)}, | ||||
|       hotkeys_tab{std::make_unique<ConfigureHotkeys>(system_.HIDCore(), this)}, | ||||
|       input_tab{std::make_unique<ConfigureInput>(system_, this)}, | ||||
|       network_tab{std::make_unique<ConfigureNetwork>(system_, this)}, | ||||
|       profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)}, | ||||
|       system_tab{std::make_unique<ConfigureSystem>(system_, nullptr, *builder, this)}, | ||||
|       ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>( | ||||
|                                                                 this)} { | ||||
|       web_tab{std::make_unique<ConfigureWeb>(this)} { | ||||
|     Settings::SetConfiguringGlobal(true); | ||||
| 
 | ||||
|     ui->setupUi(this); | ||||
|  |  | |||
|  | @ -81,12 +81,12 @@ private: | |||
|     std::unique_ptr<ConfigureFilesystem> filesystem_tab; | ||||
|     std::unique_ptr<ConfigureGeneral> general_tab; | ||||
|     std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab; | ||||
|     std::unique_ptr<ConfigureUi> ui_tab; | ||||
|     std::unique_ptr<ConfigureGraphics> graphics_tab; | ||||
|     std::unique_ptr<ConfigureHotkeys> hotkeys_tab; | ||||
|     std::unique_ptr<ConfigureInput> input_tab; | ||||
|     std::unique_ptr<ConfigureNetwork> network_tab; | ||||
|     std::unique_ptr<ConfigureProfileManager> profile_tab; | ||||
|     std::unique_ptr<ConfigureSystem> system_tab; | ||||
|     std::unique_ptr<ConfigureUi> ui_tab; | ||||
|     std::unique_ptr<ConfigureWeb> web_tab; | ||||
| }; | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ | |||
| #include <QtCore/qobjectdefs.h> | ||||
| #include <qabstractbutton.h> | ||||
| #include <qboxlayout.h> | ||||
| #include <qcombobox.h> | ||||
| #include <qcoreevent.h> | ||||
| #include <qglobal.h> | ||||
| #include <qgridlayout.h> | ||||
|  | @ -77,13 +78,16 @@ static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| ConfigureGraphics::ConfigureGraphics(const Core::System& system_, | ||||
|                                      std::vector<VkDeviceInfo::Record>& records_, | ||||
|                                      const std::function<void()>& expose_compute_option_, | ||||
|                                      std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_, | ||||
|                                      const ConfigurationShared::Builder& builder, QWidget* parent) | ||||
| ConfigureGraphics::ConfigureGraphics( | ||||
|     const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_, | ||||
|     const std::function<void()>& expose_compute_option_, | ||||
|     const std::function<void(Settings::AspectRatio, Settings::ResolutionSetup)>& | ||||
|         update_aspect_ratio_, | ||||
|     std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_, | ||||
|     const ConfigurationShared::Builder& builder, QWidget* parent) | ||||
|     : ConfigurationShared::Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, | ||||
|       records{records_}, expose_compute_option{expose_compute_option_}, system{system_}, | ||||
|       records{records_}, expose_compute_option{expose_compute_option_}, | ||||
|       update_aspect_ratio{update_aspect_ratio_}, system{system_}, | ||||
|       combobox_translations{builder.ComboboxTranslations()}, | ||||
|       shader_mapping{ | ||||
|           combobox_translations.at(Settings::EnumMetadata<Settings::ShaderBackend>::Index())} { | ||||
|  | @ -140,6 +144,26 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, | |||
|         UpdateBackgroundColorButton(new_bg_color); | ||||
|     }); | ||||
| 
 | ||||
|     const auto& update_screenshot_info = [this, &builder]() { | ||||
|         const auto& combobox_enumerations = builder.ComboboxTranslations().at( | ||||
|             Settings::EnumMetadata<Settings::AspectRatio>::Index()); | ||||
|         const auto index = aspect_ratio_combobox->currentIndex(); | ||||
|         const auto ratio = static_cast<Settings::AspectRatio>(combobox_enumerations[index].first); | ||||
| 
 | ||||
|         const auto& combobox_enumerations_resolution = builder.ComboboxTranslations().at( | ||||
|             Settings::EnumMetadata<Settings::ResolutionSetup>::Index()); | ||||
|         const auto res_index = resolution_combobox->currentIndex(); | ||||
|         const auto setup = static_cast<Settings::ResolutionSetup>( | ||||
|             combobox_enumerations_resolution[res_index].first); | ||||
| 
 | ||||
|         update_aspect_ratio(ratio, setup); | ||||
|     }; | ||||
| 
 | ||||
|     connect(aspect_ratio_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), | ||||
|             update_screenshot_info); | ||||
|     connect(resolution_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), | ||||
|             update_screenshot_info); | ||||
| 
 | ||||
|     api_combobox->setEnabled(!UISettings::values.has_broken_vulkan && api_combobox->isEnabled()); | ||||
|     ui->api_widget->setEnabled( | ||||
|         (!UISettings::values.has_broken_vulkan || Settings::IsConfiguringGlobal()) && | ||||
|  | @ -280,6 +304,14 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { | |||
|             // Keep track of vsync_mode's combobox so we can populate it
 | ||||
|             vsync_mode_combobox = widget->combobox; | ||||
|             hold_graphics.emplace(setting->Id(), widget); | ||||
|         } else if (setting->Id() == Settings::values.aspect_ratio.Id()) { | ||||
|             // Keep track of the aspect ratio combobox to update other UI tabs that need it
 | ||||
|             aspect_ratio_combobox = widget->combobox; | ||||
|             hold_graphics.emplace(setting->Id(), widget); | ||||
|         } else if (setting->Id() == Settings::values.resolution_setup.Id()) { | ||||
|             // Keep track of the resolution combobox to update other UI tabs that need it
 | ||||
|             resolution_combobox = widget->combobox; | ||||
|             hold_graphics.emplace(setting->Id(), widget); | ||||
|         } else { | ||||
|             hold_graphics.emplace(setting->Id(), widget); | ||||
|         } | ||||
|  |  | |||
|  | @ -14,6 +14,7 @@ | |||
| #include <qobjectdefs.h> | ||||
| #include <vulkan/vulkan_core.h> | ||||
| #include "common/common_types.h" | ||||
| #include "common/settings_enums.h" | ||||
| #include "configuration/shared_translation.h" | ||||
| #include "vk_device_info.h" | ||||
| #include "yuzu/configuration/configuration_shared.h" | ||||
|  | @ -43,12 +44,13 @@ class Builder; | |||
| 
 | ||||
| class ConfigureGraphics : public ConfigurationShared::Tab { | ||||
| public: | ||||
|     explicit ConfigureGraphics(const Core::System& system_, | ||||
|                                std::vector<VkDeviceInfo::Record>& records, | ||||
|                                const std::function<void()>& expose_compute_option_, | ||||
|                                std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, | ||||
|                                const ConfigurationShared::Builder& builder, | ||||
|                                QWidget* parent = nullptr); | ||||
|     explicit ConfigureGraphics( | ||||
|         const Core::System& system_, std::vector<VkDeviceInfo::Record>& records, | ||||
|         const std::function<void()>& expose_compute_option, | ||||
|         const std::function<void(Settings::AspectRatio, Settings::ResolutionSetup)>& | ||||
|             update_aspect_ratio, | ||||
|         std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, | ||||
|         const ConfigurationShared::Builder& builder, QWidget* parent = nullptr); | ||||
|     ~ConfigureGraphics() override; | ||||
| 
 | ||||
|     void ApplyConfiguration() override; | ||||
|  | @ -91,6 +93,7 @@ private: | |||
|     u32 vulkan_device{}; | ||||
|     Settings::ShaderBackend shader_backend{}; | ||||
|     const std::function<void()>& expose_compute_option; | ||||
|     const std::function<void(Settings::AspectRatio, Settings::ResolutionSetup)> update_aspect_ratio; | ||||
| 
 | ||||
|     const Core::System& system; | ||||
|     const ConfigurationShared::ComboboxTranslationMap& combobox_translations; | ||||
|  | @ -104,4 +107,6 @@ private: | |||
|     QWidget* vulkan_device_widget; | ||||
|     QWidget* api_widget; | ||||
|     QWidget* shader_backend_widget; | ||||
|     QComboBox* aspect_ratio_combobox; | ||||
|     QComboBox* resolution_combobox; | ||||
| }; | ||||
|  |  | |||
|  | @ -17,6 +17,7 @@ | |||
| #include <QTimer> | ||||
| 
 | ||||
| #include "common/fs/fs_util.h" | ||||
| #include "common/settings_enums.h" | ||||
| #include "configuration/shared_widget.h" | ||||
| #include "core/core.h" | ||||
| #include "core/file_sys/control_metadata.h" | ||||
|  | @ -57,7 +58,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st | |||
|         std::make_unique<ConfigureGraphicsAdvanced>(system_, tab_group, *builder, this); | ||||
|     graphics_tab = std::make_unique<ConfigureGraphics>( | ||||
|         system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, | ||||
|         tab_group, *builder, this); | ||||
|         [](Settings::AspectRatio, Settings::ResolutionSetup) {}, tab_group, *builder, this); | ||||
|     input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this); | ||||
|     system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *builder, this); | ||||
| 
 | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ | |||
| #include "common/settings.h" | ||||
| #include "common/settings_enums.h" | ||||
| #include "core/core.h" | ||||
| #include "core/frontend/framebuffer_layout.h" | ||||
| #include "ui_configure_ui.h" | ||||
| #include "yuzu/uisettings.h" | ||||
| 
 | ||||
|  | @ -66,40 +67,27 @@ QString GetTranslatedRowTextName(size_t index) { | |||
| } | ||||
| } // Anonymous namespace
 | ||||
| 
 | ||||
| constexpr static std::array<std::pair<Settings::ScreenshotAspectRatio, std::string>, 6> | ||||
|     screenshot_aspect_ratio_translations = { | ||||
|         std::pair{Settings::ScreenshotAspectRatio::Auto, "Auto"}, | ||||
|         std::pair{Settings::ScreenshotAspectRatio::Unspecified, "Unspecified"}, | ||||
|         std::pair{Settings::ScreenshotAspectRatio::R16_9, "16:9"}, | ||||
|         std::pair{Settings::ScreenshotAspectRatio::R4_3, "4:3"}, | ||||
|         std::pair{Settings::ScreenshotAspectRatio::R21_9, "21:9"}, | ||||
|         std::pair{Settings::ScreenshotAspectRatio::R16_10, "16:10"}, | ||||
| }; | ||||
| 
 | ||||
| static void PopulateAspectRatioComboBox(QComboBox* screenshot_aspect_ratio) { | ||||
|     screenshot_aspect_ratio->clear(); | ||||
| 
 | ||||
|     for (const auto& [value, name] : screenshot_aspect_ratio_translations) { | ||||
|         screenshot_aspect_ratio->addItem(QString::fromStdString(name)); | ||||
|     } | ||||
| static float GetUpFactor(Settings::ResolutionSetup res_setup) { | ||||
|     Settings::ResolutionScalingInfo info{}; | ||||
|     Settings::TranslateResolutionInfo(res_setup, info); | ||||
|     return info.up_factor; | ||||
| } | ||||
| 
 | ||||
| static void PopulateResolutionComboBox(QComboBox* screenshot_height) { | ||||
| static void PopulateResolutionComboBox(QComboBox* screenshot_height, QWidget* parent) { | ||||
|     screenshot_height->clear(); | ||||
| 
 | ||||
|     const auto& enumeration = | ||||
|         Settings::EnumMetadata<Settings::ResolutionSetup>::Canonicalizations(); | ||||
|     Settings::ResolutionScalingInfo info{}; | ||||
|     std::set<u32> resolutions{}; | ||||
|     for (const auto& [name, value] : enumeration) { | ||||
|         Settings::TranslateResolutionInfo(value, info); | ||||
|         u32 height_undocked = 720 * info.up_factor; | ||||
|         u32 height_docked = 1080 * info.up_factor; | ||||
|         const float up_factor = GetUpFactor(value); | ||||
|         u32 height_undocked = Layout::ScreenUndocked::Height * up_factor; | ||||
|         u32 height_docked = Layout::ScreenDocked::Height * up_factor; | ||||
|         resolutions.emplace(height_undocked); | ||||
|         resolutions.emplace(height_docked); | ||||
|     } | ||||
| 
 | ||||
|     screenshot_height->addItem(QStringLiteral("0")); | ||||
|     screenshot_height->addItem(parent->tr("Auto", "Screenshot height option")); | ||||
|     for (const auto res : resolutions) { | ||||
|         screenshot_height->addItem(QString::fromStdString(std::to_string(res))); | ||||
|     } | ||||
|  | @ -114,7 +102,9 @@ static u32 ScreenshotDimensionToInt(const QString& height) { | |||
| } | ||||
| 
 | ||||
| ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) | ||||
|     : QWidget(parent), ui{std::make_unique<Ui::ConfigureUi>()}, system{system_} { | ||||
|     : QWidget(parent), ui{std::make_unique<Ui::ConfigureUi>()}, | ||||
|       ratio{Settings::values.aspect_ratio.GetValue()}, | ||||
|       resolution_setting{Settings::values.resolution_setup.GetValue()}, system{system_} { | ||||
|     ui->setupUi(this); | ||||
| 
 | ||||
|     InitializeLanguageComboBox(); | ||||
|  | @ -127,8 +117,7 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) | |||
|     InitializeIconSizeComboBox(); | ||||
|     InitializeRowComboBoxes(); | ||||
| 
 | ||||
|     PopulateAspectRatioComboBox(ui->screenshot_aspect_ratio); | ||||
|     PopulateResolutionComboBox(ui->screenshot_height); | ||||
|     PopulateResolutionComboBox(ui->screenshot_height, this); | ||||
| 
 | ||||
|     SetConfiguration(); | ||||
| 
 | ||||
|  | @ -167,31 +156,9 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) | |||
|         } | ||||
|     }); | ||||
| 
 | ||||
|     const auto update_width_text = [this]() { | ||||
|         const auto index = ui->screenshot_aspect_ratio->currentIndex(); | ||||
|         const auto selected_ratio = screenshot_aspect_ratio_translations[index].first; | ||||
|         if (selected_ratio == Settings::ScreenshotAspectRatio::Unspecified) { | ||||
|             ui->screenshot_width->setReadOnly(false); | ||||
|             return; | ||||
|         } else { | ||||
|             ui->screenshot_width->setReadOnly(true); | ||||
|         } | ||||
|         const Settings::AspectRatio ratio = | ||||
|             UISettings::ConvertScreenshotRatioToRatio(selected_ratio); | ||||
|         const auto height = ScreenshotDimensionToInt(ui->screenshot_height->currentText()); | ||||
|         const auto width = UISettings::CalculateWidth(height, ratio); | ||||
|         if (height == 0) { | ||||
|             ui->screenshot_width->setText(QString::fromStdString(fmt::format("Auto"))); | ||||
|         } else { | ||||
|             ui->screenshot_width->setText(QString::fromStdString(std::to_string(width))); | ||||
|         } | ||||
|     }; | ||||
|     connect(ui->screenshot_height, &QComboBox::currentTextChanged, [this]() { UpdateWidthText(); }); | ||||
| 
 | ||||
|     connect(ui->screenshot_aspect_ratio, QOverload<int>::of(&QComboBox::currentIndexChanged), | ||||
|             update_width_text); | ||||
|     connect(ui->screenshot_height, &QComboBox::currentTextChanged, update_width_text); | ||||
| 
 | ||||
|     update_width_text(); | ||||
|     UpdateWidthText(); | ||||
| } | ||||
| 
 | ||||
| ConfigureUi::~ConfigureUi() = default; | ||||
|  | @ -212,16 +179,8 @@ void ConfigureUi::ApplyConfiguration() { | |||
|     Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir, | ||||
|                             ui->screenshot_path_edit->text().toStdString()); | ||||
| 
 | ||||
|     const auto ratio = | ||||
|         screenshot_aspect_ratio_translations[ui->screenshot_aspect_ratio->currentIndex()].first; | ||||
|     UISettings::values.screenshot_aspect_ratio.SetValue(ratio); | ||||
|     const u32 height = ScreenshotDimensionToInt(ui->screenshot_height->currentText()); | ||||
|     const u32 calculated_width = | ||||
|         UISettings::CalculateWidth(height, UISettings::ConvertScreenshotRatioToRatio(ratio)); | ||||
|     const u32 width_readout = ScreenshotDimensionToInt(ui->screenshot_width->text()); | ||||
|     UISettings::values.screenshot_height.SetValue(height); | ||||
|     UISettings::values.screenshot_width.SetValue( | ||||
|         ratio == Settings::ScreenshotAspectRatio::Unspecified ? width_readout : calculated_width); | ||||
| 
 | ||||
|     system.ApplySettings(); | ||||
| } | ||||
|  | @ -248,16 +207,12 @@ void ConfigureUi::SetConfiguration() { | |||
|     ui->screenshot_path_edit->setText(QString::fromStdString( | ||||
|         Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir))); | ||||
| 
 | ||||
|     for (u32 i = 0; i < screenshot_aspect_ratio_translations.size(); i++) { | ||||
|         const auto ratio = screenshot_aspect_ratio_translations[i].first; | ||||
|         if (ratio == UISettings::values.screenshot_aspect_ratio.GetValue()) { | ||||
|             ui->screenshot_aspect_ratio->setCurrentIndex(i); | ||||
|         } | ||||
|     const auto height = UISettings::values.screenshot_height.GetValue(); | ||||
|     if (height == 0) { | ||||
|         ui->screenshot_height->setCurrentIndex(0); | ||||
|     } else { | ||||
|         ui->screenshot_height->setCurrentText(QStringLiteral("%1").arg(height)); | ||||
|     } | ||||
|     ui->screenshot_height->setCurrentText( | ||||
|         QString::fromStdString(fmt::format("{}", UISettings::values.screenshot_height.GetValue()))); | ||||
|     ui->screenshot_width->setText( | ||||
|         QString::fromStdString(fmt::format("{}", UISettings::values.screenshot_width.GetValue()))); | ||||
| } | ||||
| 
 | ||||
| void ConfigureUi::changeEvent(QEvent* event) { | ||||
|  | @ -428,3 +383,29 @@ void ConfigureUi::OnLanguageChanged(int index) { | |||
| 
 | ||||
|     emit LanguageChanged(ui->language_combobox->itemData(index).toString()); | ||||
| } | ||||
| 
 | ||||
| void ConfigureUi::UpdateWidthText() { | ||||
|     const u32 height = ScreenshotDimensionToInt(ui->screenshot_height->currentText()); | ||||
|     const u32 width = UISettings::CalculateWidth(height, ratio); | ||||
|     if (height == 0) { | ||||
|         const auto up_factor = GetUpFactor(resolution_setting); | ||||
|         const u32 height_docked = Layout::ScreenDocked::Height * up_factor; | ||||
|         const u32 width_docked = UISettings::CalculateWidth(height_docked, ratio); | ||||
|         const u32 height_undocked = Layout::ScreenUndocked::Height * up_factor; | ||||
|         const u32 width_undocked = UISettings::CalculateWidth(height_undocked, ratio); | ||||
|         ui->screenshot_width->setText(tr("Auto (%1 x %2, %3 x %4)", "Screenshot width value") | ||||
|                                           .arg(width_undocked) | ||||
|                                           .arg(height_undocked) | ||||
|                                           .arg(width_docked) | ||||
|                                           .arg(height_docked)); | ||||
|     } else { | ||||
|         ui->screenshot_width->setText(QStringLiteral("%1 x").arg(width)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void ConfigureUi::UpdateScreenshotInfo(Settings::AspectRatio ratio_, | ||||
|                                        Settings::ResolutionSetup resolution_setting_) { | ||||
|     ratio = ratio_; | ||||
|     resolution_setting = resolution_setting_; | ||||
|     UpdateWidthText(); | ||||
| } | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| 
 | ||||
| #include <memory> | ||||
| #include <QWidget> | ||||
| #include "common/settings_enums.h" | ||||
| 
 | ||||
| namespace Core { | ||||
| class System; | ||||
|  | @ -23,6 +24,9 @@ public: | |||
| 
 | ||||
|     void ApplyConfiguration(); | ||||
| 
 | ||||
|     void UpdateScreenshotInfo(Settings::AspectRatio ratio, | ||||
|                               Settings::ResolutionSetup resolution_info); | ||||
| 
 | ||||
| private slots: | ||||
|     void OnLanguageChanged(int index); | ||||
| 
 | ||||
|  | @ -44,7 +48,11 @@ private: | |||
|     void UpdateFirstRowComboBox(bool init = false); | ||||
|     void UpdateSecondRowComboBox(bool init = false); | ||||
| 
 | ||||
|     void UpdateWidthText(); | ||||
| 
 | ||||
|     std::unique_ptr<Ui::ConfigureUi> ui; | ||||
| 
 | ||||
|     Settings::AspectRatio ratio; | ||||
|     Settings::ResolutionSetup resolution_setting; | ||||
|     Core::System& system; | ||||
| }; | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>363</width> | ||||
|     <height>562</height> | ||||
|     <height>603</height> | ||||
|    </rect> | ||||
|   </property> | ||||
|   <property name="windowTitle"> | ||||
|  | @ -206,38 +206,15 @@ | |||
|           <property name="spacing"> | ||||
|            <number>6</number> | ||||
|           </property> | ||||
|           <item row="1" column="0"> | ||||
|            <widget class="QLabel" name="label_3"> | ||||
|             <property name="text"> | ||||
|              <string>Resolution:</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item row="0" column="1"> | ||||
|            <widget class="QComboBox" name="screenshot_aspect_ratio"/> | ||||
|           </item> | ||||
|           <item row="0" column="0"> | ||||
|            <widget class="QLabel" name="label_2"> | ||||
|             <property name="text"> | ||||
|              <string>Aspect Ratio:</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item row="1" column="1"> | ||||
|            <layout class="QHBoxLayout" name="horizontalLayout_5"> | ||||
|             <item> | ||||
|              <widget class="QLineEdit" name="screenshot_width"> | ||||
|               <property name="enabled"> | ||||
|                <bool>true</bool> | ||||
|              <widget class="QLabel" name="screenshot_width"> | ||||
|               <property name="text"> | ||||
|                <string>TextLabel</string> | ||||
|               </property> | ||||
|               <property name="sizePolicy"> | ||||
|                <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||||
|                 <horstretch>0</horstretch> | ||||
|                 <verstretch>0</verstretch> | ||||
|                </sizepolicy> | ||||
|               </property> | ||||
|               <property name="readOnly"> | ||||
|                <bool>true</bool> | ||||
|               <property name="alignment"> | ||||
|                <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | ||||
|               </property> | ||||
|              </widget> | ||||
|             </item> | ||||
|  | @ -250,6 +227,13 @@ | |||
|             </item> | ||||
|            </layout> | ||||
|           </item> | ||||
|           <item row="0" column="0"> | ||||
|            <widget class="QLabel" name="label_3"> | ||||
|             <property name="text"> | ||||
|              <string>Resolution:</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|          </layout> | ||||
|         </item> | ||||
|        </layout> | ||||
|  |  | |||
|  | @ -51,22 +51,4 @@ u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) { | |||
|     return height * 16 / 9; | ||||
| } | ||||
| 
 | ||||
| Settings::AspectRatio ConvertScreenshotRatioToRatio(Settings::ScreenshotAspectRatio ratio) { | ||||
|     switch (ratio) { | ||||
|     case Settings::ScreenshotAspectRatio::Auto: | ||||
|         return Settings::values.aspect_ratio.GetValue(); | ||||
|     case Settings::ScreenshotAspectRatio::R16_9: | ||||
|         return Settings::AspectRatio::R16_9; | ||||
|     case Settings::ScreenshotAspectRatio::R4_3: | ||||
|         return Settings::AspectRatio::R4_3; | ||||
|     case Settings::ScreenshotAspectRatio::R21_9: | ||||
|         return Settings::AspectRatio::R21_9; | ||||
|     case Settings::ScreenshotAspectRatio::R16_10: | ||||
|         return Settings::AspectRatio::R16_10; | ||||
|     case Settings::ScreenshotAspectRatio::Unspecified: | ||||
|         break; | ||||
|     } | ||||
|     return Settings::AspectRatio::R16_9; | ||||
| } | ||||
| 
 | ||||
| } // namespace UISettings
 | ||||
|  |  | |||
|  | @ -132,10 +132,6 @@ struct Values { | |||
|     Setting<bool> enable_screenshot_save_as{linkage, true, "enable_screenshot_save_as", | ||||
|                                             Category::Screenshots}; | ||||
|     Setting<u32> screenshot_height{linkage, 0, "screenshot_height", Category::Screenshots}; | ||||
|     Setting<u32> screenshot_width{linkage, 0, "screenshot_width", Category::Screenshots}; | ||||
|     Setting<Settings::ScreenshotAspectRatio> screenshot_aspect_ratio{ | ||||
|         linkage, Settings::ScreenshotAspectRatio::Auto, "screenshot_aspect_ratio", | ||||
|         Category::Screenshots}; | ||||
| 
 | ||||
|     QString roms_path; | ||||
|     QString symbols_path; | ||||
|  | @ -195,7 +191,6 @@ struct Values { | |||
| extern Values values; | ||||
| 
 | ||||
| u32 CalculateWidth(u32 height, Settings::AspectRatio ratio); | ||||
| Settings::AspectRatio ConvertScreenshotRatioToRatio(Settings::ScreenshotAspectRatio ratio); | ||||
| 
 | ||||
| } // namespace UISettings
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 lat9nq
						lat9nq