Qt: Mark individual setting help as translatable

This commit is contained in:
Connor McLaughlin 2020-07-28 19:42:14 +10:00
parent e187597dec
commit 20ff075c3f
5 changed files with 130 additions and 114 deletions

View file

@ -31,24 +31,27 @@ AudioSettingsWidget::AudioSettingsWidget(QtHostInterface* host_interface, QWidge
updateVolumeLabel(); updateVolumeLabel();
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.audioBackend, "Audio Backend", "Cubeb", m_ui.audioBackend, tr("Audio Backend"), QStringLiteral("Cubeb"),
"The audio backend determines how frames produced by the emulator are submitted to the host. Cubeb provides the " tr("The audio backend determines how frames produced by the emulator are submitted to the host. Cubeb provides the "
"lowest latency, if you encounter issues, try the SDL backend. The null backend disables all host audio output."); "lowest latency, if you encounter issues, try the SDL backend. The null backend disables all host audio "
dialog->registerWidgetHelp(m_ui.bufferSize, "Buffer Size", "2048", "output."));
"The buffer size determines the size of the chunks of audio which will be pulled by the " dialog->registerWidgetHelp(
m_ui.bufferSize, tr("Buffer Size"), QStringLiteral("2048"),
tr("The buffer size determines the size of the chunks of audio which will be pulled by the "
"host. Smaller values reduce the output latency, but may cause hitches if the emulation " "host. Smaller values reduce the output latency, but may cause hitches if the emulation "
"speed is inconsistent. Note that the Cubeb backend uses smaller chunks regardless of " "speed is inconsistent. Note that the Cubeb backend uses smaller chunks regardless of "
"this value, so using a low value here may not significantly change latency."); "this value, so using a low value here may not significantly change latency."));
dialog->registerWidgetHelp(m_ui.syncToOutput, "Sync To Output", "Checked",
"Throttles the emulation speed based on the audio backend pulling audio frames. Sync will "
"automatically be disabled if not running at 100% speed.");
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.startDumpingOnBoot, "Start Dumping On Boot", "Unchecked", m_ui.syncToOutput, "Sync To Output", tr("Checked"),
"Start dumping audio to file as soon as the emulator is started. Mainly useful as a debug option."); tr("Throttles the emulation speed based on the audio backend pulling audio frames. Sync will "
dialog->registerWidgetHelp(m_ui.volume, "Volume", "100", "automatically be disabled if not running at 100% speed."));
"Controls the volume of the audio played on the host. Values are in percentage."); dialog->registerWidgetHelp(
dialog->registerWidgetHelp(m_ui.muted, "Mute", "Unchecked", m_ui.startDumpingOnBoot, "Start Dumping On Boot", tr("Unchecked"),
"Prevents the emulator from producing any audible sound."); tr("Start dumping audio to file as soon as the emulator is started. Mainly useful as a debug option."));
dialog->registerWidgetHelp(m_ui.volume, tr("Volume"), "100",
tr("Controls the volume of the audio played on the host. Values are in percentage."));
dialog->registerWidgetHelp(m_ui.muted, tr("Mute"), tr("Unchecked"),
tr("Prevents the emulator from producing any audible sound."));
} }
AudioSettingsWidget::~AudioSettingsWidget() = default; AudioSettingsWidget::~AudioSettingsWidget() = default;

View file

