BinEditor: Modernize

modernize-use-nullptr
modernize-use-override
modernize-use-equals-default
modernize-use-using

Change-Id: I1d1381962b3ffd87cbf761f50d8f073068f9a06f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2018-11-04 20:33:51 +01:00
parent b332fc3182
commit c7c042498b
4 changed files with 29 additions and 29 deletions

View File

@@ -148,7 +148,7 @@ public:
} else {
result = NotFound;
m_contPos = -1;
m_widget->highlightSearchResults(QByteArray(), 0);
m_widget->highlightSearchResults(QByteArray(), nullptr);
}
}
return result;
@@ -313,7 +313,7 @@ public:
void provideNewRange(quint64 offset)
{
if (filePath().exists())
openImpl(0, filePath().toString(), offset);
openImpl(nullptr, filePath().toString(), offset);
}
public:
@@ -404,13 +404,13 @@ private:
}
void jumpToAddress() {
editorWidget()->jumpToAddress(m_addressEdit->text().toULongLong(0, 16));
editorWidget()->jumpToAddress(m_addressEdit->text().toULongLong(nullptr, 16));
updateCursorPosition(editorWidget()->cursorPosition());
}
BinEditorWidget *editorWidget() const
{
QTC_ASSERT(qobject_cast<BinEditorWidget *>(m_widget.data()), return 0);
QTC_ASSERT(qobject_cast<BinEditorWidget *>(m_widget.data()), return nullptr);
return static_cast<BinEditorWidget *>(m_widget.data());
}
@@ -426,7 +426,7 @@ class BinEditorPluginPrivate : public QObject
{
public:
BinEditorPluginPrivate();
~BinEditorPluginPrivate();
~BinEditorPluginPrivate() override;
QAction *m_undoAction = nullptr;
QAction *m_redoAction = nullptr;
@@ -511,7 +511,7 @@ EditorService *FactoryServiceImpl::createEditorService(const QString &title0, bo
IEditor *editor = EditorManager::openEditorWithContents(
Core::Constants::K_DEFAULT_BINARY_EDITOR_ID, &title);
if (!editor)
return 0;
return nullptr;
widget = qobject_cast<BinEditorWidget *>(editor->widget());
widget->setEditor(editor);
} else {

View File

@@ -39,8 +39,8 @@ class BinEditorPlugin : public ExtensionSystem::IPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "BinEditor.json")
public:
BinEditorPlugin() {}
~BinEditorPlugin();
BinEditorPlugin() = default;
~BinEditorPlugin() override;
bool initialize(const QStringList &arguments, QString *errorMessage) final;
void extensionsInitialized() final {}

View File

@@ -40,7 +40,7 @@ namespace BinEditor {
class EditorService
{
public:
virtual ~EditorService() {}
virtual ~EditorService() = default;
virtual QWidget *widget() = 0;
virtual Core::IEditor *editor() = 0;
@@ -70,7 +70,7 @@ public:
class FactoryService
{
public:
virtual ~FactoryService() {}
virtual ~FactoryService() = default;
// Create a BinEditor widget. Embed into a Core::IEditor iff wantsEditor == true.
virtual EditorService *createEditorService(const QString &title, bool wantsEditor) = 0;

View File

@@ -62,8 +62,8 @@ class BinEditorWidget : public QAbstractScrollArea
Q_PROPERTY(bool newWindowRequestAllowed READ newWindowRequestAllowed WRITE setNewWindowRequestAllowed DESIGNABLE false)
public:
BinEditorWidget(QWidget *parent = 0);
~BinEditorWidget();
BinEditorWidget(QWidget *parent = nullptr);
~BinEditorWidget() override;
EditorService *editorService() const;
@@ -98,7 +98,7 @@ public:
bool isReadOnly() const;
int find(const QByteArray &pattern, qint64 from = 0,
QTextDocument::FindFlags findFlags = 0);
QTextDocument::FindFlags findFlags = nullptr);
void selectAll();
void clear();
@@ -112,7 +112,7 @@ public:
int selectionStart() const { return qMin(m_anchorPosition, m_cursorPosition); }
int selectionEnd() const { return qMax(m_anchorPosition, m_cursorPosition); }
bool event(QEvent*);
bool event(QEvent*) override;
bool isUndoAvailable() const { return m_undoStack.size(); }
bool isRedoAvailable() const { return m_redoStack.size(); }
@@ -125,7 +125,7 @@ public:
void setFontSettings(const TextEditor::FontSettings &fs);
void highlightSearchResults(const QByteArray &pattern,
QTextDocument::FindFlags findFlags = 0);
QTextDocument::FindFlags findFlags = nullptr);
void copy(bool raw = false);
void setMarkup(const QList<Markup> &markup);
void setNewWindowRequestAllowed(bool c);
@@ -137,24 +137,24 @@ signals:
void cursorPositionChanged(int position);
private:
void scrollContentsBy(int dx, int dy);
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *);
void changeEvent(QEvent *);
void wheelEvent(QWheelEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
void focusInEvent(QFocusEvent *);
void focusOutEvent(QFocusEvent *);
void timerEvent(QTimerEvent *);
void contextMenuEvent(QContextMenuEvent *event);
void scrollContentsBy(int dx, int dy) override;
void paintEvent(QPaintEvent *e) override;
void resizeEvent(QResizeEvent *) override;
void changeEvent(QEvent *) override;
void wheelEvent(QWheelEvent *e) override;
void mousePressEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
void focusInEvent(QFocusEvent *) override;
void focusOutEvent(QFocusEvent *) override;
void timerEvent(QTimerEvent *) override;
void contextMenuEvent(QContextMenuEvent *event) override;
friend class BinEditorWidgetPrivate;
BinEditorWidgetPrivate *d;
typedef QMap<qint64, QByteArray> BlockMap;
using BlockMap = QMap<qint64, QByteArray>;
BlockMap m_data;
BlockMap m_oldData;
int m_blockSize;