mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 09:26:52 +00:00
Allow customising the fixed/monospace font as well. Refs #2443
This commit is contained in:
@@ -47,9 +47,6 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
|
||||
m_ReplayOptions = new ReplayOptionsSelector(m_Ctx, false, this);
|
||||
|
||||
QStringList fontFamilies = QFontDatabase().families();
|
||||
fontFamilies.insert(0, tr("Default (%1)").arg(Formatter::DefaultFontFamily()));
|
||||
|
||||
ui->replayOptionsLayout->insertWidget(0, m_ReplayOptions);
|
||||
|
||||
QString styleChooseTooltip = ui->UIStyle->toolTip();
|
||||
@@ -63,14 +60,13 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
for(int i = 0; i < StyleData::numAvailable; i++)
|
||||
ui->UIStyle->addItem(StyleData::availStyles[i].styleName);
|
||||
|
||||
QFontDatabase fontdb;
|
||||
|
||||
QStringList fontFamilies = fontdb.families();
|
||||
fontFamilies.insert(0, tr("Default (%1)").arg(Formatter::DefaultFontFamily()));
|
||||
|
||||
ui->Font_Family->addItems(fontFamilies);
|
||||
|
||||
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("%"));
|
||||
|
||||
int curFontOption = -1;
|
||||
for(int i = 0; i < ui->Font_Family->count(); i++)
|
||||
{
|
||||
@@ -86,6 +82,49 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
|
||||
ui->Font_Family->setCurrentIndex(curFontOption);
|
||||
|
||||
// remove the default again
|
||||
fontFamilies.removeAt(0);
|
||||
|
||||
// remove any non-fixed width fonts
|
||||
for(int i = 0; i < fontFamilies.count();)
|
||||
{
|
||||
if(!fontdb.isFixedPitch(fontFamilies[i]))
|
||||
{
|
||||
fontFamilies.removeAt(i);
|
||||
// check i again
|
||||
continue;
|
||||
}
|
||||
|
||||
// move to the next
|
||||
i++;
|
||||
}
|
||||
|
||||
// re-add the default
|
||||
fontFamilies.insert(0, tr("Default (%1)").arg(Formatter::DefaultMonoFontFamily()));
|
||||
|
||||
ui->Font_MonoFamily->addItems(fontFamilies);
|
||||
|
||||
curFontOption = -1;
|
||||
for(int i = 0; i < ui->Font_MonoFamily->count(); i++)
|
||||
{
|
||||
if(ui->Font_MonoFamily->itemText(i) == m_Ctx.Config().Font_MonoFamily)
|
||||
{
|
||||
curFontOption = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_Ctx.Config().Font_MonoFamily.isEmpty() || curFontOption < 0)
|
||||
curFontOption = 0;
|
||||
|
||||
ui->Font_MonoFamily->setCurrentIndex(curFontOption);
|
||||
|
||||
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))
|
||||
@@ -347,6 +386,21 @@ void SettingsDialog::on_Font_Family_currentIndexChanged(int index)
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_Font_MonoFamily_currentIndexChanged(int index)
|
||||
{
|
||||
if(m_Init)
|
||||
return;
|
||||
|
||||
if(index == 0)
|
||||
m_Ctx.Config().Font_MonoFamily.clear();
|
||||
else
|
||||
m_Ctx.Config().Font_MonoFamily = ui->Font_MonoFamily->currentText();
|
||||
|
||||
m_Ctx.Config().SetupFormatting();
|
||||
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_Font_GlobalScale_currentIndexChanged(int index)
|
||||
{
|
||||
Font_GlobalScale_returnPressed();
|
||||
|
||||
Reference in New Issue
Block a user