@ -35,44 +35,49 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
onEnableSpeedLimiterStateChanged(); onEnableSpeedLimiterStateChanged();
onEmulationSpeedValueChanged(m_ui.emulationSpeed->value()); onEmulationSpeedValueChanged(m_ui.emulationSpeed->value());
dialog->registerWidgetHelp(m_ui.confirmPowerOff, "Confirm Power Off", "Checked",
"Determines whether a prompt will be displayed to confirm shutting down the emulator/game "
"when the hotkey is pressed.");
dialog->registerWidgetHelp(m_ui.saveStateOnExit, "Save State On Exit", "Checked",
"Automatically saves the emulator state when powering down or exiting. You can then "
"resume directly from where you left off next time.");
dialog->registerWidgetHelp(m_ui.startFullscreen, "Start Fullscreen", "Unchecked",
"Automatically switches to fullscreen mode when a game is started.");
dialog->registerWidgetHelp(m_ui.renderToMain, "Render To Main Window", "Checked",
"Renders the display of the simulated console to the main window of the application, over "
"the game list. If unchecked, the display will render in a seperate window.");
dialog->registerWidgetHelp(m_ui.pauseOnStart, "Pause On Start", "Unchecked",
"Pauses the emulator when a game is started.");
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.loadDevicesFromSaveStates, "Load Devices From Save States", "Unchecked", m_ui.confirmPowerOff, tr("Confirm Power Off"), tr("Checked"),
"When enabled, memory cards and controllers will be overwritten when save states are loaded. This can " tr("Determines whether a prompt will be displayed to confirm shutting down the emulator/game "
"when the hotkey is pressed."));
dialog->registerWidgetHelp(m_ui.saveStateOnExit, tr("Save State On Exit"), tr("Checked"),
tr("Automatically saves the emulator state when powering down or exiting. You can then "
"resume directly from where you left off next time."));
dialog->registerWidgetHelp(m_ui.startFullscreen, tr("Start Fullscreen"), tr("Unchecked"),
tr("Automatically switches to fullscreen mode when a game is started."));
dialog->registerWidgetHelp(
m_ui.renderToMain, tr("Render To Main Window"), tr("Checked"),
tr("Renders the display of the simulated console to the main window of the application, over "
"the game list. If unchecked, the display will render in a separate window."));
dialog->registerWidgetHelp(m_ui.pauseOnStart, tr("Pause On Start"), tr("Unchecked"),
tr("Pauses the emulator when a game is started."));
dialog->registerWidgetHelp(
m_ui.loadDevicesFromSaveStates, tr("Load Devices From Save States"), tr("Unchecked"),
tr("When enabled, memory cards and controllers will be overwritten when save states are loaded. This can "
"result in lost saves, and controller type mismatches. For deterministic save states, enable this option, " "result in lost saves, and controller type mismatches. For deterministic save states, enable this option, "
"otherwise leave disabled."); "otherwise leave disabled."));
dialog->registerWidgetHelp(m_ui.enableSpeedLimiter, "Enable Speed Limiter", "Checked",
"Throttles the emulation speed to the chosen speed above. If unchecked, the emulator will "
"run as fast as possible, which may not be playable.");
dialog->registerWidgetHelp(m_ui.increaseTimerResolution, "Increase Timer Resolution", "Checked",
"Increases the system timer resolution when emulation is started to provide more accurate "
"frame pacing. May increase battery usage on laptops.");
dialog->registerWidgetHelp(m_ui.emulationSpeed, "Emulation Speed", "100%",
"Sets the target emulation speed. It is not guaranteed that this speed will be reached, "
"and if not, the emulator will run as fast as it can manage.");
dialog->registerWidgetHelp(m_ui.showOSDMessages, "Show OSD Messages", "Checked",
"Shows on-screen-display messages when events occur such as save states being "
"created/loaded, screenshots being taken, etc.");
dialog->registerWidgetHelp(m_ui.showFPS, "Show FPS", "Unchecked",
"Shows the internal frame rate of the game in the top-right corner of the display.");
dialog->registerWidgetHelp(m_ui.showVPS, "Show VPS", "Unchecked",
"Shows the number of frames (or v-syncs) displayed per second by the system in the "
"top-right corner of the display.");
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.showSpeed, "Show Speed", "Unchecked", m_ui.enableSpeedLimiter, tr("Enable Speed Limiter"), tr("Checked"),
"Shows the current emulation speed of the system in the top-right corner of the display as a percentage."); tr("Throttles the emulation speed to the chosen speed above. If unchecked, the emulator will "
"run as fast as possible, which may not be playable."));
dialog->registerWidgetHelp(
m_ui.increaseTimerResolution, tr("Increase Timer Resolution"), tr("Checked"),
tr("Increases the system timer resolution when emulation is started to provide more accurate "
"frame pacing. May increase battery usage on laptops."));
dialog->registerWidgetHelp(
m_ui.emulationSpeed, tr("Emulation Speed"), "100%",
tr("Sets the target emulation speed. It is not guaranteed that this speed will be reached, "
"and if not, the emulator will run as fast as it can manage."));
dialog->registerWidgetHelp(m_ui.showOSDMessages, tr("Show OSD Messages"), tr("Checked"),
tr("Shows on-screen-display messages when events occur such as save states being "
"created/loaded, screenshots being taken, etc."));
dialog->registerWidgetHelp(m_ui.showFPS, tr("Show FPS"), tr("Unchecked"),
tr("Shows the internal frame rate of the game in the top-right corner of the display."));
dialog->registerWidgetHelp(m_ui.showVPS, tr("Show VPS"), tr("Unchecked"),
tr("Shows the number of frames (or v-syncs) displayed per second by the system in the "
"top-right corner of the display."));
dialog->registerWidgetHelp(
m_ui.showSpeed, tr("Show Speed"), tr("Unchecked"),
tr("Shows the current emulation speed of the system in the top-right corner of the display as a percentage."));
// Since this one is compile-time selected, we don't put it in the .ui file. // Since this one is compile-time selected, we don't put it in the .ui file.
#ifdef WITH_DISCORD_PRESENCE #ifdef WITH_DISCORD_PRESENCE
@ -81,8 +86,8 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, enableDiscordPresence, "Main", SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, enableDiscordPresence, "Main",
"EnableDiscordPresence"); "EnableDiscordPresence");
m_ui.formLayout_4->addWidget(enableDiscordPresence, m_ui.formLayout_4->rowCount(), 0); m_ui.formLayout_4->addWidget(enableDiscordPresence, m_ui.formLayout_4->rowCount(), 0);
dialog->registerWidgetHelp(enableDiscordPresence, "Enable Discord Presence", "Unchecked", dialog->registerWidgetHelp(enableDiscordPresence, tr("Enable Discord Presence"), tr("Unchecked"),
"Shows the game you are currently playing as part of your profile in Discord."); tr("Shows the game you are currently playing as part of your profile in Discord."));
} }
#endif #endif
} }

