Help: Remove reading of old settings

Change-Id: Icb479dd0c558f45e70cb1ff0665b1e51e131d0b6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Eike Ziller
2018-08-16 16:56:29 +02:00
parent 0c58248894
commit c81070aa7d
2 changed files with 6 additions and 29 deletions

View File

@@ -68,12 +68,6 @@ static const char kLastShownPagesKey[] = "Help/LastShownPages";
static const char kLastShownPagesZoomKey[] = "Help/LastShownPagesZoom";
static const char kLastSelectedTabKey[] = "Help/LastSelectedTab";
// TODO remove some time after 4.1
static const char kFontStyleKey[] = "Help/FallbackFontStyle";
static const char kFontWeightKey[] = "Help/FallbackFontWeight";
static const QFont::Style kDefaultFallbackFontStyle = QFont::StyleNormal;
static const int kDefaultFallbackFontWeight = QFont::Normal;
static const int kDefaultFallbackFontSize = 14;
static QString defaultFallbackFontFamily()
@@ -151,28 +145,14 @@ QFont LocalHelpManager::fallbackFont()
const QString family = settings->value(kFontFamilyKey, defaultFallbackFontFamily()).toString();
const int size = settings->value(kFontSizeKey, kDefaultFallbackFontSize).toInt();
QFont font(family, size);
// TODO remove reading of old settings some time after 4.1
if (settings->contains(kFontStyleKey) && settings->contains(kFontWeightKey)) {
const QFont::Style style = QFont::Style(settings->value(kFontStyleKey, kDefaultFallbackFontStyle).toInt());
const int weight = settings->value(kFontWeightKey, kDefaultFallbackFontWeight).toInt();
font.setStyle(style);
font.setWeight(weight);
} else {
const QString styleName = settings->value(kFontStyleNameKey,
defaultFallbackFontStyleName(font.family())).toString();
font.setStyleName(styleName);
}
const QString styleName = settings->value(kFontStyleNameKey,
defaultFallbackFontStyleName(font.family())).toString();
font.setStyleName(styleName);
return font;
}
void LocalHelpManager::setFallbackFont(const QFont &font)
{
{
// TODO remove removal of old settings some time after 4.1
QSettings *settings = Core::ICore::settings();
settings->remove(kFontStyleKey);
settings->remove(kFontWeightKey);
}
setOrRemoveSetting(kFontFamilyKey, font.family(), defaultFallbackFontFamily());
setOrRemoveSetting(kFontStyleNameKey, font.styleName(), defaultFallbackFontStyleName(font.family()));
setOrRemoveSetting(kFontSizeKey, font.pointSize(), kDefaultFallbackFontSize);