Adjust the font selection display text when the current choice is to let webkit choose the default

This commit is contained in:
Jean-Francois Dockes 2014-12-09 08:09:49 +01:00
parent 569a2075d9
commit 4652ade6c0
2 changed files with 17 additions and 23 deletions

View File

@ -148,14 +148,7 @@ void UIPrefsDialog::setFromPrefs()
// Result list font family and size
reslistFontFamily = prefs.reslistfontfamily;
reslistFontSize = prefs.reslistfontsize;
QString s;
if (prefs.reslistfontfamily.length() == 0) {
reslistFontPB->setText(this->font().family() + "-" +
s.setNum(this->font().pointSize()));
} else {
reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize));
}
setupReslistFontPB();
// Style sheet
qssFile = prefs.qssFile;
@ -231,6 +224,17 @@ void UIPrefsDialog::setFromPrefs()
idxLV->sortItems();
}
void UIPrefsDialog::setupReslistFontPB()
{
QString s;
if (reslistFontFamily.length() == 0) {
reslistFontPB->setText(tr("Default QtWebkit font"));
} else {
reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize));
}
}
void UIPrefsDialog::accept()
{
prefs.ssearchOnWS = ssAutoSpaceCB->isChecked();
@ -383,19 +387,9 @@ void UIPrefsDialog::showFontDialog()
// to do wrong. So now always set the font. There is still a
// way for the user to let webkit choose the default though:
// click reset, then the font name and size will be empty.
QString s;
if (1 || font.family().compare(this->font().family()) ||
font.pointSize() != this->font().pointSize()) {
reslistFontFamily = font.family();
reslistFontSize = font.pointSize();
reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize));
} else {
reslistFontFamily = "";
reslistFontSize = 0;
reslistFontPB->setText(this->font().family() + "-" +
s.setNum(this->font().pointSize()));
}
reslistFontFamily = font.family();
reslistFontSize = font.pointSize();
setupReslistFontPB();
}
}
@ -427,8 +421,7 @@ void UIPrefsDialog::resetReslistFont()
{
reslistFontFamily = "";
reslistFontSize = 0;
reslistFontPB->setText(this->font().family() + "-" +
QString().setNum(this->font().pointSize()));
setupReslistFontPB();
}
void UIPrefsDialog::showViewAction()

View File

@ -72,6 +72,7 @@ protected slots:
virtual void accept();
virtual void reject();
private:
void setupReslistFontPB();
// Locally stored data (pending ok/cancel)
QString paraFormat;
QString headerText;