forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user