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