forked from qt-creator/qt-creator
EmacsKeys: Modernize
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-equals-default Change-Id: Icdd470c27bfaef1ff4d8af20103c8d2a22043bbe Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -58,13 +58,9 @@ namespace Internal {
|
||||
// EmacsKeysPlugin
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
EmacsKeysPlugin::EmacsKeysPlugin(): m_currentEditorWidget(0)
|
||||
{
|
||||
}
|
||||
EmacsKeysPlugin::EmacsKeysPlugin() = default;
|
||||
|
||||
EmacsKeysPlugin::~EmacsKeysPlugin()
|
||||
{
|
||||
}
|
||||
EmacsKeysPlugin::~EmacsKeysPlugin() = default;
|
||||
|
||||
bool EmacsKeysPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
{
|
||||
@@ -141,7 +137,7 @@ ExtensionSystem::IPlugin::ShutdownFlag EmacsKeysPlugin::aboutToShutdown()
|
||||
|
||||
void EmacsKeysPlugin::editorAboutToClose(IEditor *editor)
|
||||
{
|
||||
QPlainTextEdit *w = qobject_cast<QPlainTextEdit*>(editor->widget());
|
||||
auto w = qobject_cast<QPlainTextEdit*>(editor->widget());
|
||||
if (!w)
|
||||
return;
|
||||
|
||||
@@ -154,7 +150,7 @@ void EmacsKeysPlugin::editorAboutToClose(IEditor *editor)
|
||||
void EmacsKeysPlugin::currentEditorChanged(IEditor *editor)
|
||||
{
|
||||
if (!editor) {
|
||||
m_currentEditorWidget = 0;
|
||||
m_currentEditorWidget = nullptr;
|
||||
return;
|
||||
}
|
||||
m_currentEditorWidget = qobject_cast<QPlainTextEdit*>(editor->widget());
|
||||
@@ -314,7 +310,7 @@ void EmacsKeysPlugin::insertLineAndIndent()
|
||||
QTextCursor cursor = m_currentEditorWidget->textCursor();
|
||||
cursor.beginEditBlock();
|
||||
cursor.insertBlock();
|
||||
if (m_currentBaseTextEditorWidget != 0)
|
||||
if (m_currentBaseTextEditorWidget)
|
||||
m_currentBaseTextEditorWidget->textDocument()->autoIndent(cursor);
|
||||
cursor.endEditBlock();
|
||||
m_currentEditorWidget->setTextCursor(cursor);
|
||||
@@ -324,7 +320,7 @@ void EmacsKeysPlugin::insertLineAndIndent()
|
||||
QAction *EmacsKeysPlugin::registerAction(Id id, void (EmacsKeysPlugin::*callback)(),
|
||||
const QString &title)
|
||||
{
|
||||
QAction *result = new QAction(title, this);
|
||||
auto result = new QAction(title, this);
|
||||
ActionManager::registerAction(result, id, Context(Core::Constants::C_GLOBAL), true);
|
||||
connect(result, &QAction::triggered, this, callback);
|
||||
return result;
|
||||
@@ -339,7 +335,7 @@ void EmacsKeysPlugin::genericGoto(QTextCursor::MoveOperation op, bool abortAssis
|
||||
cursor.movePosition(op, m_currentState->mark() != -1 ?
|
||||
QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
|
||||
m_currentEditorWidget->setTextCursor(cursor);
|
||||
if (abortAssist && m_currentBaseTextEditorWidget != 0)
|
||||
if (abortAssist && m_currentBaseTextEditorWidget)
|
||||
m_currentBaseTextEditorWidget->abortAssist();
|
||||
m_currentState->endOwnAction(KeysActionOther);
|
||||
}
|
||||
|
||||
@@ -52,11 +52,11 @@ class EmacsKeysPlugin : public ExtensionSystem::IPlugin
|
||||
|
||||
public:
|
||||
EmacsKeysPlugin();
|
||||
~EmacsKeysPlugin();
|
||||
~EmacsKeysPlugin() override;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorString);
|
||||
void extensionsInitialized();
|
||||
ShutdownFlag aboutToShutdown();
|
||||
bool initialize(const QStringList &arguments, QString *errorString) override;
|
||||
void extensionsInitialized() override;
|
||||
ShutdownFlag aboutToShutdown() override;
|
||||
|
||||
private:
|
||||
void editorAboutToClose(Core::IEditor *editor);
|
||||
@@ -93,9 +93,9 @@ private:
|
||||
void genericVScroll(int direction);
|
||||
|
||||
QHash<QPlainTextEdit*, EmacsKeysState*> m_stateMap;
|
||||
QPlainTextEdit *m_currentEditorWidget;
|
||||
EmacsKeysState *m_currentState;
|
||||
TextEditor::TextEditorWidget *m_currentBaseTextEditorWidget;
|
||||
QPlainTextEdit *m_currentEditorWidget = nullptr;
|
||||
EmacsKeysState *m_currentState = nullptr;
|
||||
TextEditor::TextEditorWidget *m_currentBaseTextEditorWidget = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -48,7 +48,7 @@ EmacsKeysState::EmacsKeysState(QPlainTextEdit *edit):
|
||||
this, &EmacsKeysState::selectionChanged);
|
||||
}
|
||||
|
||||
EmacsKeysState::~EmacsKeysState() {}
|
||||
EmacsKeysState::~EmacsKeysState() = default;
|
||||
|
||||
void EmacsKeysState::setLastAction(EmacsKeysAction action)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ class EmacsKeysState : public QObject
|
||||
{
|
||||
public:
|
||||
EmacsKeysState(QPlainTextEdit *edit);
|
||||
~EmacsKeysState();
|
||||
~EmacsKeysState() override;
|
||||
void setLastAction(EmacsKeysAction action);
|
||||
void beginOwnAction() { m_ignore3rdParty = true; }
|
||||
void endOwnAction(EmacsKeysAction action) {
|
||||
|
||||
Reference in New Issue
Block a user