From 2bfb8ebf96206e2e042a0c2743f8516c969f3ede Mon Sep 17 00:00:00 2001 From: iwubcode Date: Tue, 20 Oct 2020 20:02:43 -0500 Subject: [PATCH] DolphinQt: Add tooltip support to Hacks Graphics tab --- .../DolphinQt/Config/Graphics/HacksWidget.cpp | 131 ++++++++++-------- .../DolphinQt/Config/Graphics/HacksWidget.h | 31 ++--- 2 files changed, 87 insertions(+), 75 deletions(-) diff --git a/Source/Core/DolphinQt/Config/Graphics/HacksWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/HacksWidget.cpp index 5aaf31480b..5719a1190b 100644 --- a/Source/Core/DolphinQt/Config/Graphics/HacksWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/HacksWidget.cpp @@ -17,11 +17,12 @@ #include "DolphinQt/Config/Graphics/GraphicsBool.h" #include "DolphinQt/Config/Graphics/GraphicsSlider.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h" +#include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h" #include "DolphinQt/Settings.h" #include "VideoCommon/VideoConfig.h" -HacksWidget::HacksWidget(GraphicsWindow* parent) : GraphicsWidget(parent) +HacksWidget::HacksWidget(GraphicsWindow* parent) { CreateWidgets(); LoadSettings(); @@ -60,7 +61,7 @@ void HacksWidget::CreateWidgets() auto* texture_cache_layout = new QGridLayout(); texture_cache_box->setLayout(texture_cache_layout); - m_accuracy = new QSlider(Qt::Horizontal); + m_accuracy = new ToolTipSlider(Qt::Horizontal); m_accuracy->setMinimum(0); m_accuracy->setMaximum(2); m_accuracy->setPageStep(1); @@ -207,81 +208,93 @@ void HacksWidget::SaveSettings() void HacksWidget::AddDescriptions() { - static const char TR_SKIP_EFB_CPU_ACCESS_DESCRIPTION[] = - QT_TR_NOOP("Ignores any requests from the CPU to read from or write to the EFB. " - "\n\nImproves performance in some games, but will disable all EFB-based " - "graphical effects or gameplay-related features.\n\nIf unsure, " - "leave this unchecked."); + static const char TR_SKIP_EFB_CPU_ACCESS_DESCRIPTION[] = QT_TR_NOOP( + "Ignores any requests from the CPU to read from or write to the EFB. " + "

Improves performance in some games, but will disable all EFB-based " + "graphical effects or gameplay-related features.

If unsure, " + "leave this unchecked."); static const char TR_IGNORE_FORMAT_CHANGE_DESCRIPTION[] = QT_TR_NOOP( - "Ignores any changes to the EFB format.\n\nImproves performance in many games without " + "Ignores any changes to the EFB format.

Improves performance in many games " + "without " "any negative effect. Causes graphical defects in a small number of other " - "games.\n\nIf unsure, leave this checked."); + "games.

If unsure, leave this checked."); static const char TR_STORE_EFB_TO_TEXTURE_DESCRIPTION[] = QT_TR_NOOP( "Stores EFB copies exclusively on the GPU, bypassing system memory. Causes graphical defects " - "in a small number of games.\n\nEnabled = EFB Copies to Texture\nDisabled = EFB Copies to " - "RAM (and Texture)\n\nIf unsure, leave this checked."); + "in a small number of games.

Enabled = EFB Copies to Texture
Disabled = EFB " + "Copies to " + "RAM (and Texture)

If unsure, leave this " + "checked."); static const char TR_DEFER_EFB_COPIES_DESCRIPTION[] = QT_TR_NOOP( "Waits until the game synchronizes with the emulated GPU before writing the contents of EFB " - "copies to RAM.\n\nReduces the overhead of EFB RAM copies, providing a performance boost in " + "copies to RAM.

Reduces the overhead of EFB RAM copies, providing a performance " + "boost in " "many games, at the risk of breaking those which do not safely synchronize with the " - "emulated GPU.\n\nIf unsure, leave this checked."); + "emulated GPU.

If unsure, leave this " + "checked."); static const char TR_ACCUARCY_DESCRIPTION[] = QT_TR_NOOP( - "Adjusts the accuracy at which the GPU receives texture updates from RAM.\n\n" + "Adjusts the accuracy at which the GPU receives texture updates from RAM.

" "The \"Safe\" setting eliminates the likelihood of the GPU missing texture updates " "from RAM. Lower accuracies cause in-game text to appear garbled in certain " - "games.\n\nIf unsure, select the rightmost value."); - + "games.

If unsure, select the rightmost " + "value."); static const char TR_STORE_XFB_TO_TEXTURE_DESCRIPTION[] = QT_TR_NOOP( "Stores XFB copies exclusively on the GPU, bypassing system memory. Causes graphical defects " - "in a small number of games.\n\nEnabled = XFB Copies to " - "Texture\nDisabled = XFB Copies to RAM (and Texture)\n\nIf unsure, leave this checked."); - - static const char TR_IMMEDIATE_XFB_DESCRIPTION[] = - QT_TR_NOOP("Displays XFB copies as soon as they are created, instead of waiting for " - "scanout.\n\nCan cause graphical defects in some games if the game doesn't " - "expect all XFB copies to be displayed. However, turning this setting on reduces " - "latency.\n\nIf unsure, leave this unchecked."); - + "in a small number of games.

Enabled = XFB Copies to " + "Texture
Disabled = XFB Copies to RAM (and Texture)

If " + "unsure, leave this checked."); + static const char TR_IMMEDIATE_XFB_DESCRIPTION[] = QT_TR_NOOP( + "Displays XFB copies as soon as they are created, instead of waiting for " + "scanout.

Can cause graphical defects in some games if the game doesn't " + "expect all XFB copies to be displayed. However, turning this setting on reduces " + "latency.

If unsure, leave this unchecked."); static const char TR_SKIP_DUPLICATE_XFBS_DESCRIPTION[] = QT_TR_NOOP( "Skips presentation of duplicate frames (XFB copies) in 25fps/30fps games. This may improve " - "performance on low-end devices, while making frame pacing less consistent.\n\nDisable this " - "option as well as enabling V-Sync for optimal frame pacing.\n\nIf unsure, leave this " - "checked."); - - static const char TR_GPU_DECODING_DESCRIPTION[] = - QT_TR_NOOP("Enables texture decoding using the GPU instead of the CPU.\n\nThis may result in " - "performance gains in some scenarios, or on systems where the CPU is the " - "bottleneck.\n\nIf unsure, leave this unchecked."); - + "performance on low-end devices, while making frame pacing less consistent.

Disable this " + "option as well as enabling V-Sync for optimal frame pacing.

If " + "unsure, leave this " + "checked."); + static const char TR_GPU_DECODING_DESCRIPTION[] = QT_TR_NOOP( + "Enables texture decoding using the GPU instead of the CPU.

This may result in " + "performance gains in some scenarios, or on systems where the CPU is the " + "bottleneck.

If unsure, leave this " + "unchecked."); static const char TR_FAST_DEPTH_CALC_DESCRIPTION[] = QT_TR_NOOP( - "Uses a less accurate algorithm to calculate depth values.\n\nCauses issues in a few " + "Uses a less accurate algorithm to calculate depth values.

Causes issues in a few " "games, but can result in a decent speed increase depending on the game and/or " - "GPU.\n\nIf unsure, leave this checked."); + "GPU.

If unsure, leave this checked."); static const char TR_DISABLE_BOUNDINGBOX_DESCRIPTION[] = - QT_TR_NOOP("Disables bounding box emulation.\n\nThis may improve GPU performance " - "significantly, but some games will break.\n\nIf unsure, leave this checked."); - static const char TR_SAVE_TEXTURE_CACHE_TO_STATE_DESCRIPTION[] = QT_TR_NOOP( - "Includes the contents of the embedded frame buffer (EFB) and upscaled EFB copies " - "in save states. Fixes missing and/or non-upscaled textures/objects when loading " - "states at the cost of additional save/load time.\n\nIf unsure, leave this checked."); - static const char TR_VERTEX_ROUNDING_DESCRIPTION[] = - QT_TR_NOOP("Rounds 2D vertices to whole pixels.\n\nFixes graphical problems in some games at " - "higher internal resolutions. This setting has no effect when native internal " - "resolution is used.\n\nIf unsure, leave this unchecked."); + QT_TR_NOOP("Disables bounding box emulation.

This may improve GPU performance " + "significantly, but some games will break.

If " + "unsure, leave this checked."); + static const char TR_SAVE_TEXTURE_CACHE_TO_STATE_DESCRIPTION[] = + QT_TR_NOOP("Includes the contents of the embedded frame buffer (EFB) and upscaled EFB copies " + "in save states. Fixes missing and/or non-upscaled textures/objects when loading " + "states at the cost of additional save/load time.

If " + "unsure, leave this checked."); + static const char TR_VERTEX_ROUNDING_DESCRIPTION[] = QT_TR_NOOP( + "Rounds 2D vertices to whole pixels.

Fixes graphical problems in some games at " + "higher internal resolutions. This setting has no effect when native internal " + "resolution is used.

