From 5472f791965fa9293ed809c8fd3cac5160f38379 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 4 Jan 2023 07:40:42 +0100 Subject: [PATCH] format --- src/git/Patch.cpp | 21 ++++++++++----------- src/git/Patch.h | 2 +- src/ui/DiffView/EditButton.cpp | 4 ++-- src/ui/DiffView/EditButton.h | 2 +- src/ui/DiffView/FileWidget.cpp | 8 ++++---- src/ui/DiffView/FileWidget.h | 8 ++++---- src/ui/DiffView/HunkWidget.cpp | 11 +++++------ src/ui/DiffView/HunkWidget.h | 6 +++--- 8 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/git/Patch.cpp b/src/git/Patch.cpp index a2ac3ef28..4c19bb69d 100644 --- a/src/git/Patch.cpp +++ b/src/git/Patch.cpp @@ -136,13 +136,13 @@ bool Patch::isLfsPointer() const { } Blob Patch::blob(Diff::File file) { - if (file == Diff::File::NewFile) { - if (mNewBlob.isValid()) - return mNewBlob; - } else { - if (mOldBlob.isValid()) - return mOldBlob; - } + if (file == Diff::File::NewFile) { + if (mNewBlob.isValid()) + return mNewBlob; + } else { + if (mOldBlob.isValid()) + return mOldBlob; + } git_repository *repo = git_patch_owner(d.data()); if (!repo) @@ -157,9 +157,9 @@ Blob Patch::blob(Diff::File file) { auto b = Blob(reinterpret_cast(obj)); if (file == Diff::File::NewFile) { - mNewBlob = b; + mNewBlob = b; } else { - mOldBlob = b; + mOldBlob = b; } return b; @@ -351,8 +351,7 @@ QByteArray Patch::generateResult(QList> &image, return filtered; } -QByteArray Patch::apply(const QBitArray &hunks, - const FilterList &filters) { +QByteArray Patch::apply(const QBitArray &hunks, const FilterList &filters) { QList> image; populatePreimage(image); diff --git a/src/git/Patch.h b/src/git/Patch.h index f4433fa21..419610dc6 100644 --- a/src/git/Patch.h +++ b/src/git/Patch.h @@ -124,7 +124,7 @@ class Patch { * \return edited file */ QByteArray apply(const QBitArray &hunks, - const FilterList &filters = FilterList()); + const FilterList &filters = FilterList()); QByteArray apply(int hidx, QByteArray &hunkData, QByteArray fileContent, const FilterList &filters = FilterList()) const; diff --git a/src/ui/DiffView/EditButton.cpp b/src/ui/DiffView/EditButton.cpp index 43cd74bc8..6f89f513a 100644 --- a/src/ui/DiffView/EditButton.cpp +++ b/src/ui/DiffView/EditButton.cpp @@ -3,8 +3,8 @@ #include "ui/RepoView.h" #include -EditButton::EditButton(git::Patch &patch, int index, bool binary, - bool lfs, QWidget *parent) +EditButton::EditButton(git::Patch &patch, int index, bool binary, bool lfs, + QWidget *parent) : Button(parent) { setObjectName("EditButton"); diff --git a/src/ui/DiffView/EditButton.h b/src/ui/DiffView/EditButton.h index ade45bdb3..a73b8123f 100644 --- a/src/ui/DiffView/EditButton.h +++ b/src/ui/DiffView/EditButton.h @@ -10,7 +10,7 @@ class EditButton : public Button { public: EditButton(git::Patch &patch, int index, bool binary, bool lfs, - QWidget *parent = nullptr); + QWidget *parent = nullptr); void updatePatch(git::Patch &patch, int index, bool init = false); diff --git a/src/ui/DiffView/FileWidget.cpp b/src/ui/DiffView/FileWidget.cpp index ea9f8c0c5..033b5eb7b 100644 --- a/src/ui/DiffView/FileWidget.cpp +++ b/src/ui/DiffView/FileWidget.cpp @@ -333,10 +333,10 @@ void _FileWidget::Header::updateCheckState() { //############### FileWidget ########################################### //############################################################################### -FileWidget::FileWidget(DiffView *view, const git::Diff &diff, - git::Patch &patch, const git::Patch &staged, - const QModelIndex modelIndex, const QString &name, - const QString &path, bool submodule, QWidget *parent) +FileWidget::FileWidget(DiffView *view, const git::Diff &diff, git::Patch &patch, + const git::Patch &staged, const QModelIndex modelIndex, + const QString &name, const QString &path, bool submodule, + QWidget *parent) : QWidget(parent), mView(view), mDiff(diff), mPatch(patch), mModelIndex(modelIndex) { auto stageState = static_cast( diff --git a/src/ui/DiffView/FileWidget.h b/src/ui/DiffView/FileWidget.h index 07779acc4..80a545521 100644 --- a/src/ui/DiffView/FileWidget.h +++ b/src/ui/DiffView/FileWidget.h @@ -29,7 +29,7 @@ class Header : public QFrame { public: Header(const git::Diff &diff, git::Patch &patch, bool binary, bool lfs, - bool submodule, QWidget *parent = nullptr); + bool submodule, QWidget *parent = nullptr); void updatePatch(git::Patch &patch); QCheckBox *check() const; @@ -92,7 +92,7 @@ class FileWidget : public QWidget { QWidget *parent = nullptr); bool isEmpty(); void updatePatch(git::Patch &patch, const git::Patch &staged, - const QString &name, const QString &path, bool submodule); + const QString &name, const QString &path, bool submodule); /*! * Update hunks after index change and emits the current stage state of the * hunks \brief updateHunks @@ -106,8 +106,8 @@ class FileWidget : public QWidget { QWidget *addImage(DisclosureButton *button, const git::Patch patch, bool lfs = false); HunkWidget *addHunk(const git::Diff &diff, git::Patch &patch, - const git::Patch &staged, int index, bool lfs, - bool submodule); + const git::Patch &staged, int index, bool lfs, + bool submodule); void setStageState(git::Index::StagedState state); QModelIndex modelIndex(); diff --git a/src/ui/DiffView/HunkWidget.cpp b/src/ui/DiffView/HunkWidget.cpp index b93bf2f50..24afe48ea 100644 --- a/src/ui/DiffView/HunkWidget.cpp +++ b/src/ui/DiffView/HunkWidget.cpp @@ -34,9 +34,8 @@ const QString noNewLineAtEndOfFile = HunkWidget::tr("No newline at end of file"); } // namespace -_HunkWidget::Header::Header(const git::Diff &diff, git::Patch &patch, - int index, bool lfs, bool submodule, - QWidget *parent) +_HunkWidget::Header::Header(const git::Diff &diff, git::Patch &patch, int index, + bool lfs, bool submodule, QWidget *parent) : QFrame(parent) { setObjectName("HunkHeader"); mCheck = new QCheckBox(this); @@ -178,9 +177,9 @@ void _HunkWidget::Header::mouseDoubleClickEvent(QMouseEvent *event) { //########## HunkWidget ############################################### //############################################################################# -HunkWidget::HunkWidget(DiffView *view, const git::Diff &diff, - git::Patch &patch, const git::Patch &staged, - int index, bool lfs, bool submodule, QWidget *parent) +HunkWidget::HunkWidget(DiffView *view, const git::Diff &diff, git::Patch &patch, + const git::Patch &staged, int index, bool lfs, + bool submodule, QWidget *parent) : QFrame(parent), mView(view), mPatch(patch), mStaged(staged), mIndex(index), mLfs(lfs) { setObjectName("HunkWidget"); diff --git a/src/ui/DiffView/HunkWidget.h b/src/ui/DiffView/HunkWidget.h index ab5998a33..ef12e9017 100644 --- a/src/ui/DiffView/HunkWidget.h +++ b/src/ui/DiffView/HunkWidget.h @@ -23,7 +23,7 @@ class Header : public QFrame { Q_OBJECT public: Header(const git::Diff &diff, git::Patch &patch, int index, bool lfs, - bool submodule, QWidget *parent = nullptr); + bool submodule, QWidget *parent = nullptr); QCheckBox *check() const; DisclosureButton *button() const; @@ -62,8 +62,8 @@ class HunkWidget : public QFrame { public: HunkWidget(DiffView *view, const git::Diff &diff, git::Patch &patch, - const git::Patch &staged, int index, bool lfs, bool submodule, - QWidget *parent = nullptr); + const git::Patch &staged, int index, bool lfs, bool submodule, + QWidget *parent = nullptr); _HunkWidget::Header *header() const; TextEditor *editor(bool ensureLoaded = true); void invalidate();