forked from qt-creator/qt-creator
Beautifier: Fix code style
Change-Id: I991f47d2f6844b153cd47ac856e5a76a7a962c94 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -79,7 +79,7 @@ bool ArtisticStyle::initialize()
|
||||
Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu);
|
||||
|
||||
connect(m_settings, &ArtisticStyleSettings::supportedMimeTypesChanged,
|
||||
[this](){updateActions(Core::EditorManager::instance()->currentEditor());});
|
||||
[this] { updateActions(Core::EditorManager::currentEditor()); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ void ArtisticStyleOptionsPageWidget::apply()
|
||||
m_settings->save();
|
||||
|
||||
// update since not all MIME types are accepted (invalids or duplicates)
|
||||
ui->mime->setText(m_settings->supportedMimeTypesAsString());
|
||||
ui->mime->setText(m_settings->supportedMimeTypesAsString());
|
||||
}
|
||||
|
||||
ArtisticStyleOptionsPage::ArtisticStyleOptionsPage(ArtisticStyleSettings *settings, QObject *parent) :
|
||||
|
||||
@@ -314,7 +314,7 @@ void BeautifierPlugin::formatEditorAsync(TextEditorWidget *editor, const Command
|
||||
QFutureWatcher<FormatTask> *watcher = new QFutureWatcher<FormatTask>;
|
||||
const TextDocument *doc = editor->textDocument();
|
||||
connect(doc, &TextDocument::contentsChanged, watcher, &QFutureWatcher<FormatTask>::cancel);
|
||||
connect(watcher, &QFutureWatcherBase::finished, [this, watcher]() {
|
||||
connect(watcher, &QFutureWatcherBase::finished, [this, watcher] {
|
||||
if (watcher->isCanceled())
|
||||
showError(tr("File was modified."));
|
||||
else
|
||||
|
||||
@@ -91,14 +91,14 @@ bool ClangFormat::initialize()
|
||||
Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu);
|
||||
|
||||
connect(m_settings, &ClangFormatSettings::supportedMimeTypesChanged,
|
||||
[this](){updateActions(Core::EditorManager::instance()->currentEditor());});
|
||||
[this] { updateActions(Core::EditorManager::currentEditor()); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ClangFormat::updateActions(Core::IEditor *editor)
|
||||
{
|
||||
const bool enabled = (editor && m_settings->isApplicable(editor->document()));
|
||||
const bool enabled = editor && m_settings->isApplicable(editor->document());
|
||||
m_formatFile->setEnabled(enabled);
|
||||
m_formatRange->setEnabled(enabled);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ void ClangFormatOptionsPageWidget::apply()
|
||||
m_settings->save();
|
||||
|
||||
// update since not all MIME types are accepted (invalids or duplicates)
|
||||
ui->mime->setText(m_settings->supportedMimeTypesAsString());
|
||||
ui->mime->setText(m_settings->supportedMimeTypesAsString());
|
||||
}
|
||||
|
||||
ClangFormatOptionsPage::ClangFormatOptionsPage(ClangFormatSettings *settings, QObject *parent) :
|
||||
|
||||
@@ -164,7 +164,7 @@ void ConfigurationEditor::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
const bool isShortcut = ((event->modifiers() & Qt::ControlModifier) && key == Qt::Key_Space);
|
||||
const bool isShortcut = (event->modifiers() & Qt::ControlModifier) && key == Qt::Key_Space;
|
||||
if (!isShortcut)
|
||||
QPlainTextEdit::keyPressEvent(event);
|
||||
|
||||
@@ -216,12 +216,12 @@ QTextCursor ConfigurationEditor::cursorForTextUnderCursor(QTextCursor tc) const
|
||||
|
||||
void ConfigurationEditor::insertCompleterText(const QString &text)
|
||||
{
|
||||
QTextCursor tc = textCursor();
|
||||
// Replace entire word to get case sensitivity right.
|
||||
tc.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor,
|
||||
m_completer->completionPrefix().length());
|
||||
tc.insertText(text);
|
||||
setTextCursor(tc);
|
||||
QTextCursor tc = textCursor();
|
||||
// Replace entire word to get case sensitivity right.
|
||||
tc.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor,
|
||||
m_completer->completionPrefix().length());
|
||||
tc.insertText(text);
|
||||
setTextCursor(tc);
|
||||
}
|
||||
|
||||
void ConfigurationEditor::updateDocumentation()
|
||||
|
||||
@@ -118,8 +118,8 @@ void ConfigurationPanel::populateConfigurations(const QString &key)
|
||||
|
||||
void ConfigurationPanel::updateButtons()
|
||||
{
|
||||
const bool enabled = ((ui->configurations->count() > 0)
|
||||
&& !m_settings->styleIsReadOnly(ui->configurations->currentText()));
|
||||
const bool enabled = (ui->configurations->count() > 0)
|
||||
&& !m_settings->styleIsReadOnly(ui->configurations->currentText());
|
||||
ui->remove->setEnabled(enabled);
|
||||
ui->edit->setEnabled(enabled);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void GeneralOptionsPageWidget::restore()
|
||||
void GeneralOptionsPageWidget::apply(bool *autoFormatChanged)
|
||||
{
|
||||
if (autoFormatChanged)
|
||||
*autoFormatChanged = (m_settings->autoFormatOnSave() != ui->autoFormat->isChecked());
|
||||
*autoFormatChanged = m_settings->autoFormatOnSave() != ui->autoFormat->isChecked();
|
||||
|
||||
m_settings->setAutoFormatOnSave(ui->autoFormat->isChecked());
|
||||
m_settings->setAutoFormatTool(ui->autoFormatTool->currentText());
|
||||
|
||||
@@ -87,7 +87,7 @@ bool Uncrustify::initialize()
|
||||
Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu);
|
||||
|
||||
connect(m_settings, &UncrustifySettings::supportedMimeTypesChanged,
|
||||
[this](){updateActions(Core::EditorManager::instance()->currentEditor());});
|
||||
[this] { updateActions(Core::EditorManager::currentEditor()); });
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ QString Uncrustify::id() const
|
||||
|
||||
void Uncrustify::updateActions(Core::IEditor *editor)
|
||||
{
|
||||
const bool enabled = (editor && m_settings->isApplicable(editor->document()));
|
||||
const bool enabled = editor && m_settings->isApplicable(editor->document());
|
||||
m_formatFile->setEnabled(enabled);
|
||||
m_formatRange->setEnabled(enabled);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void UncrustifyOptionsPageWidget::apply()
|
||||
m_settings->setFormatEntireFileFallback(ui->formatEntireFileFallback->isChecked());
|
||||
m_settings->save();
|
||||
|
||||
// update since not all MIME types are accepted (invalids or duplicates)
|
||||
// update since not all MIME types are accepted (invalids or duplicates)
|
||||
ui->mime->setText(m_settings->supportedMimeTypesAsString());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user