From 992a178be33538ec256861d3bd54d9adc40027ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Fri, 12 Jun 2009 15:28:51 +0200 Subject: Apply bold to the current line number by default --- src/plugins/texteditor/fontsettings.cpp | 2 ++ src/plugins/texteditor/fontsettingspage.cpp | 11 ++++++----- src/plugins/texteditor/fontsettingspage.h | 7 +++---- src/plugins/texteditor/texteditorsettings.cpp | 5 ++++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index 441a7a6711..778bdbb0d2 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -201,6 +201,8 @@ bool FontSettings::fromSettings(const QString &category, if (fmt.isEmpty()) { m_formats[name].setForeground(desc.foreground()); m_formats[name].setBackground(desc.background()); + m_formats[name].setBold(desc.format().bold()); + m_formats[name].setItalic(desc.format().italic()); } else { m_formats[name].fromString(fmt); } diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 7f7b5d182c..740740443c 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -101,10 +101,16 @@ FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescrip if (!settingsFound) { // Apply defaults foreach (const FormatDescription &f, m_descriptions) { const QString name = f.name(); + m_lastValue.formatFor(name).setForeground(f.foreground()); m_lastValue.formatFor(name).setBackground(f.background()); + m_lastValue.formatFor(name).setBold(f.format().bold()); + m_lastValue.formatFor(name).setItalic(f.format().italic()); + m_value.formatFor(name).setForeground(f.foreground()); m_value.formatFor(name).setBackground(f.background()); + m_value.formatFor(name).setBold(f.format().bold()); + m_value.formatFor(name).setItalic(f.format().italic()); } } @@ -144,11 +150,6 @@ QColor FormatDescription::foreground() const return m_format.foreground(); } -void FormatDescription::setForeground(const QColor &foreground) -{ - m_format.setForeground(foreground); -} - QColor FormatDescription::background() const { if (m_name == QLatin1String(Constants::C_TEXT)) diff --git a/src/plugins/texteditor/fontsettingspage.h b/src/plugins/texteditor/fontsettingspage.h index b0e4b2efba..ad87eb173c 100644 --- a/src/plugins/texteditor/fontsettingspage.h +++ b/src/plugins/texteditor/fontsettingspage.h @@ -60,14 +60,13 @@ public: const QColor &foreground = Qt::black); QString name() const; - QString trName() const; - QColor foreground() const; - void setForeground(const QColor &foreground); - QColor background() const; + const Format &format() const { return m_format; } + Format &format() { return m_format; } + private: QString m_name; // Name of the category QString m_trName; // Displayed name of the category diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index ca562d0df1..1631949a4d 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -72,7 +72,10 @@ TextEditorSettings::TextEditorSettings(QObject *parent) formatDescriptions.push_back(FormatDescription(QLatin1String(C_SEARCH_SCOPE), tr("Search Scope"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_PARENTHESES), tr("Parentheses"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_CURRENT_LINE), tr("Current Line"))); - formatDescriptions.push_back(FormatDescription(QLatin1String(C_CURRENT_LINE_NUMBER), tr("Current Line Number"), Qt::darkGray)); + + FormatDescription currentLineNumber = FormatDescription(QLatin1String(C_CURRENT_LINE_NUMBER), tr("Current Line Number"), Qt::darkGray); + currentLineNumber.format().setBold(true); + formatDescriptions.push_back(currentLineNumber); // Standard categories formatDescriptions.push_back(FormatDescription(QLatin1String(C_NUMBER), tr("Number"), Qt::darkBlue)); -- cgit v1.2.1