Implement Code Style schemes

Task-number: QTCREATORBUG-5092

Change-Id: I218cef02f7c242e4dfae59b1b8021ea618e60d07
Reviewed-on: http://codereview.qt-project.org/5160
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Jarek Kobus
2011-08-16 10:45:23 +02:00
committed by Jarek Kobus
parent 3955df7855
commit 2244911826
92 changed files with 3138 additions and 2125 deletions

View File

@@ -51,7 +51,7 @@ CppQtStyleIndenter::CppQtStyleIndenter()
{
// Just for safety. setCodeStylePreferences should be called when the editor the
// indenter belongs to gets initialized.
m_cppCodeStylePreferences = CppToolsSettings::instance()->cppCodeStylePreferences();
m_cppCodeStylePreferences = CppToolsSettings::instance()->cppCodeStyle();
}
CppQtStyleIndenter::~CppQtStyleIndenter()
@@ -148,7 +148,7 @@ void CppQtStyleIndenter::indent(QTextDocument *doc,
}
}
void CppQtStyleIndenter::setCodeStylePreferences(TextEditor::IFallbackPreferences *preferences)
void CppQtStyleIndenter::setCodeStylePreferences(TextEditor::ICodeStylePreferences *preferences)
{
CppTools::CppCodeStylePreferences *cppCodeStylePreferences
= qobject_cast<CppTools::CppCodeStylePreferences *>(preferences);
@@ -156,9 +156,15 @@ void CppQtStyleIndenter::setCodeStylePreferences(TextEditor::IFallbackPreference
m_cppCodeStylePreferences = cppCodeStylePreferences;
}
void CppQtStyleIndenter::invalidateCache(QTextDocument *doc)
{
CppTools::QtStyleCodeFormatter formatter;
formatter.invalidateCache(doc);
}
CppCodeStyleSettings CppQtStyleIndenter::codeStyleSettings() const
{
if (m_cppCodeStylePreferences)
return m_cppCodeStylePreferences->currentSettings();
return m_cppCodeStylePreferences->currentCodeStyleSettings();
return CppCodeStyleSettings();
}