From 3ceec865774f25891caf66d5f427a95e450c72ec Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 27 May 2015 14:32:44 +0200 Subject: [PATCH] Editor: Add Check for TextMark color definition. Change-Id: I805402a5ec9595bd31b6d72c5934198c77a1f402 Reviewed-by: Orgad Shaneh Reviewed-by: Eike Ziller --- src/plugins/texteditor/textmark.cpp | 10 ++++++++++ src/plugins/texteditor/textmark.h | 1 + src/plugins/texteditor/textmarkregistry.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp index 748f95eb22d..7525c1a9908 100644 --- a/src/plugins/texteditor/textmark.cpp +++ b/src/plugins/texteditor/textmark.cpp @@ -122,6 +122,11 @@ Theme::Color TextMark::categoryColor(Id category) return TextEditorPlugin::baseTextMarkRegistry()->categoryColor(category); } +bool TextMark::categoryHasColor(Id category) +{ + return TextEditorPlugin::baseTextMarkRegistry()->categoryHasColor(category); +} + void TextMark::setCategoryColor(Id category, Theme::Color color) { TextEditorPlugin::baseTextMarkRegistry()->setCategoryColor(category, color); @@ -230,6 +235,11 @@ Theme::Color TextMarkRegistry::categoryColor(Id category) return m_colors.value(category, Theme::ProjectExplorer_TaskWarn_TextMarkColor); } +bool TextMarkRegistry::categoryHasColor(Id category) +{ + return m_colors.contains(category); +} + void TextMarkRegistry::setCategoryColor(Id category, Theme::Color color) { if (m_colors[category] == color) diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h index e91ba41da34..0d68ae3232b 100644 --- a/src/plugins/texteditor/textmark.h +++ b/src/plugins/texteditor/textmark.h @@ -81,6 +81,7 @@ public: virtual void dragToLine(int lineNumber); static Utils::Theme::Color categoryColor(Core::Id category); + static bool categoryHasColor(Core::Id category); static void setCategoryColor(Core::Id category, Utils::Theme::Color color); void setIcon(const QIcon &icon); // call this if the icon has changed. diff --git a/src/plugins/texteditor/textmarkregistry.h b/src/plugins/texteditor/textmarkregistry.h index 8231aab051b..e68b548793b 100644 --- a/src/plugins/texteditor/textmarkregistry.h +++ b/src/plugins/texteditor/textmarkregistry.h @@ -59,6 +59,7 @@ public: void add(TextMark *mark); bool remove(TextMark *mark); Utils::Theme::Color categoryColor(Core::Id category); + bool categoryHasColor(Core::Id category); void setCategoryColor(Core::Id category, Utils::Theme::Color color); private slots: void editorOpened(Core::IEditor *editor);