diff --git a/docs/window/settings_window.rst b/docs/window/settings_window.rst index 7029a8614..e84d21c0c 100644 --- a/docs/window/settings_window.rst +++ b/docs/window/settings_window.rst @@ -20,6 +20,22 @@ This allows you to choose what theme to use in RenderDoc. By default when first The theme won't fully apply until the next restart, although most elements will update immediately to give you a preview. +--------------- + + | :guilabel:`Global font scale` Default: ``100%`` + +This option will apply a global font scale to all fonts in the UI. This will only apply to text elements, and other UI elements will take their scale from the system's DPI scaling configuration. + +Changing this option will need the UI to be restarted before it fully takes effect on all UI elements. + +--------------- + + | :guilabel:`Prefer monospaced fonts in UI` Default: ``Disabled`` + +This option will use a monospaced font for every place in the UI where any data or output is displayed. + +Changing this option will need the UI to be restarted before it fully takes effect on all UI elements. + --------------- | :guilabel:`Minimum decimal places on float values` Default: ``2`` @@ -116,14 +132,6 @@ Every couple of days RenderDoc will send a single web request to a secure server If you would prefer RenderDoc does not ever contact an external server, disable this checkbox. If you do this it's recommended that you manually check for updates as new versions will be made available regularly with bugfixes. ---------------- - - | :guilabel:`Prefer monospaced fonts in UI` Default: ``Disabled`` - -This option will use a monospaced font for every place in the UI where any data or output is displayed. - -Changing this option will need the UI to be restarted before it takes effect. - --------------- | :guilabel:`Always replay captures locally` Default: ``Disabled`` diff --git a/qrenderdoc/Code/Interface/PersistantConfig.cpp b/qrenderdoc/Code/Interface/PersistantConfig.cpp index aeecb5b19..5bb6be188 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.cpp +++ b/qrenderdoc/Code/Interface/PersistantConfig.cpp @@ -193,6 +193,10 @@ void PersistantConfig::applyValues(const QVariantMap &values) RENAMED_SETTING(QVariantList, RecentLogFiles, RecentCaptureFiles); RENAMED_SETTING(QDateTime, DegradedLog_LastUpdate, DegradedCapture_LastUpdate); RENAMED_SETTING(QVariantList, SPIRVDisassemblers, ShaderProcessors); + + // apply reasonable bounds to font scale to avoid invalid values + // 25% - 400% + Font_GlobalScale = qBound(0.25f, Font_GlobalScale, 4.0f); } static QMutex RemoteHostLock; diff --git a/qrenderdoc/Code/Interface/PersistantConfig.h b/qrenderdoc/Code/Interface/PersistantConfig.h index f27e6d925..a0543f39e 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.h +++ b/qrenderdoc/Code/Interface/PersistantConfig.h @@ -332,6 +332,8 @@ DECLARE_REFLECTION_STRUCT(BugReport); \ CONFIG_SETTING_VAL(public, int, int, Formatter_PosExp, 7) \ \ + CONFIG_SETTING_VAL(public, float, float, Font_GlobalScale, 1.0f) \ + \ CONFIG_SETTING_VAL(public, bool, bool, Font_PreferMonospaced, false) \ \ CONFIG_SETTING_VAL(public, QString, rdcstr, Android_SDKPath, "") \ diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index afce3ce82..4eed14797 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -1806,6 +1806,8 @@ int Formatter::m_minFigures = 2, Formatter::m_maxFigures = 5, Formatter::m_expNe double Formatter::m_expNegValue = 0.00001; // 10^(-5) double Formatter::m_expPosValue = 10000000.0; // 10^7 QFont *Formatter::m_Font = NULL; +float Formatter::m_FontBaseSize = 10.0f; // this should always be overridden below, but just in + // case let's pick a sensible value QColor Formatter::m_DarkChecker, Formatter::m_LightChecker; void Formatter::setParams(const PersistantConfig &config) @@ -1819,10 +1821,19 @@ void Formatter::setParams(const PersistantConfig &config) m_expPosValue = qPow(10.0, config.Formatter_PosExp); if(!m_Font) + { m_Font = new QFont(); + m_FontBaseSize = QApplication::font().pointSizeF(); + } + *m_Font = config.Font_PreferMonospaced ? QFontDatabase::systemFont(QFontDatabase::FixedFont) : QFont(); + m_Font->setPointSizeF(m_FontBaseSize * config.Font_GlobalScale); + QFont f = QApplication::font(); + f.setPointSizeF(m_FontBaseSize * config.Font_GlobalScale); + QApplication::setFont(f); + Formatter::setPalette(QApplication::palette()); } diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index 7988dd3d3..d5c99591d 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -249,6 +249,7 @@ private: static int m_minFigures, m_maxFigures, m_expNegCutoff, m_expPosCutoff; static double m_expNegValue, m_expPosValue; static QFont *m_Font; + static float m_FontBaseSize; static QColor m_DarkChecker, m_LightChecker; }; diff --git a/qrenderdoc/Widgets/PipelineFlowChart.cpp b/qrenderdoc/Widgets/PipelineFlowChart.cpp index 540a029b4..618ffa189 100644 --- a/qrenderdoc/Widgets/PipelineFlowChart.cpp +++ b/qrenderdoc/Widgets/PipelineFlowChart.cpp @@ -184,7 +184,11 @@ void PipelineFlowChart::paintEvent(QPaintEvent *e) QPainter p(this); - p.setFont(Formatter::PreferredFont()); + QFont f = Formatter::PreferredFont(); + + f.setPointSizeF(1.5f * f.pointSizeF()); + + p.setFont(f); p.fillRect(rect(), Qt::transparent); diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp index ae8525bd3..8b197c0d3 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp @@ -39,6 +39,8 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent) { ui->setupUi(this); + m_Init = true; + m_ReplayOptions = new ReplayOptionsSelector(m_Ctx, false, this); ui->replayOptionsLayout->insertWidget(0, m_ReplayOptions); @@ -54,6 +56,21 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent) for(int i = 0; i < StyleData::numAvailable; i++) ui->UIStyle->addItem(StyleData::availStyles[i].styleName); + ui->Font_GlobalScale->addItems({lit("50%"), lit("75%"), lit("100%"), lit("125%"), lit("150%"), + lit("175%"), lit("200%"), lit("250%"), lit("300%"), lit("400%")}); + + ui->Font_GlobalScale->setCurrentText( + QString::number(ceil(m_Ctx.Config().Font_GlobalScale * 100)) + lit("%")); + + for(int i = 0; i < ui->Font_GlobalScale->count(); i++) + { + if(ui->Font_GlobalScale->currentText() == ui->Font_GlobalScale->itemText(i)) + { + ui->Font_GlobalScale->setCurrentIndex(i); + break; + } + } + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); ui->tabWidget->tabBar()->setVisible(false); @@ -61,8 +78,6 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent) for(int i = 0; i < ui->tabWidget->count(); i++) ui->pages->addItem(ui->tabWidget->tabText(i)); - m_Init = true; - for(int i = 0; i < (int)TimeUnit::Count; i++) { ui->EventBrowser_TimeUnit->addItem(UnitSuffix((TimeUnit)i)); @@ -183,6 +198,8 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent) m_Init = false; + QObject::connect(ui->Font_GlobalScale->lineEdit(), &QLineEdit::returnPressed, this, + &SettingsDialog::Font_GlobalScale_returnPressed); QObject::connect(ui->shaderTools->verticalHeader(), &QHeaderView::sectionMoved, this, &SettingsDialog::shaderTools_rowMoved); QObject::connect(ui->Formatter_MinFigures, OverloadedSlot::of(&QSpinBox::valueChanged), this, @@ -240,6 +257,31 @@ void SettingsDialog::on_okButton_accepted() accept(); } +void SettingsDialog::on_Font_GlobalScale_currentIndexChanged(int index) +{ + Font_GlobalScale_returnPressed(); +} + +void SettingsDialog::Font_GlobalScale_returnPressed() +{ + if(m_Init) + return; + + QString scaleText = ui->Font_GlobalScale->currentText().replace(QLatin1Char('%'), QLatin1Char(' ')); + + bool ok = false; + int scale = scaleText.toInt(&ok); + + if(!ok) + scale = 100; + + m_Ctx.Config().Font_GlobalScale = (float)(scale) / 100.0f; + + m_Ctx.Config().SetupFormatting(); + + m_Ctx.Config().Save(); +} + // general void SettingsDialog::formatter_valueChanged(int val) { diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.h b/qrenderdoc/Windows/Dialogs/SettingsDialog.h index c883b8bda..5809672c4 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.h +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.h @@ -56,6 +56,8 @@ private slots: void on_okButton_accepted(); // general + void on_Font_GlobalScale_currentIndexChanged(int index); + void Font_GlobalScale_returnPressed(); void on_UIStyle_currentIndexChanged(int index); void on_tempDirectory_textEdited(const QString &temp); void on_saveDirectory_textEdited(const QString &save); diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.ui b/qrenderdoc/Windows/Dialogs/SettingsDialog.ui index 3d3ee6739..3fc7ed135 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.ui +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.ui @@ -101,167 +101,15 @@ General - - - - Changes the directory where capture files are saved after being created, until saved manually or deleted. - -Defaults to %TEMP%. - - - Directory for temporary capture files - - - - - - - Any numbers smaller than this exponent will be displayed in scientific notation. -E.g. a value of 3 means 0.005 / 10 = 5E-4 - - - 5 - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - Changes the directory where capture files are saved after being created, until saved manually or deleted. - -Defaults to %TEMP%. - - - - - - - Changes the directory where capture files are saved after being created, until saved manually or deleted. - -Defaults to %TEMP%. - - - Browse - - - - - + + Changes the default directory for the save dialog when saving capture files. Defaults to blank, which follows system default behaviour. - Browse - - - - - - - Enables functionality on the capture application window that will insert RenderDoc automatically -into all new processes created - then inject into the target (matching) executable. - -Useful for capturing programs indirectly that can't easily be launched directly by RenderDoc - -Since this is a global system hook it must be used carefully and only when necessary! - - - - - - - - - - Allows RenderDoc to phone home to https://renderdoc.org to anonymously check for new versions. - - - - - - - - - - Wherever possible a monospaced font will be used instead of the default font - - - - - - - - - - No more decimal places than this will be displayed on floats. -e.g. a value of 5 means 0.123456789 will display as 0.12345 and 123.123456789 will display as 123.12345 - - - 5 - - - - - - - Changes the default directory for the save dialog when saving capture files. - -Defaults to blank, which follows system default behaviour. - - - - - - - Any numbers larger than this exponent will be displayed in scientific notation. -e.g. 1000 * 10 = 1e4 - - - 7 - - - 10 - - - - - - - If a capture is marked as being created on a significantly different system (different OS or platform) -as is currently running, then by default the UI will prompt to ask if you want to replay on a remote context. - -This option overrides that and will always replay locally if the local context is selected. - - - Always replay captures locally, never prompt about it - - - - - - - If a capture is marked as being created on a significantly different system (different OS or platform) -as is currently running, then by default the UI will prompt to ask if you want to replay on a remote context. - -This option overrides that and will always replay locally if the local context is selected. - - - + Default save directory for captures @@ -278,76 +126,7 @@ This option overrides that and will always replay locally if the local context i - - - - Visual theme of the UI - - - - - - - Qt::Horizontal - - - - - - - Any numbers larger than this exponent will be displayed in scientific notation. -e.g. 1000 * 10 = 1e4 - - - Positive exponential cutoff value - - - - - - - Wherever possible a monospaced font will be used instead of the default font - - - Prefer monospaced fonts in UI (restart required) - - - - - - - Decimals will display at least this many digits. -e.g. a value of 2 means 0 will display as 0.00, 0.5 as 0.50 - - - 2 - - - - - - - Changes the default directory for the save dialog when saving capture files. - -Defaults to blank, which follows system default behaviour. - - - Default save directory for captures - - - - - - Any numbers smaller than this exponent will be displayed in scientific notation. -E.g. a value of 3 means 0.005 / 10 = 5E-4 - - - Negative exponential cutoff value - - - - At least this many decimal places will be displayed on floats. @@ -358,7 +137,39 @@ e.g. a value of 2 means 0 will display as 0.00, 0.5 as 0.50. A value of 5 would - + + + + Any numbers smaller than this exponent will be displayed in scientific notation. +E.g. a value of 3 means 0.005 / 10 = 5E-4 + + + Negative exponential cutoff value + + + + + + + Visual theme of the UI + + + + + + + Any numbers larger than this exponent will be displayed in scientific notation. +e.g. 1000 * 10 = 1e4 + + + 7 + + + 10 + + + + Enables functionality on the capture application window that will insert RenderDoc automatically @@ -373,7 +184,94 @@ Since this is a global system hook it must be used carefully and only when neces - + + + + If a capture is marked as being created on a significantly different system (different OS or platform) +as is currently running, then by default the UI will prompt to ask if you want to replay on a remote context. + +This option overrides that and will always replay locally if the local context is selected. + + + Always replay captures locally, never prompt about it + + + + + + + Changes the default directory for the save dialog when saving capture files. + +Defaults to blank, which follows system default behaviour. + + + Browse + + + + + + + Changes the directory where capture files are saved after being created, until saved manually or deleted. + +Defaults to %TEMP%. + + + Directory for temporary capture files + + + + + + + Changes the directory where capture files are saved after being created, until saved manually or deleted. + +Defaults to %TEMP%. + + + + + + + No more decimal places than this will be displayed on floats. +e.g. a value of 5 means 0.123456789 will display as 0.12345 and 123.123456789 will display as 123.12345 + + + 5 + + + + + + + Decimals will display at least this many digits. +e.g. a value of 2 means 0 will display as 0.00, 0.5 as 0.50 + + + 2 + + + + + + + Allows RenderDoc to phone home to https://renderdoc.org to anonymously check for new versions. + + + + + + + + + + Changes the default directory for the save dialog when saving capture files. + +Defaults to blank, which follows system default behaviour. + + + + No more decimal places than this will be displayed on floats. @@ -384,7 +282,63 @@ e.g. a value of 5 means 0.123456789 will display as 0.12345 - + + + + Changes the directory where capture files are saved after being created, until saved manually or deleted. + +Defaults to %TEMP%. + + + Browse + + + + + + + If a capture is marked as being created on a significantly different system (different OS or platform) +as is currently running, then by default the UI will prompt to ask if you want to replay on a remote context. + +This option overrides that and will always replay locally if the local context is selected. + + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + + + + Any numbers smaller than this exponent will be displayed in scientific notation. +E.g. a value of 3 means 0.005 / 10 = 5E-4 + + + 5 + + + + Allows RenderDoc to phone home to https://renderdoc.org to anonymously check for new versions. @@ -394,6 +348,72 @@ e.g. a value of 5 means 0.123456789 will display as 0.12345 + + + + Enables functionality on the capture application window that will insert RenderDoc automatically +into all new processes created - then inject into the target (matching) executable. + +Useful for capturing programs indirectly that can't easily be launched directly by RenderDoc + +Since this is a global system hook it must be used carefully and only when necessary! + + + + + + + + + + Any numbers larger than this exponent will be displayed in scientific notation. +e.g. 1000 * 10 = 1e4 + + + Positive exponential cutoff value + + + + + + + Wherever possible a monospaced font will be used instead of the default font + + + + + + + + + + Wherever possible a monospaced font will be used instead of the default font + + + Prefer monospaced fonts in UI (restart required) + + + + + + + A global scale for all fonts in the program. This will only scale text, icons and other UI elements will be scaled according to DPI settings as normal. + + + Global font scale (restart required) + + + + + + + A global scale for all fonts in the program. This will only scale text, icons and other UI elements will be scaled according to DPI settings as normal. + + + true + + +