View file

@ -52,67 +52,76 @@ GPUSettingsWidget::GPUSettingsWidget(QtHostInterface* host_interface, QWidget* p
populateGPUAdapters(); populateGPUAdapters();
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.renderer, "Renderer", Settings::GetRendererDisplayName(Settings::DEFAULT_GPU_RENDERER), m_ui.renderer, tr("Renderer"), Settings::GetRendererDisplayName(Settings::DEFAULT_GPU_RENDERER),
tr(
"Chooses the backend to use for rendering tasks for the the console GPU. Depending on your system and hardware, " "Chooses the backend to use for rendering tasks for the the console GPU. Depending on your system and hardware, "
"Direct3D 11 and OpenGL hardware backends may be available. The software renderer offers the best compatibility, " "Direct3D 11 and OpenGL hardware backends may be available. The software renderer offers the best compatibility, "
"but is the slowest and does not offer any enhancements."); "but is the slowest and does not offer any enhancements."));
dialog->registerWidgetHelp(m_ui.useDebugDevice, "Use Debug Device", "Unchecked", dialog->registerWidgetHelp(m_ui.useDebugDevice, tr("Use Debug Device"), tr("Unchecked"),
"Enables the usage of debug devices and shaders for rendering APIs which support them. " tr("Enables the usage of debug devices and shaders for rendering APIs which support them. "
"Should only be used when debugging the emulator."); "Should only be used when debugging the emulator."));
dialog->registerWidgetHelp(m_ui.displayAspectRatio, "Aspect Ratio", "4:3", dialog->registerWidgetHelp(
"Changes the aspect ratio used to display the console's output to the screen. The default " m_ui.displayAspectRatio, tr("Aspect Ratio"), QStringLiteral("4:3"),
"is 4:3 which matches a typical TV of the era."); tr("Changes the aspect ratio used to display the console's output to the screen. The default "
dialog->registerWidgetHelp(m_ui.displayCropMode, "Crop Mode", "Only Overscan Area", "is 4:3 which matches a typical TV of the era."));
"Determines how much of the area typically not visible on a consumer TV set to crop/hide. " dialog->registerWidgetHelp(
m_ui.displayCropMode, tr("Crop Mode"), tr("Only Overscan Area"),
tr("Determines how much of the area typically not visible on a consumer TV set to crop/hide. "
"Some games display content in the overscan area, or use it for screen effects and may " "Some games display content in the overscan area, or use it for screen effects and may "
"not display correctly with the All Borders setting. Only Overscan offers a good " "not display correctly with the All Borders setting. Only Overscan offers a good "
"compromise between stability and hiding black borders."); "compromise between stability and hiding black borders."));
dialog->registerWidgetHelp(m_ui.disableInterlacing, "Disable Interlacing (force progressive render/scan)", "Unchecked", dialog->registerWidgetHelp(
"Forces the display of frames to progressive mode. This only affects the displayed image, " m_ui.disableInterlacing, tr("Disable Interlacing (force progressive render/scan)"), tr("Unchecked"),
tr("Forces the display of frames to progressive mode. This only affects the displayed image, "
"the console will be unaware of the setting. If the game is internally producing " "the console will be unaware of the setting. If the game is internally producing "
"interlaced frames, this option may not have any effect. Usually safe to enable."); "interlaced frames, this option may not have any effect. Usually safe to enable."));
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.displayLinearFiltering, "Linear Upscaling", "Checked", m_ui.displayLinearFiltering, tr("Linear Upscaling"), tr("Checked"),
"Uses bilinear texture filtering when displaying the console's framebuffer to the screen. Disabling filtering will " tr("Uses bilinear texture filtering when displaying the console's framebuffer to the screen. Disabling filtering "
"producer a sharper, blockier/pixelated image. Enabling will smooth out the image. The option will be less " "will producer a sharper, blockier/pixelated image. Enabling will smooth out the image. The option will be less "
"noticable the higher the resolution scale."); "noticable the higher the resolution scale."));
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.displayIntegerScaling, "Integer Upscaling", "Unchecked", m_ui.displayIntegerScaling, tr("Integer Upscaling"), tr("Unchecked"),
"Adds padding to the display area to ensure that the ratio between pixels on the host to " tr("Adds padding to the display area to ensure that the ratio between pixels on the host to "
"pixels in the console is an integer number. May result in a sharper image in some 2D games."); "pixels in the console is an integer number. May result in a sharper image in some 2D games."));
dialog->registerWidgetHelp(m_ui.vsync, "VSync", "Checked", dialog->registerWidgetHelp(
"Enables synchronization with the host display when possible. Enabling this option will " m_ui.vsync, tr("VSync"), tr("Checked"),
tr("Enables synchronization with the host display when possible. Enabling this option will "
"provide better frame pacing and smoother motion with fewer duplicated frames. VSync is " "provide better frame pacing and smoother motion with fewer duplicated frames. VSync is "
"automatically disabled when it is not possible (e.g. running at non-100% speed)."); "automatically disabled when it is not possible (e.g. running at non-100% speed)."));
dialog->registerWidgetHelp(m_ui.resolutionScale, "Resolution Scale", "1x", dialog->registerWidgetHelp(
"Enables the upscaling of 3D objects rendered to the console's framebuffer. Only applies " m_ui.resolutionScale, tr("Resolution Scale"), "1x",
tr("Enables the upscaling of 3D objects rendered to the console's framebuffer. Only applies "
"to the hardware backends. This option is usually safe, with most games looking fine at " "to the hardware backends. This option is usually safe, with most games looking fine at "
"higher resolutions. Higher resolutions require a more powerful GPU."); "higher resolutions. Higher resolutions require a more powerful GPU."));
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.trueColor, "True Color Rendering (24-bit, disables dithering)", "Unchecked", m_ui.trueColor, tr("True Color Rendering (24-bit, disables dithering)"), tr("Unchecked"),
"Forces the precision of colours output to the console's framebuffer to use the full 8 bits of precision per " tr("Forces the precision of colours output to the console's framebuffer to use the full 8 bits of precision per "
"channel. This produces nicer looking gradients at the cost of making some colours look slightly different. " "channel. This produces nicer looking gradients at the cost of making some colours look slightly different. "
"Disabling the option also enables dithering, which makes the transition between colours less sharp by applying a " "Disabling the option also enables dithering, which makes the transition between colours less sharp by applying "
"pattern around those pixels. Most games are compatible with this option, but there is a number which aren't and " "a pattern around those pixels. Most games are compatible with this option, but there is a number which aren't "
"will have broken effects with it enabled. Only applies to the hardware renderers."); "and will have broken effects with it enabled. Only applies to the hardware renderers."));
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.scaledDithering, "Scaled Dithering (scale dither pattern to resolution)", "Checked", m_ui.scaledDithering, tr("Scaled Dithering (scale dither pattern to resolution)"), tr("Checked"),
"Scales the dither pattern to the resolution scale of the emulated GPU. This makes the dither pattern much less " tr("Scales the dither pattern to the resolution scale of the emulated GPU. This makes the dither pattern much less "
"obvious at higher resolutions. Usually safe to enable, and only supported by the hardware renderers."); "obvious at higher resolutions. Usually safe to enable, and only supported by the hardware renderers."));
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.forceNTSCTimings, "Force NTSC Timings (60hz-on-PAL)", "Unchecked", m_ui.forceNTSCTimings, tr("Force NTSC Timings (60hz-on-PAL)"), tr("Unchecked"),
tr(
"Uses NTSC frame timings when the console is in PAL mode, forcing PAL games to run at 60hz. For most games which " "Uses NTSC frame timings when the console is in PAL mode, forcing PAL games to run at 60hz. For most games which "
"have a speed tied to the framerate, this will result in the game running approximately 17% faster. For variable " "have a speed tied to the framerate, this will result in the game running approximately 17% faster. For variable "
"frame rate games, it may not affect the framerate."); "frame rate games, it may not affect the framerate."));
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.linearTextureFiltering, "Bilinear Texture Filtering", "Unchecked", m_ui.linearTextureFiltering, tr("Bilinear Texture Filtering"), tr("Unchecked"),
"Smooths out the blockyness of magnified textures on 3D object by using bilinear " tr("Smooths out the blockyness of magnified textures on 3D object by using bilinear "
"filtering. Will have a greater effect on higher resolution scales. Currently this option " "filtering. Will have a greater effect on higher resolution scales. Currently this option "
"produces artifacts around objects in many games and needs further work. Only applies to the hardware renderers."); "produces artifacts around objects in many games and needs further work. Only applies to the hardware "
dialog->registerWidgetHelp(m_ui.widescreenHack, "Widescreen Hack", "Unchecked", "renderers."));
"Scales vertex positions in screen-space to a widescreen aspect ratio, essentially " dialog->registerWidgetHelp(
m_ui.widescreenHack, tr("Widescreen Hack"), tr("Unchecked"),
tr("Scales vertex positions in screen-space to a widescreen aspect ratio, essentially "
"increasing the field of view from 4:3 to 16:9 in 3D games. For 2D games, or games which " "increasing the field of view from 4:3 to 16:9 in 3D games. For 2D games, or games which "
"use pre-rendered backgrounds, this enhancement will not work as expected."); "use pre-rendered backgrounds, this enhancement will not work as expected."));
} }
GPUSettingsWidget::~GPUSettingsWidget() = default; GPUSettingsWidget::~GPUSettingsWidget() = default;

