diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index eb78213eadc..1fc383f6120 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -114,26 +114,6 @@ bool FontSettings::fromSettings(const QString &category, if (scheme.isEmpty() || !QFile::exists(scheme)) scheme = defaultSchemeFileName(Utils::FileName::fromString(scheme).fileName()); loadColorScheme(scheme, descriptions); - } else { - // Load color scheme from ini file - foreach (const FormatDescription &desc, descriptions) { - const TextStyle id = desc.id(); - const QString fmt = s->value(group + QLatin1String(Constants::nameForStyle(id)), QString()).toString(); - Format format; - if (fmt.isEmpty()) { - format.setForeground(desc.foreground()); - format.setBackground(desc.background()); - format.setBold(desc.format().bold()); - format.setItalic(desc.format().italic()); - format.setUnderlineColor(desc.format().underlineColor()); - format.setUnderlineStyle(desc.format().underlineStyle()); - } else { - format.fromString(fmt); - } - m_scheme.setFormatFor(id, format); - } - - m_scheme.setDisplayName(QCoreApplication::translate("TextEditor::Internal::FontSettings", "Customized")); } return true; diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 926fffdfded..fb7669ba498 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -175,42 +175,12 @@ FontSettingsPagePrivate::FontSettingsPagePrivate(const FormatDescriptions &fd, m_schemeListModel(new SchemeListModel), m_refreshingSchemeList(false) { - bool settingsFound = false; QSettings *settings = Core::ICore::settings(); if (settings) - settingsFound = m_value.fromSettings(m_settingsGroup, m_descriptions, settings); + m_value.fromSettings(m_settingsGroup, m_descriptions, settings); - if (!settingsFound) { // Apply defaults - foreach (const FormatDescription &f, m_descriptions) { - Format &format = m_value.formatFor(f.id()); - format.setForeground(f.foreground()); - format.setBackground(f.background()); - format.setBold(f.format().bold()); - format.setItalic(f.format().italic()); - format.setUnderlineColor(f.format().underlineColor()); - format.setUnderlineStyle(f.format().underlineStyle()); - } - } else if (m_value.colorSchemeFileName().isEmpty()) { - // No color scheme was loaded, but one might be imported from the ini file - ColorScheme defaultScheme; - foreach (const FormatDescription &f, m_descriptions) { - Format &format = defaultScheme.formatFor(f.id()); - format.setForeground(f.foreground()); - format.setBackground(f.background()); - format.setBold(f.format().bold()); - format.setItalic(f.format().italic()); - format.setUnderlineColor(f.format().underlineColor()); - format.setUnderlineStyle(f.format().underlineStyle()); - } - if (m_value.colorScheme() != defaultScheme) { - // Save it as a color scheme file - QString schemeFileName = createColorSchemeFileName(QLatin1String("customized%1.xml")); - if (!schemeFileName.isEmpty()) { - if (m_value.saveColorScheme(schemeFileName) && settings) - m_value.toSettings(m_settingsGroup, settings); - } - } - } + if (m_value.colorSchemeFileName().isEmpty()) + m_value.loadColorScheme(FontSettings::defaultSchemeFileName(), m_descriptions); m_lastValue = m_value; }