forked from qt-creator/qt-creator
Coding style fixes
This commit is contained in:
@@ -54,7 +54,6 @@ CMakeEditorEditable::CMakeEditorEditable(CMakeEditor *editor)
|
||||
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
||||
m_context << uidm->uniqueIdentifier(CMakeProjectManager::Constants::C_CMAKEEDITOR);
|
||||
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||
// m_contexts << uidm->uniqueIdentifier(Qt4ProjectManager::Constants::PROJECT_KIND);
|
||||
}
|
||||
|
||||
QList<int> CMakeEditorEditable::context() const
|
||||
@@ -103,8 +102,6 @@ TextEditor::BaseTextEditorEditable *CMakeEditor::createEditableInterface()
|
||||
|
||||
void CMakeEditor::setFontSettings(const TextEditor::FontSettings &fs)
|
||||
{
|
||||
// TextEditor::BaseTextEditor::setFontSettings(fs);
|
||||
// return;
|
||||
CMakeHighlighter *highlighter = qobject_cast<CMakeHighlighter*>(baseTextDocument()->syntaxHighlighter());
|
||||
if (!highlighter)
|
||||
return;
|
||||
|
||||
@@ -74,7 +74,6 @@ public:
|
||||
|
||||
bool save(const QString &fileName = QString());
|
||||
|
||||
|
||||
CMakeEditorFactory *factory() { return m_factory; }
|
||||
TextEditor::TextEditorActionHandler *actionHandler() const { return m_ah; }
|
||||
protected:
|
||||
|
||||
@@ -39,10 +39,8 @@ using namespace CMakeProjectManager::Internal;
|
||||
|
||||
static bool isVariable(const QString &word)
|
||||
{
|
||||
if (word.length() < 4) { // must be at least "${.}"
|
||||
if (word.length() < 4) // must be at least "${.}"
|
||||
return false;
|
||||
}
|
||||
|
||||
return word.startsWith("${") && word.endsWith('}');
|
||||
}
|
||||
|
||||
@@ -65,44 +63,34 @@ void CMakeHighlighter::highlightBlock(const QString &text)
|
||||
const QChar c = text.at(i);
|
||||
if (inCommentMode) {
|
||||
setFormat(i, 1, m_formats[CMakeCommentFormat]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (c == '#') {
|
||||
if (!inStringMode) {
|
||||
inCommentMode = true;
|
||||
setFormat(i, 1, m_formats[CMakeCommentFormat]);
|
||||
buf.clear();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
buf += c;
|
||||
}
|
||||
}
|
||||
else if (c == '(') {
|
||||
} else if (c == '(') {
|
||||
if (!inStringMode) {
|
||||
if (!buf.isEmpty()) {
|
||||
if (!buf.isEmpty())
|
||||
setFormat(i - buf.length(), buf.length(), m_formats[CMakeFunctionFormat]);
|
||||
}
|
||||
buf.clear();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
buf += c;
|
||||
}
|
||||
}
|
||||
else if (c.isSpace()) {
|
||||
if (!inStringMode) {
|
||||
} else if (c.isSpace()) {
|
||||
if (!inStringMode)
|
||||
buf.clear();
|
||||
}
|
||||
else {
|
||||
else
|
||||
buf += c;
|
||||
}
|
||||
}
|
||||
else if (c == '\"') {
|
||||
} else if (c == '\"') {
|
||||
buf += c;
|
||||
if (inStringMode) {
|
||||
setFormat(i + 1 - buf.length(), buf.length(), m_formats[CMakeStringFormat]);
|
||||
buf.clear();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setFormat(i, 1, m_formats[CMakeStringFormat]);
|
||||
}
|
||||
inStringMode = !inStringMode;
|
||||
@@ -116,24 +104,19 @@ void CMakeHighlighter::highlightBlock(const QString &text)
|
||||
setFormat(i, 1, emptyFormat);
|
||||
buf += c;
|
||||
}
|
||||
}
|
||||
else if (c == '$') {
|
||||
if (inStringMode) {
|
||||
} else if (c == '$') {
|
||||
if (inStringMode)
|
||||
setFormat(i - buf.length(), buf.length(), m_formats[CMakeStringFormat]);
|
||||
}
|
||||
buf.clear();
|
||||
buf += c;
|
||||
setFormat(i, 1, emptyFormat);
|
||||
}
|
||||
else if (c == '}') {
|
||||
} else if (c == '}') {
|
||||
buf += c;
|
||||
if (isVariable(buf))
|
||||
{
|
||||
if (isVariable(buf)) {
|
||||
setFormat(i + 1 - buf.length(), buf.length(), m_formats[CMakeVariableFormat]);
|
||||
buf.clear();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
buf += c;
|
||||
setFormat(i, 1, emptyFormat);
|
||||
}
|
||||
@@ -143,8 +126,7 @@ void CMakeHighlighter::highlightBlock(const QString &text)
|
||||
if (inStringMode) {
|
||||
setFormat(i - buf.length(), buf.length(), m_formats[CMakeStringFormat]);
|
||||
setCurrentBlockState(1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setCurrentBlockState(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user