forked from qt-creator/qt-creator
DiffEditor: fix various warnings
Change-Id: I555aa30c8925ba8eeb314dd836f1544b93d7a66f Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -76,8 +76,8 @@ class DescriptionEditorWidget : public TextEditorWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DescriptionEditorWidget(QWidget *parent = 0);
|
||||
~DescriptionEditorWidget();
|
||||
DescriptionEditorWidget(QWidget *parent = nullptr);
|
||||
~DescriptionEditorWidget() override;
|
||||
|
||||
virtual QSize sizeHint() const override;
|
||||
|
||||
@@ -281,7 +281,7 @@ Core::IDocument *DiffEditor::document()
|
||||
|
||||
QWidget *DiffEditor::toolBar()
|
||||
{
|
||||
QTC_ASSERT(m_toolBar, return 0);
|
||||
QTC_ASSERT(m_toolBar, return nullptr);
|
||||
return m_toolBar;
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ void DiffEditor::toggleSync()
|
||||
|
||||
IDiffView *DiffEditor::loadSettings()
|
||||
{
|
||||
QTC_ASSERT(currentView(), return 0);
|
||||
QTC_ASSERT(currentView(), return nullptr);
|
||||
QSettings *s = Core::ICore::settings();
|
||||
|
||||
// Read current settings:
|
||||
@@ -563,7 +563,7 @@ void DiffEditor::addView(IDiffView *view)
|
||||
IDiffView *DiffEditor::currentView() const
|
||||
{
|
||||
if (m_currentViewIndex < 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
return m_views.at(m_currentViewIndex);
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ void DiffEditor::showDiffView(IDiffView *view)
|
||||
return;
|
||||
|
||||
if (currentView()) // during initialization
|
||||
currentView()->setDocument(0);
|
||||
currentView()->setDocument(nullptr);
|
||||
|
||||
QTC_ASSERT(view, return);
|
||||
setupView(view);
|
||||
|
@@ -78,13 +78,13 @@ Core::IDocument *DiffEditorController::findOrCreateDocument(const QString &vcsId
|
||||
QString preferredDisplayName = displayName;
|
||||
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
||||
Constants::DIFF_EDITOR_ID, &preferredDisplayName, QByteArray(), vcsId);
|
||||
return editor ? editor->document() : 0;
|
||||
return editor ? editor->document() : nullptr;
|
||||
}
|
||||
|
||||
DiffEditorController *DiffEditorController::controller(Core::IDocument *document)
|
||||
{
|
||||
auto doc = qobject_cast<Internal::DiffEditorDocument *>(document);
|
||||
return doc ? doc->controller() : 0;
|
||||
return doc ? doc->controller() : nullptr;
|
||||
}
|
||||
|
||||
void DiffEditorController::setDiffFiles(const QList<FileData> &diffFileList,
|
||||
|
@@ -210,7 +210,7 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
setController(0);
|
||||
setController(nullptr);
|
||||
setDescription(QString());
|
||||
Core::EditorManager::clearUniqueId(this);
|
||||
|
||||
|
@@ -71,8 +71,8 @@ class DiffFile
|
||||
{
|
||||
public:
|
||||
DiffFile(bool ignoreWhitespace, int contextLineCount)
|
||||
: m_ignoreWhitespace(ignoreWhitespace),
|
||||
m_contextLineCount(contextLineCount)
|
||||
: m_contextLineCount(contextLineCount),
|
||||
m_ignoreWhitespace(ignoreWhitespace)
|
||||
{}
|
||||
|
||||
void operator()(QFutureInterface<FileData> &futureInterface,
|
||||
@@ -110,8 +110,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
const bool m_ignoreWhitespace;
|
||||
const int m_contextLineCount;
|
||||
const bool m_ignoreWhitespace;
|
||||
};
|
||||
|
||||
class DiffFilesController : public DiffEditorController
|
||||
|
@@ -54,7 +54,7 @@ class DiffEditorPlugin : public ExtensionSystem::IPlugin
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "DiffEditor.json")
|
||||
|
||||
public:
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage = 0);
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage = nullptr);
|
||||
void extensionsInitialized();
|
||||
|
||||
private:
|
||||
|
@@ -64,9 +64,8 @@ public:
|
||||
Invalid
|
||||
};
|
||||
TextLineData() {}
|
||||
TextLineData(const QString &txt) : textLineType(TextLine), text(txt) {}
|
||||
TextLineData(const QString &txt) : text(txt), textLineType(TextLine) {}
|
||||
TextLineData(TextLineType t) : textLineType(t) {}
|
||||
TextLineType textLineType = Invalid;
|
||||
QString text;
|
||||
/*
|
||||
* <start position, end position>
|
||||
@@ -75,6 +74,7 @@ public:
|
||||
* <-1, -1> the whole line is a continuation (from the previous line to the next line)
|
||||
*/
|
||||
QMap<int, int> changedPositions; // counting from the beginning of the line
|
||||
TextLineType textLineType = Invalid;
|
||||
};
|
||||
|
||||
class DIFFEDITOR_EXPORT RowData {
|
||||
@@ -93,10 +93,10 @@ class DIFFEDITOR_EXPORT ChunkData {
|
||||
public:
|
||||
ChunkData() {}
|
||||
QList<RowData> rows;
|
||||
bool contextChunk = false;
|
||||
QString contextInfo;
|
||||
int leftStartingLineNumber = 0;
|
||||
int rightStartingLineNumber = 0;
|
||||
QString contextInfo;
|
||||
bool contextChunk = false;
|
||||
};
|
||||
|
||||
class DIFFEDITOR_EXPORT FileData {
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
static QString makePatch(const QList<FileData> &fileDataList,
|
||||
unsigned formatFlags = 0);
|
||||
static QList<FileData> readPatch(const QString &patch,
|
||||
bool *ok = 0,
|
||||
bool *ok = nullptr,
|
||||
QFutureInterfaceBase *jobController = nullptr);
|
||||
};
|
||||
|
||||
|
@@ -167,7 +167,8 @@ void UnifiedView::setSync(bool sync)
|
||||
Q_UNUSED(sync);
|
||||
}
|
||||
|
||||
SideBySideView::SideBySideView() : m_widget(0)
|
||||
SideBySideView::SideBySideView()
|
||||
: m_widget(nullptr)
|
||||
{
|
||||
setId(Constants::SIDE_BY_SIDE_VIEW_ID);
|
||||
setIcon(Icons::SIDEBYSIDE_DIFF.icon());
|
||||
|
@@ -136,7 +136,6 @@ private:
|
||||
|
||||
// block number, visual line number.
|
||||
QMap<int, int> m_lineNumbers;
|
||||
int m_lineNumberDigits = 1;
|
||||
// block number, fileInfo. Set for file lines only.
|
||||
QMap<int, DiffFileInfo> m_fileInfo;
|
||||
// block number, skipped lines and context info. Set for chunk lines only.
|
||||
@@ -153,7 +152,7 @@ private:
|
||||
QTextBlock m_drawCollapsedBlock;
|
||||
QPointF m_drawCollapsedOffset;
|
||||
QRect m_drawCollapsedClip;
|
||||
|
||||
int m_lineNumberDigits = 1;
|
||||
};
|
||||
|
||||
SideDiffEditorWidget::SideDiffEditorWidget(QWidget *parent)
|
||||
@@ -476,7 +475,7 @@ void SideDiffEditorWidget::jumpToOriginalFile(const QTextCursor &cursor)
|
||||
static QString skippedText(int skippedNumber)
|
||||
{
|
||||
if (skippedNumber > 0)
|
||||
return SideBySideDiffEditorWidget::tr("Skipped %n lines...", 0, skippedNumber);
|
||||
return SideBySideDiffEditorWidget::tr("Skipped %n lines...", nullptr, skippedNumber);
|
||||
if (skippedNumber == -2)
|
||||
return SideBySideDiffEditorWidget::tr("Binary files differ");
|
||||
return SideBySideDiffEditorWidget::tr("Skipped unknown number of lines...");
|
||||
|
@@ -49,7 +49,7 @@ class UnifiedDiffEditorWidget : public SelectableTextEditorWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
UnifiedDiffEditorWidget(QWidget *parent = nullptr);
|
||||
~UnifiedDiffEditorWidget();
|
||||
~UnifiedDiffEditorWidget() override;
|
||||
|
||||
void setDocument(DiffEditorDocument *document);
|
||||
DiffEditorDocument *diffDocument() const;
|
||||
|
Reference in New Issue
Block a user