From 2fcf2ac5d34f493f82064751c2f51bedfceef76d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com>
Date: Tue, 14 Jul 2009 15:25:30 +0200
Subject: [PATCH] Added a FakeVim color theme

Specially for FakeVim users out there who want an easy way to switch to
vim's default color theme on a dark brackground.

Also did a little cleanup.
---
 share/qtcreator/styles/fakevim.xml           | 32 ++++++++++++++++++++
 share/qtcreator/styles/grayscale.xml         |  2 ++
 src/plugins/qt4projectmanager/qt4project.cpp |  2 +-
 src/plugins/texteditor/colorscheme.cpp       | 25 ++-------------
 4 files changed, 37 insertions(+), 24 deletions(-)
 create mode 100644 share/qtcreator/styles/fakevim.xml

diff --git a/share/qtcreator/styles/fakevim.xml b/share/qtcreator/styles/fakevim.xml
new file mode 100644
index 00000000000..609d5357c26
--- /dev/null
+++ b/share/qtcreator/styles/fakevim.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<style-scheme version="1.0" name="FakeVim (dark)">
+  <!--
+  Based on the default vim theme for a dark background, Linux console colors.
+  -->
+  <style name="AddedLine" foreground="#55ffff"/>
+  <style name="RemovedLine" foreground="#ff5555"/>
+  <style name="Comment" foreground="#55ffff"/>
+  <style name="CurrentLine" background="#232323"/>
+  <style name="CurrentLineNumber" foreground="#aaaaaa" bold="true"/>
+  <style name="DiffFile" foreground="#55ff55"/>
+  <style name="DiffLocation" foreground="#ffff55"/>
+  <style name="DisabledCode" foreground="#777777"/>
+  <style name="Doxygen.Comment" foreground="#55ffff"/>
+  <style name="Doxygen.Tag" foreground="#00a0a0"/>
+  <style name="Keyword" foreground="#ffff55"/>
+  <style name="Label" foreground="#ffff55"/>
+  <style name="LineNumber" foreground="#888888" background="#232323"/>
+  <style name="Link" foreground="#0055ff"/>
+  <style name="Number" foreground="#ff55ff"/>
+  <style name="Occurrences" background="#363636"/>
+  <style name="Occurrences.Rename" foreground="#ffaaaa" background="#553636"/>
+  <style name="Operator" foreground="#aaaaaa"/>
+  <style name="Parentheses" foreground="#ff5555" background="#333333"/>
+  <style name="Preprocessor" foreground="#5555ff"/>
+  <style name="SearchResult" background="#555500"/>
+  <style name="SearchScope" background="#222200"/>
+  <style name="Selection" foreground="#000000" background="#aaaaaa"/>
+  <style name="String" foreground="#ff55ff"/>
+  <style name="Text" foreground="#aaaaaa" background="#000000"/>
+  <style name="Type" foreground="#55ff55"/>
+</style-scheme>
diff --git a/share/qtcreator/styles/grayscale.xml b/share/qtcreator/styles/grayscale.xml
index d575410876f..75d92688ece 100644
--- a/share/qtcreator/styles/grayscale.xml
+++ b/share/qtcreator/styles/grayscale.xml
@@ -28,6 +28,8 @@
   SearchResult
   SearchScope
   Selection
+  Occurrences
+  Occurrences.Rename
 
   -->
 </style-scheme>
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index a3ff28a7604..79b68a71a53 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -223,7 +223,7 @@ void Qt4ProjectFile::modified(Core::IFile::ReloadBehavior *)
 }
 
 /*!
-  /class Qt4Project
+  \class Qt4Project
 
   Qt4Project manages information about an individual Qt 4 (.pro) project file.
   */
diff --git a/src/plugins/texteditor/colorscheme.cpp b/src/plugins/texteditor/colorscheme.cpp
index b131337c2fa..7a80f9b6ad1 100644
--- a/src/plugins/texteditor/colorscheme.cpp
+++ b/src/plugins/texteditor/colorscheme.cpp
@@ -37,7 +37,6 @@
 using namespace TextEditor;
 
 static const char *trueString = "true";
-static const char *falseString = "false";
 
 // Format
 
@@ -69,13 +68,6 @@ void Format::setItalic(bool italic)
     m_italic = italic;
 }
 
-static QString colorToString(const QColor &color)
-{
-    if (color.isValid())
-        return color.name();
-    return QLatin1String("invalid");
-}
-
 static QColor stringToColor(const QString &string)
 {
     if (string == QLatin1String("invalid"))
@@ -89,19 +81,6 @@ bool Format::equals(const Format &f) const
            m_bold == f.m_bold && m_italic == f.m_italic;
 }
 
-QString Format::toString() const
-{
-    const QChar delimiter = QLatin1Char(';');
-    QString s =  colorToString(m_foreground);
-    s += delimiter;
-    s += colorToString(m_background);
-    s += delimiter;
-    s += m_bold   ? QLatin1String(trueString) : QLatin1String(falseString);
-    s += delimiter;
-    s += m_italic ? QLatin1String(trueString) : QLatin1String(falseString);
-    return s;
-}
-
 bool Format::fromString(const QString &str)
 {
     *this = Format();
@@ -287,8 +266,8 @@ void ColorSchemeReader::readStyle()
     bool italic = attr.value(QLatin1String("italic")) == QLatin1String(trueString);
 
     Format format;
-    format.setForeground(stringToColor(foreground));
-    format.setBackground(stringToColor(background));
+    format.setForeground(QColor(foreground));
+    format.setBackground(QColor(background));
     format.setBold(bold);
     format.setItalic(italic);
 
-- 
GitLab