forked from qt-creator/qt-creator
TextEditor: Move FontSettingsPage more towards new scheme
Mainly re-using the existing pimpl as new widget implementation, and using the primary storage out of the page (into texteditorsettings). This one is structutally bit different as there is that second path (Ctrl+Wheel) to modify font zoom. Change-Id: I7b85c781c7c53a733b234754beb5bb54664be3fd Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/theme/theme.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
@@ -74,10 +75,14 @@ void FontSettings::clear()
|
||||
m_textCharFormatCache.clear();
|
||||
}
|
||||
|
||||
void FontSettings::toSettings(const QString &category,
|
||||
QSettings *s) const
|
||||
static QString settingsGroup()
|
||||
{
|
||||
s->beginGroup(category);
|
||||
return Utils::settingsKey(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
void FontSettings::toSettings(QSettings *s) const
|
||||
{
|
||||
s->beginGroup(settingsGroup());
|
||||
if (m_family != defaultFixedFontFamily() || s->contains(QLatin1String(fontFamilyKey)))
|
||||
s->setValue(QLatin1String(fontFamilyKey), m_family);
|
||||
|
||||
@@ -99,16 +104,14 @@ void FontSettings::toSettings(const QString &category,
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
bool FontSettings::fromSettings(const QString &category,
|
||||
const FormatDescriptions &descriptions,
|
||||
const QSettings *s)
|
||||
bool FontSettings::fromSettings(const FormatDescriptions &descriptions, const QSettings *s)
|
||||
{
|
||||
clear();
|
||||
|
||||
if (!s->childGroups().contains(category))
|
||||
QString group = settingsGroup();
|
||||
if (!s->childGroups().contains(group))
|
||||
return false;
|
||||
|
||||
QString group = category;
|
||||
group += QLatin1Char('/');
|
||||
|
||||
m_family = s->value(group + QLatin1String(fontFamilyKey), defaultFixedFontFamily()).toString();
|
||||
|
||||
Reference in New Issue
Block a user