mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-12 02:08:45 +00:00
Qt/FullscreenUI: Add OSD Margin setting
Signed-off-by: SternXD <[email protected]>
This commit is contained in:
@@ -23,6 +23,7 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p
|
||||
// OSD Settings
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
SettingWidgetBinder::BindWidgetToFloatSetting(sif, m_ui.scale, "EmuCore/GS", "OsdScale", 100.0f);
|
||||
SettingWidgetBinder::BindWidgetToFloatSetting(sif, m_ui.margin, "EmuCore/GS", "OsdMargin", 10.0f);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.messagesPos, "EmuCore/GS", "OsdMessagesPos", static_cast<int>(Pcsx2Config::GSOptions::DEFAULT_OSD_MESSAGE_POS));
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.performancePos, "EmuCore/GS", "OsdPerformancePos", static_cast<int>(Pcsx2Config::GSOptions::DEFAULT_OSD_PERFORMANCE_POS));
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showSpeedPercentages, "EmuCore/GS", "OsdShowSpeed", false);
|
||||
@@ -51,6 +52,9 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
dialog()->registerWidgetHelp(m_ui.scale, tr("OSD Scale"), tr("100%"), tr("Scales the size of the onscreen OSD from 50% to 500%."));
|
||||
|
||||
dialog()->registerWidgetHelp(m_ui.margin, tr("OSD Margin"), tr("10px"),
|
||||
tr("Sets the distance in pixels from the edges of the screen for OSD elements."));
|
||||
|
||||
dialog()->registerWidgetHelp(m_ui.messagesPos, tr("OSD Messages Position"), tr("Left (Default)"),
|
||||
tr("Position of on-screen-display messages when events occur such as save states being "
|
||||
"created/loaded, screenshots being taken, etc."));
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<string>On-Screen Display</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="messagesPosLabel">
|
||||
<property name="text">
|
||||
<string>OSD Messages Position:</string>
|
||||
@@ -49,7 +49,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="messagesPos">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -103,7 +103,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="optionLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
|
||||
@@ -280,7 +280,36 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="marginLabel">
|
||||
<property name="text">
|
||||
<string>OSD Margin:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>margin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="margin">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>px</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="performancePos">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -334,7 +363,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<spacer name="checkboxSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
@@ -350,7 +379,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="performancePosLabel">
|
||||
<property name="text">
|
||||
<string>OSD Performance Position:</string>
|
||||
@@ -380,6 +409,7 @@
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>scale</tabstop>
|
||||
<tabstop>margin</tabstop>
|
||||
<tabstop>messagesPos</tabstop>
|
||||
<tabstop>performancePos</tabstop>
|
||||
<tabstop>showSpeedPercentages</tabstop>
|
||||
|
||||
@@ -728,6 +728,7 @@ struct Pcsx2Config
|
||||
static constexpr TriFiltering DEFAULT_TRILINEAR_FILTERING_MODE = TriFiltering::Automatic;
|
||||
|
||||
static constexpr float DEFAULT_OSD_SCALE = 100.0f;
|
||||
static constexpr float DEFAULT_OSD_MARGIN = 10.0f;
|
||||
static constexpr OsdOverlayPos DEFAULT_OSD_MESSAGE_POS = OsdOverlayPos::TopLeft;
|
||||
static constexpr OsdOverlayPos DEFAULT_OSD_PERFORMANCE_POS = OsdOverlayPos::TopRight;
|
||||
|
||||
@@ -845,6 +846,7 @@ struct Pcsx2Config
|
||||
int Crop[4] = {};
|
||||
|
||||
float OsdScale = DEFAULT_OSD_SCALE;
|
||||
float OsdMargin = DEFAULT_OSD_MARGIN;
|
||||
OsdOverlayPos OsdMessagesPos = DEFAULT_OSD_MESSAGE_POS;
|
||||
OsdOverlayPos OsdPerformancePos = DEFAULT_OSD_PERFORMANCE_POS;
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ void GSDumpReplayer::RenderUI()
|
||||
{
|
||||
const float scale = ImGuiManager::GetGlobalScale();
|
||||
const float shadow_offset = std::ceil(1.0f * scale);
|
||||
const float margin = std::ceil(10.0f * scale);
|
||||
const float margin = std::ceil(GSConfig.OsdMargin * scale);
|
||||
const float spacing = std::ceil(5.0f * scale);
|
||||
float position_y = margin;
|
||||
|
||||
|
||||
@@ -3187,6 +3187,8 @@ void FullscreenUI::DrawOSDSettingsPage()
|
||||
MenuHeading(FSUI_CSTR("On-Screen Display"));
|
||||
DrawIntSpinBoxSetting(bsi, FSUI_ICONSTR(ICON_FA_MAGNIFYING_GLASS, "OSD Scale"),
|
||||
FSUI_CSTR("Determines how large the on-screen messages and monitors are."), "EmuCore/GS", "OsdScale", 100, 25, 500, 1, FSUI_CSTR("%d%%"));
|
||||
DrawIntSpinBoxSetting(bsi, FSUI_ICONSTR(ICON_FA_BORDER_ALL, "OSD Margin"),
|
||||
FSUI_CSTR("Determines the distance in pixels from the edges of the screen for OSD elements."), "EmuCore/GS", "OsdMargin", 10, 0, 100, 1, FSUI_CSTR("%dpx"));
|
||||
|
||||
// OSD Positioning Options
|
||||
static constexpr const char* s_osd_position_options[] = {
|
||||
|
||||
@@ -798,7 +798,7 @@ void ImGuiManager::DrawOSDMessages(Common::Timer::Value current_time)
|
||||
const float font_size = GetFontSizeStandard();
|
||||
const float scale = s_global_scale;
|
||||
const float spacing = std::ceil(5.0f * scale);
|
||||
const float margin = std::ceil(10.0f * scale);
|
||||
const float margin = std::ceil(GSConfig.OsdMargin * scale);
|
||||
const float padding = std::ceil(8.0f * scale);
|
||||
const float rounding = std::ceil(5.0f * scale);
|
||||
const float max_width = s_window_width - (margin + padding) * 2.0f;
|
||||
|
||||
@@ -1433,7 +1433,7 @@ void SaveStateSelectorUI::ShowSlotOSDMessage()
|
||||
void ImGuiManager::RenderOverlays()
|
||||
{
|
||||
const float scale = ImGuiManager::GetGlobalScale();
|
||||
const float margin = std::ceil(10.0f * scale);
|
||||
const float margin = std::ceil(GSConfig.OsdMargin * scale);
|
||||
const float spacing = std::ceil(5.0f * scale);
|
||||
float position_y = margin;
|
||||
|
||||
|
||||
@@ -814,6 +814,7 @@ bool Pcsx2Config::GSOptions::OptionsAreEqual(const GSOptions& right) const
|
||||
OpEqu(Crop[3]) &&
|
||||
|
||||
OpEqu(OsdScale) &&
|
||||
OpEqu(OsdMargin) &&
|
||||
OpEqu(OsdMessagesPos) &&
|
||||
OpEqu(OsdPerformancePos) &&
|
||||
|
||||
@@ -1021,6 +1022,7 @@ void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
|
||||
SettingsWrapIntEnumEx(InterlaceMode, "deinterlace_mode");
|
||||
|
||||
SettingsWrapEntry(OsdScale);
|
||||
SettingsWrapEntry(OsdMargin);
|
||||
SettingsWrapIntEnumEx(OsdMessagesPos, "OsdMessagesPos");
|
||||
SettingsWrapIntEnumEx(OsdPerformancePos, "OsdPerformancePos");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user