If unsure, leave this " + "unchecked."); - AddDescription(m_skip_efb_cpu, TR_SKIP_EFB_CPU_ACCESS_DESCRIPTION); - AddDescription(m_ignore_format_changes, TR_IGNORE_FORMAT_CHANGE_DESCRIPTION); - AddDescription(m_store_efb_copies, TR_STORE_EFB_TO_TEXTURE_DESCRIPTION); - AddDescription(m_defer_efb_copies, TR_DEFER_EFB_COPIES_DESCRIPTION); - AddDescription(m_accuracy, TR_ACCUARCY_DESCRIPTION); - AddDescription(m_store_xfb_copies, TR_STORE_XFB_TO_TEXTURE_DESCRIPTION); - AddDescription(m_immediate_xfb, TR_IMMEDIATE_XFB_DESCRIPTION); - AddDescription(m_skip_duplicate_xfbs, TR_SKIP_DUPLICATE_XFBS_DESCRIPTION); - AddDescription(m_gpu_texture_decoding, TR_GPU_DECODING_DESCRIPTION); - AddDescription(m_fast_depth_calculation, TR_FAST_DEPTH_CALC_DESCRIPTION); - AddDescription(m_disable_bounding_box, TR_DISABLE_BOUNDINGBOX_DESCRIPTION); - AddDescription(m_save_texture_cache_state, TR_SAVE_TEXTURE_CACHE_TO_STATE_DESCRIPTION); - AddDescription(m_vertex_rounding, TR_VERTEX_ROUNDING_DESCRIPTION); + m_skip_efb_cpu->SetDescription(QString::fromStdString(TR_SKIP_EFB_CPU_ACCESS_DESCRIPTION)); + m_ignore_format_changes->SetDescription( + QString::fromStdString(TR_IGNORE_FORMAT_CHANGE_DESCRIPTION)); + m_store_efb_copies->SetDescription(QString::fromStdString(TR_STORE_EFB_TO_TEXTURE_DESCRIPTION)); + m_defer_efb_copies->SetDescription(QString::fromStdString(TR_DEFER_EFB_COPIES_DESCRIPTION)); + m_accuracy->SetTitle(tr("Texture Cache Accuracy")); + m_accuracy->SetDescription(QString::fromStdString(TR_ACCUARCY_DESCRIPTION)); + m_store_xfb_copies->SetDescription(QString::fromStdString(TR_STORE_XFB_TO_TEXTURE_DESCRIPTION)); + m_immediate_xfb->SetDescription(QString::fromStdString(TR_IMMEDIATE_XFB_DESCRIPTION)); + m_skip_duplicate_xfbs->SetDescription(QString::fromStdString(TR_SKIP_DUPLICATE_XFBS_DESCRIPTION)); + m_gpu_texture_decoding->SetDescription(QString::fromStdString(TR_GPU_DECODING_DESCRIPTION)); + m_fast_depth_calculation->SetDescription(QString::fromStdString(TR_FAST_DEPTH_CALC_DESCRIPTION)); + m_disable_bounding_box->SetDescription( + QString::fromStdString(TR_DISABLE_BOUNDINGBOX_DESCRIPTION)); + m_save_texture_cache_state->SetDescription( + QString::fromStdString(TR_SAVE_TEXTURE_CACHE_TO_STATE_DESCRIPTION)); + m_vertex_rounding->SetDescription(QString::fromStdString(TR_VERTEX_ROUNDING_DESCRIPTION)); } void HacksWidget::UpdateDeferEFBCopiesEnabled() diff --git a/Source/Core/DolphinQt/Config/Graphics/HacksWidget.h b/Source/Core/DolphinQt/Config/Graphics/HacksWidget.h index b6ca90dbd4..534fb0e0d2 100644 --- a/Source/Core/DolphinQt/Config/Graphics/HacksWidget.h +++ b/Source/Core/DolphinQt/Config/Graphics/HacksWidget.h @@ -6,11 +6,10 @@ #include "DolphinQt/Config/Graphics/GraphicsWidget.h" +class GraphicsBool; class GraphicsWindow; -class QCheckBox; class QLabel; -class QRadioButton; -class QSlider; +class ToolTipSlider; class HacksWidget final : public GraphicsWidget { @@ -25,26 +24,26 @@ private: void OnBackendChanged(const QString& backend_name); // EFB - QCheckBox* m_skip_efb_cpu; - QCheckBox* m_ignore_format_changes; - QCheckBox* m_store_efb_copies; + GraphicsBool* m_skip_efb_cpu; + GraphicsBool* m_ignore_format_changes; + GraphicsBool* m_store_efb_copies; // Texture Cache QLabel* m_accuracy_label; - QSlider* m_accuracy; - QCheckBox* m_gpu_texture_decoding; + ToolTipSlider* m_accuracy; + GraphicsBool* m_gpu_texture_decoding; // External Framebuffer - QCheckBox* m_store_xfb_copies; - QCheckBox* m_immediate_xfb; - QCheckBox* m_skip_duplicate_xfbs; + GraphicsBool* m_store_xfb_copies; + GraphicsBool* m_immediate_xfb; + GraphicsBool* m_skip_duplicate_xfbs; // Other - QCheckBox* m_fast_depth_calculation; - QCheckBox* m_disable_bounding_box; - QCheckBox* m_vertex_rounding; - QCheckBox* m_save_texture_cache_state; - QCheckBox* m_defer_efb_copies; + GraphicsBool* m_fast_depth_calculation; + GraphicsBool* m_disable_bounding_box; + GraphicsBool* m_vertex_rounding; + GraphicsBool* m_save_texture_cache_state; + GraphicsBool* m_defer_efb_copies; void CreateWidgets(); void ConnectWidgets();