View file

@ -105,13 +105,12 @@ void SettingsDialog::onCategoryCurrentRowChanged(int row)
m_ui.helpText->setText(m_category_help_text[row]); m_ui.helpText->setText(m_category_help_text[row]);
} }
void SettingsDialog::registerWidgetHelp(QObject* object, const char* title, const char* recommended_value, void SettingsDialog::registerWidgetHelp(QObject* object, QString title, QString recommended_value, QString text)
const char* text)
{ {
// construct rich text with formatted description // construct rich text with formatted description
QString full_text; QString full_text;
full_text += "<table width='100%' cellpadding='0' cellspacing='0'><tr><td><strong>"; full_text += "<table width='100%' cellpadding='0' cellspacing='0'><tr><td><strong>";
full_text += tr(title); full_text += title;
full_text += "</strong></td><td align='right'><strong>"; full_text += "</strong></td><td align='right'><strong>";
full_text += tr("Recommended Value"); full_text += tr("Recommended Value");
full_text += ": </strong>"; full_text += ": </strong>";

View file

@ -49,7 +49,7 @@ public:
AudioSettingsWidget* getAudioSettingsWidget() const { return m_audio_settings; } AudioSettingsWidget* getAudioSettingsWidget() const { return m_audio_settings; }
AdvancedSettingsWidget* getAdvancedSettingsWidget() const { return m_advanced_settings; } AdvancedSettingsWidget* getAdvancedSettingsWidget() const { return m_advanced_settings; }
void registerWidgetHelp(QObject* object, const char* title, const char* recommended_value, const char* text); void registerWidgetHelp(QObject* object, QString title, QString recommended_value, QString text);
bool eventFilter(QObject* object, QEvent* event) override; bool eventFilter(QObject* object, QEvent* event) override;
public Q_SLOTS: public Q_SLOTS: