From 5ebd59d12b3211376cec2055be48233c34725c48 Mon Sep 17 00:00:00 2001
From: jkobus <jaroslaw.kobus@digia.com>
Date: Mon, 7 Jul 2014 10:23:11 +0200
Subject: [PATCH] Rename some methods and variables in DiffEditor

Change-Id: Ic6db2882c9468b9451a785e4657e4255b40fca4c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
---
 .../diffeditor/diffeditorcontroller.cpp       |  4 +-
 src/plugins/diffeditor/diffeditordocument.cpp | 12 ++---
 src/plugins/diffeditor/diffeditordocument.h   |  2 +-
 src/plugins/diffeditor/diffeditorplugin.cpp   |  6 +--
 src/plugins/diffeditor/diffeditorreloader.cpp |  4 +-
 src/plugins/diffeditor/diffeditorreloader.h   |  4 +-
 src/plugins/git/gitclient.cpp                 | 54 +++++++++----------
 src/plugins/git/gitclient.h                   |  2 +-
 8 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/src/plugins/diffeditor/diffeditorcontroller.cpp b/src/plugins/diffeditor/diffeditorcontroller.cpp
index f1ee5fe1fcd..7ff6a983481 100644
--- a/src/plugins/diffeditor/diffeditorcontroller.cpp
+++ b/src/plugins/diffeditor/diffeditorcontroller.cpp
@@ -137,12 +137,12 @@ void DiffEditorController::setReloader(DiffEditorReloader *reloader)
         return; // nothing changes
 
     if (m_reloader)
-        m_reloader->setDiffEditorController(0);
+        m_reloader->setController(0);
 
     m_reloader = reloader;
 
     if (m_reloader)
-        m_reloader->setDiffEditorController(this);
+        m_reloader->setController(this);
 
     reloaderChanged(m_reloader);
 }
diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp
index e36fcd6a8ea..817f0d946cb 100644
--- a/src/plugins/diffeditor/diffeditordocument.cpp
+++ b/src/plugins/diffeditor/diffeditordocument.cpp
@@ -43,7 +43,7 @@ namespace DiffEditor {
 
 DiffEditorDocument::DiffEditorDocument() :
     Core::TextDocument(),
-    m_diffEditorController(new DiffEditorController(this))
+    m_controller(new DiffEditorController(this))
 {
     setId(Constants::DIFF_EDITOR_ID);
     setTemporary(true);
@@ -55,7 +55,7 @@ DiffEditorDocument::~DiffEditorDocument()
 
 DiffEditorController *DiffEditorDocument::controller() const
 {
-    return m_diffEditorController;
+    return m_controller;
 }
 
 bool DiffEditorDocument::setContents(const QByteArray &contents)
@@ -66,10 +66,10 @@ bool DiffEditorDocument::setContents(const QByteArray &contents)
 
 QString DiffEditorDocument::defaultPath() const
 {
-    if (!m_diffEditorController)
+    if (!m_controller)
         return QString();
 
-    return m_diffEditorController->workingDirectory();
+    return m_controller->workingDirectory();
 }
 
 bool DiffEditorDocument::save(QString *errorString, const QString &fileName, bool autoSave)
@@ -77,10 +77,10 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
     Q_UNUSED(errorString)
     Q_UNUSED(autoSave)
 
-    if (!m_diffEditorController)
+    if (!m_controller)
         return false;
 
-    const QString contents = DiffUtils::makePatch(m_diffEditorController->diffFiles());
+    const QString contents = DiffUtils::makePatch(m_controller->diffFiles());
 
     const bool ok = write(fileName, format(), contents, errorString);
 
diff --git a/src/plugins/diffeditor/diffeditordocument.h b/src/plugins/diffeditor/diffeditordocument.h
index 022bfad6075..6785a71553f 100644
--- a/src/plugins/diffeditor/diffeditordocument.h
+++ b/src/plugins/diffeditor/diffeditordocument.h
@@ -58,7 +58,7 @@ public:
     bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
 
 private:
-    DiffEditorController *m_diffEditorController;
+    DiffEditorController *m_controller;
 };
 
 } // namespace DiffEditor
diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp
index 1f3dd57f2ac..20ff559d28a 100644
--- a/src/plugins/diffeditor/diffeditorplugin.cpp
+++ b/src/plugins/diffeditor/diffeditorplugin.cpp
@@ -108,7 +108,7 @@ void SimpleDiffEditorReloader::reload()
     QList<Diff> outputLeftDiffList;
     QList<Diff> outputRightDiffList;
 
-    if (diffEditorController()->isIgnoreWhitespace()) {
+    if (controller()->isIgnoreWhitespace()) {
         const QList<Diff> leftIntermediate =
                 Differ::moveWhitespaceIntoEqualities(leftDiffList);
         const QList<Diff> rightIntermediate =
@@ -125,14 +125,14 @@ void SimpleDiffEditorReloader::reload()
     const ChunkData chunkData = DiffUtils::calculateOriginalData(
                 outputLeftDiffList, outputRightDiffList);
     FileData fileData = DiffUtils::calculateContextData(
-                chunkData, diffEditorController()->contextLinesNumber(), 0);
+                chunkData, controller()->contextLinesNumber(), 0);
     fileData.leftFileInfo.fileName = m_leftFileName;
     fileData.rightFileInfo.fileName = m_rightFileName;
 
     QList<FileData> fileDataList;
     fileDataList << fileData;
 
-    diffEditorController()->setDiffFiles(fileDataList);
+    controller()->setDiffFiles(fileDataList);
 
     reloadFinished();
 }
diff --git a/src/plugins/diffeditor/diffeditorreloader.cpp b/src/plugins/diffeditor/diffeditorreloader.cpp
index 8352caf7745..911b736febb 100644
--- a/src/plugins/diffeditor/diffeditorreloader.cpp
+++ b/src/plugins/diffeditor/diffeditorreloader.cpp
@@ -44,12 +44,12 @@ DiffEditorReloader::~DiffEditorReloader()
 
 }
 
-DiffEditorController *DiffEditorReloader::diffEditorController() const
+DiffEditorController *DiffEditorReloader::controller() const
 {
     return m_controller;
 }
 
-void DiffEditorReloader::setDiffEditorController(DiffEditorController *controller)
+void DiffEditorReloader::setController(DiffEditorController *controller)
 {
     if (m_controller == controller)
         return; // nothing changes
diff --git a/src/plugins/diffeditor/diffeditorreloader.h b/src/plugins/diffeditor/diffeditorreloader.h
index 5a93eaaf40c..e1b6408e56a 100644
--- a/src/plugins/diffeditor/diffeditorreloader.h
+++ b/src/plugins/diffeditor/diffeditorreloader.h
@@ -55,8 +55,8 @@ protected:
     // inside reload() (for synchronous reload)
     // or later (for asynchronous reload)
     virtual void reload() = 0;
-    DiffEditorController *diffEditorController() const;
-    void setDiffEditorController(DiffEditorController *diffEditorController);
+    DiffEditorController *controller() const;
+    void setController(DiffEditorController *controller);
 
 protected slots:
     void reloadFinished();
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 7227afe449a..da79d36bd7c 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -104,7 +104,7 @@ class GitDiffHandler : public QObject
     Q_OBJECT
 
 public:
-    GitDiffHandler(DiffEditor::DiffEditorController *editorController,
+    GitDiffHandler(DiffEditor::DiffEditorController *controller,
                    const QString &workingDirectory);
 
     // index -> working tree
@@ -135,7 +135,7 @@ private:
     QProcessEnvironment processEnvironment() const;
     QString gitPath() const;
 
-    QPointer<DiffEditor::DiffEditorController> m_editorController;
+    QPointer<DiffEditor::DiffEditorController> m_controller;
     const QString m_workingDirectory;
     GitClient *m_gitClient;
     const QString m_waitMessage;
@@ -143,9 +143,9 @@ private:
     QString m_id;
 };
 
-GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditorController *editorController,
+GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditorController *controller,
                const QString &workingDirectory)
-    : m_editorController(editorController),
+    : m_controller(controller),
       m_workingDirectory(workingDirectory),
       m_gitClient(GitPlugin::instance()->gitClient()),
       m_waitMessage(tr("Waiting for data..."))
@@ -201,12 +201,12 @@ void GitDiffHandler::show(const QString &id)
 
 void GitDiffHandler::postCollectShowDescription(const QString &id)
 {
-    if (m_editorController.isNull()) {
+    if (m_controller.isNull()) {
         deleteLater();
         return;
     }
 
-    m_editorController->clear(m_waitMessage);
+    m_controller->clear(m_waitMessage);
     VcsBase::Command *command = new VcsBase::Command(gitPath(),
                                                      m_workingDirectory,
                                                      processEnvironment());
@@ -226,7 +226,7 @@ void GitDiffHandler::postCollectShowDescription(const QString &id)
 
 void GitDiffHandler::slotShowDescriptionReceived(const QString &description)
 {
-    if (m_editorController.isNull()) {
+    if (m_controller.isNull()) {
         deleteLater();
         return;
     }
@@ -234,7 +234,7 @@ void GitDiffHandler::slotShowDescriptionReceived(const QString &description)
     postCollectDiffOutput(QStringList() << m_id + QLatin1Char('^') << m_id);
 
     // need to be called after postCollectDiffOutput(), since it clears the description
-    m_editorController->setDescription(
+    m_controller->setDescription(
                 m_gitClient->extendedShowDescription(m_workingDirectory,
                                                      description));
 }
@@ -243,10 +243,10 @@ void GitDiffHandler::addJob(VcsBase::Command *command, const QStringList &argume
 {
     QStringList args;
     args << QLatin1String("diff");
-    if (m_editorController->isIgnoreWhitespace())
+    if (m_controller->isIgnoreWhitespace())
         args << QLatin1String("--ignore-space-change");
     args << QLatin1String("--unified=") + QString::number(
-                m_editorController->contextLinesNumber());
+                m_controller->contextLinesNumber());
     args << arguments;
     command->addJob(args, timeout());
 }
@@ -258,12 +258,12 @@ void GitDiffHandler::postCollectDiffOutput(const QStringList &arguments)
 
 void GitDiffHandler::postCollectDiffOutput(const QList<QStringList> &argumentsList)
 {
-    if (m_editorController.isNull()) {
+    if (m_controller.isNull()) {
         deleteLater();
         return;
     }
 
-    m_editorController->clear(m_waitMessage);
+    m_controller->clear(m_waitMessage);
     VcsBase::Command *command = new VcsBase::Command(gitPath(),
                                                      m_workingDirectory,
                                                      processEnvironment());
@@ -280,7 +280,7 @@ void GitDiffHandler::postCollectDiffOutput(const QList<QStringList> &argumentsLi
 
 void GitDiffHandler::slotDiffOutputReceived(const QString &contents)
 {
-    if (m_editorController.isNull()) {
+    if (m_controller.isNull()) {
         deleteLater();
         return;
     }
@@ -288,8 +288,8 @@ void GitDiffHandler::slotDiffOutputReceived(const QString &contents)
     bool ok;
     QList<DiffEditor::FileData> fileDataList
             = DiffEditor::DiffUtils::readPatch(
-                contents, m_editorController->isIgnoreWhitespace(), &ok);
-    m_editorController->setDiffFiles(fileDataList, m_workingDirectory);
+                contents, m_controller->isIgnoreWhitespace(), &ok);
+    m_controller->setDiffFiles(fileDataList, m_workingDirectory);
     deleteLater();
 }
 
@@ -371,7 +371,7 @@ GitDiffEditorReloader::GitDiffEditorReloader(QObject *parent)
 
 void GitDiffEditorReloader::reload()
 {
-    GitDiffHandler *handler = new GitDiffHandler(diffEditorController(),
+    GitDiffHandler *handler = new GitDiffHandler(controller(),
                                                  m_workingDirectory);
     connect(handler, SIGNAL(destroyed()), this, SLOT(reloadFinished()));
 
@@ -798,9 +798,9 @@ void GitClient::slotChunkActionsRequested(QMenu *menu, int diffFileIndex, int ch
 
     m_contextDiffFileIndex = diffFileIndex;
     m_contextChunkIndex = chunkIndex;
-    m_contextDocument = qobject_cast<DiffEditor::DiffEditorController *>(sender());
+    m_contextController = qobject_cast<DiffEditor::DiffEditorController *>(sender());
 
-    if (m_contextDiffFileIndex < 0 || m_contextChunkIndex < 0 || !m_contextDocument) {
+    if (m_contextDiffFileIndex < 0 || m_contextChunkIndex < 0 || !m_contextController) {
         stageChunkAction->setEnabled(false);
         unstageChunkAction->setEnabled(false);
     }
@@ -808,13 +808,13 @@ void GitClient::slotChunkActionsRequested(QMenu *menu, int diffFileIndex, int ch
 
 QString GitClient::makePatch(int diffFileIndex, int chunkIndex, bool revert) const
 {
-    if (m_contextDocument.isNull())
+    if (m_contextController.isNull())
         return QString();
 
     if (diffFileIndex < 0 || chunkIndex < 0)
         return QString();
 
-    QList<DiffEditor::FileData> fileDataList = m_contextDocument->diffFiles();
+    QList<DiffEditor::FileData> fileDataList = m_contextController->diffFiles();
 
     if (diffFileIndex >= fileDataList.count())
         return QString();
@@ -838,7 +838,7 @@ QString GitClient::makePatch(int diffFileIndex, int chunkIndex, bool revert) con
 
 void GitClient::slotStageChunk()
 {
-    if (m_contextDocument.isNull())
+    if (m_contextController.isNull())
         return;
 
     const QString patch = makePatch(m_contextDiffFileIndex,
@@ -851,7 +851,7 @@ void GitClient::slotStageChunk()
 
 void GitClient::slotUnstageChunk()
 {
-    if (m_contextDocument.isNull())
+    if (m_contextController.isNull())
         return;
 
     const QString patch = makePatch(m_contextDiffFileIndex,
@@ -870,7 +870,7 @@ void GitClient::stage(const QString &patch, bool revert)
     if (!patchFile.open())
         return;
 
-    const QString baseDir = m_contextDocument->workingDirectory();
+    const QString baseDir = m_contextController->workingDirectory();
     QTextCodec *codec = EditorManager::defaultTextCodec();
     const QByteArray patchData = codec
             ? codec->fromUnicode(patch) : patch.toLocal8Bit();
@@ -891,7 +891,7 @@ void GitClient::stage(const QString &patch, bool revert)
         } else {
             outwin->append(errorMessage);
         }
-        m_contextDocument->requestReload();
+        m_contextController->requestReload();
     } else {
         outwin->appendError(errorMessage);
     }
@@ -1750,14 +1750,14 @@ void GitClient::branchesForCommit(const QString &revision)
     arguments << QLatin1String("branch") << QLatin1String(noColorOption)
               << QLatin1String("-a") << QLatin1String("--contains") << revision;
 
-    DiffEditor::DiffEditorController *editorController
+    DiffEditor::DiffEditorController *controller
             = qobject_cast<DiffEditor::DiffEditorController *>(sender());
-    QString workingDirectory = editorController->workingDirectory();
+    QString workingDirectory = controller->workingDirectory();
     VcsBase::Command *command = new VcsBase::Command(gitBinaryPath(), workingDirectory,
                                                      processEnvironment());
     command->setCodec(getSourceCodec(currentDocumentPath()));
 
-    connect(command, SIGNAL(output(QString)), editorController,
+    connect(command, SIGNAL(output(QString)), controller,
             SLOT(branchesForCommitReceived(QString)));
 
     command->addJob(arguments, -1);
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index d2d24541d57..9c54da4f941 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -434,7 +434,7 @@ private:
     bool m_disableEditor;
     int m_contextDiffFileIndex;
     int m_contextChunkIndex;
-    QPointer<DiffEditor::DiffEditorController> m_contextDocument;
+    QPointer<DiffEditor::DiffEditorController> m_contextController;
     QFutureSynchronizer<void> m_synchronizer; // for commit updates
 };
 
-- 
GitLab