Move Gui stuff out of DiffEditorController

Place it in DiffEditorGuiController, will be needed for
sharing gui settings between unified and sidebyside versions.

Change-Id: I8a858d0549ff84e21f7c909288ca07c5a2ef4e5b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
This commit is contained in:
jkobus
2014-02-24 11:10:17 +01:00
committed by Jarek Kobus
parent 167206f8fb
commit 52e166c5ae
10 changed files with 290 additions and 154 deletions

View File

@@ -30,6 +30,7 @@
#include "diffeditor.h"
#include "diffeditorconstants.h"
#include "diffeditordocument.h"
#include "diffeditorguicontroller.h"
#include "sidebysidediffeditorwidget.h"
#include <coreplugin/icore.h>
@@ -121,7 +122,8 @@ DiffEditor::DiffEditor()
, m_document(new DiffEditorDocument(QLatin1String(Constants::DIFF_EDITOR_MIMETYPE)))
, m_descriptionWidget(0)
, m_diffWidget(0)
, m_diffEditorController(0)
, m_controller(0)
, m_guiController(0)
, m_toolBar(0)
, m_entriesComboBox(0)
, m_toggleDescriptionAction(0)
@@ -134,7 +136,8 @@ DiffEditor::DiffEditor(DiffEditor *other)
, m_document(other->m_document)
, m_descriptionWidget(0)
, m_diffWidget(0)
, m_diffEditorController(0)
, m_controller(0)
, m_guiController(0)
, m_toolBar(0)
, m_entriesComboBox(0)
, m_toggleDescriptionAction(0)
@@ -163,23 +166,24 @@ void DiffEditor::ctor()
m_descriptionWidget->setCodeStyle(TextEditorSettings::codeStyle());
m_descriptionWidget->baseTextDocument()->setFontSettings(TextEditorSettings::fontSettings());
m_diffEditorController = m_document->controller();
m_diffWidget->setDiffEditorController(m_diffEditorController);
m_controller = m_document->controller();
m_guiController = new DiffEditorGuiController(m_controller, this);
m_diffWidget->setDiffEditorGuiController(m_guiController);
connect(m_diffEditorController, SIGNAL(cleared(QString)),
connect(m_controller, SIGNAL(cleared(QString)),
this, SLOT(slotCleared(QString)));
connect(m_diffEditorController, SIGNAL(diffContentsChanged(QList<DiffEditorController::DiffFilesContents>,QString)),
connect(m_controller, SIGNAL(diffContentsChanged(QList<DiffEditorController::DiffFilesContents>,QString)),
this, SLOT(slotDiffContentsChanged(QList<DiffEditorController::DiffFilesContents>,QString)));
connect(m_diffEditorController, SIGNAL(currentDiffFileIndexChanged(int)),
this, SLOT(activateEntry(int)));
connect(m_diffEditorController, SIGNAL(descriptionChanged(QString)),
connect(m_controller, SIGNAL(descriptionChanged(QString)),
this, SLOT(slotDescriptionChanged(QString)));
connect(m_diffEditorController, SIGNAL(descriptionEnablementChanged(bool)),
connect(m_controller, SIGNAL(descriptionEnablementChanged(bool)),
this, SLOT(slotDescriptionVisibilityChanged()));
connect(m_diffEditorController, SIGNAL(descriptionVisibilityChanged(bool)),
connect(m_guiController, SIGNAL(descriptionVisibilityChanged(bool)),
this, SLOT(slotDescriptionVisibilityChanged()));
connect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
this, SLOT(activateEntry(int)));
slotDescriptionChanged(m_diffEditorController->description());
slotDescriptionChanged(m_controller->description());
slotDescriptionVisibilityChanged();
}
@@ -275,13 +279,13 @@ QWidget *DiffEditor::toolBar()
slotDescriptionVisibilityChanged();
connect(whitespaceButton, SIGNAL(clicked(bool)),
m_diffEditorController, SLOT(setIgnoreWhitespaces(bool)));
m_guiController, SLOT(setIgnoreWhitespaces(bool)));
connect(contextSpinBox, SIGNAL(valueChanged(int)),
m_diffEditorController, SLOT(setContextLinesNumber(int)));
m_guiController, SLOT(setContextLinesNumber(int)));
connect(toggleSync, SIGNAL(clicked(bool)),
m_diffEditorController, SLOT(setHorizontalScrollBarSynchronization(bool)));
m_guiController, SLOT(setHorizontalScrollBarSynchronization(bool)));
connect(toggleDescription, SIGNAL(clicked(bool)),
m_diffEditorController, SLOT(setDescriptionVisible(bool)));
m_guiController, SLOT(setDescriptionVisible(bool)));
// TODO: synchronize in opposite direction too
return m_toolBar;
@@ -289,7 +293,7 @@ QWidget *DiffEditor::toolBar()
DiffEditorController * DiffEditor::controller() const
{
return m_diffEditorController;
return m_controller;
}
void DiffEditor::updateEntryToolTip()
@@ -302,7 +306,7 @@ void DiffEditor::updateEntryToolTip()
void DiffEditor::entryActivated(int index)
{
updateEntryToolTip();
m_diffEditorController->setCurrentDiffFileIndex(index);
m_guiController->setCurrentDiffFileIndex(index);
}
void DiffEditor::slotCleared(const QString &message)
@@ -373,8 +377,8 @@ void DiffEditor::slotDescriptionChanged(const QString &description)
void DiffEditor::slotDescriptionVisibilityChanged()
{
const bool visible = m_diffEditorController->isDescriptionVisible();
const bool enabled = m_diffEditorController->isDescriptionEnabled();
const bool enabled = m_controller->isDescriptionEnabled();
const bool visible = m_guiController->isDescriptionVisible();
m_descriptionWidget->setVisible(visible && enabled);

View File

@@ -47,6 +47,7 @@ namespace TextEditor { class BaseTextEditorWidget; }
namespace DiffEditor {
class DiffEditorDocument;
class DiffEditorGuiController;
class SideBySideDiffEditorWidget;
class DIFFEDITOR_EXPORT DiffEditor : public Core::IEditor
@@ -88,7 +89,8 @@ private:
QSharedPointer<DiffEditorDocument> m_document;
TextEditor::BaseTextEditorWidget *m_descriptionWidget;
SideBySideDiffEditorWidget *m_diffWidget;
DiffEditorController *m_diffEditorController;
DiffEditorController *m_controller;
DiffEditorGuiController *m_guiController;
QToolBar *m_toolBar;
QComboBox *m_entriesComboBox;
QAction *m_toggleDescriptionAction;

View File

@@ -7,6 +7,7 @@ HEADERS += diffeditor_global.h \
diffeditorcontroller.h \
diffeditordocument.h \
diffeditorfactory.h \
diffeditorguicontroller.h \
diffeditormanager.h \
diffeditorplugin.h \
differ.h \
@@ -16,6 +17,7 @@ SOURCES += diffeditor.cpp \
diffeditorcontroller.cpp \
diffeditordocument.cpp \
diffeditorfactory.cpp \
diffeditorguicontroller.cpp \
diffeditormanager.cpp \
diffeditorplugin.cpp \
differ.cpp \

View File

@@ -23,6 +23,8 @@ QtcPlugin {
"diffeditordocument.h",
"diffeditorfactory.cpp",
"diffeditorfactory.h",
"diffeditorguicontroller.cpp",
"diffeditorguicontroller.h",
"diffeditormanager.cpp",
"diffeditormanager.h",
"diffeditorplugin.cpp",

View File

@@ -33,12 +33,7 @@ namespace DiffEditor {
DiffEditorController::DiffEditorController(QObject *parent)
: QObject(parent),
m_descriptionEnabled(false),
m_descriptionVisible(true),
m_contextLinesNumber(3),
m_ignoreWhitespaces(true),
m_syncScrollBars(true),
m_currentDiffFileIndex(-1)
m_descriptionEnabled(false)
{
clear();
}
@@ -73,31 +68,6 @@ bool DiffEditorController::isDescriptionEnabled() const
return m_descriptionEnabled;
}
bool DiffEditorController::isDescriptionVisible() const
{
return m_descriptionVisible;
}
int DiffEditorController::contextLinesNumber() const
{
return m_contextLinesNumber;
}
bool DiffEditorController::isIgnoreWhitespaces() const
{
return m_ignoreWhitespaces;
}
bool DiffEditorController::horizontalScrollBarSynchronization() const
{
return m_syncScrollBars;
}
int DiffEditorController::currentDiffFileIndex() const
{
return m_currentDiffFileIndex;
}
void DiffEditorController::clear()
{
clear(tr("No difference"));
@@ -106,7 +76,6 @@ void DiffEditorController::clear()
void DiffEditorController::clear(const QString &message)
{
m_clearMessage = message;
m_currentDiffFileIndex = -1;
emit cleared(message);
}
@@ -115,7 +84,6 @@ void DiffEditorController::setDiffContents(const QList<DiffFilesContents> &diffF
{
m_diffFileList = diffFileList;
m_workingDirectory = workingDirectory;
m_currentDiffFileIndex = (diffFileList.isEmpty() ? -1 : 0);
emit diffContentsChanged(diffFileList, workingDirectory);
}
@@ -137,55 +105,4 @@ void DiffEditorController::setDescriptionEnabled(bool on)
emit descriptionEnablementChanged(on);
}
void DiffEditorController::setDescriptionVisible(bool on)
{
if (m_descriptionVisible == on)
return;
m_descriptionVisible = on;
emit descriptionVisibilityChanged(on);
}
void DiffEditorController::setContextLinesNumber(int lines)
{
const int l = qMax(lines, -1);
if (m_contextLinesNumber == l)
return;
m_contextLinesNumber = l;
emit contextLinesNumberChanged(l);
}
void DiffEditorController::setIgnoreWhitespaces(bool ignore)
{
if (m_ignoreWhitespaces == ignore)
return;
m_ignoreWhitespaces = ignore;
emit ignoreWhitespacesChanged(ignore);
}
void DiffEditorController::setHorizontalScrollBarSynchronization(bool on)
{
if (m_syncScrollBars == on)
return;
m_syncScrollBars = on;
emit horizontalScrollBarSynchronizationChanged(on);
}
void DiffEditorController::setCurrentDiffFileIndex(int diffFileIndex)
{
if (!m_diffFileList.count())
return; // -1 is the only valid value in this case
const int newIndex = qBound(0, diffFileIndex, m_diffFileList.count() - 1);
if (m_currentDiffFileIndex == newIndex)
return;
m_currentDiffFileIndex = newIndex;
emit currentDiffFileIndexChanged(newIndex);
}
} // namespace DiffEditor

View File

@@ -67,12 +67,6 @@ public:
QString description() const;
bool isDescriptionEnabled() const;
bool isDescriptionVisible() const;
int contextLinesNumber() const;
bool isIgnoreWhitespaces() const;
bool horizontalScrollBarSynchronization() const;
int currentDiffFileIndex() const;
public slots:
void clear();
void clear(const QString &message);
@@ -81,26 +75,12 @@ public slots:
void setDescription(const QString &description);
void setDescriptionEnabled(bool on);
void setDescriptionVisible(bool on);
void setContextLinesNumber(int lines);
void setIgnoreWhitespaces(bool ignore);
void setHorizontalScrollBarSynchronization(bool on);
void setCurrentDiffFileIndex(int diffFileIndex);
signals:
// This sets the current diff file index to -1
void cleared(const QString &message);
// This sets the current diff file index to 0 (unless diffFileList is empty)
void diffContentsChanged(const QList<DiffEditorController::DiffFilesContents> &diffFileList, const QString &workingDirectory);
void descriptionChanged(const QString &description);
void descriptionEnablementChanged(bool on);
void descriptionVisibilityChanged(bool on);
void contextLinesNumberChanged(int lines);
void ignoreWhitespacesChanged(bool ignore);
void horizontalScrollBarSynchronizationChanged(bool on);
void currentDiffFileIndexChanged(int diffFileIndex);
private:
QString m_clearMessage;
@@ -108,12 +88,6 @@ private:
QString m_workingDirectory;
QString m_description;
bool m_descriptionEnabled;
bool m_descriptionVisible;
int m_contextLinesNumber;
bool m_ignoreWhitespaces;
bool m_syncScrollBars;
int m_currentDiffFileIndex;
};
} // namespace DiffEditor

View File

@@ -0,0 +1,141 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "diffeditorguicontroller.h"
#include "diffeditorcontroller.h"
namespace DiffEditor {
DiffEditorGuiController::DiffEditorGuiController(DiffEditorController *controller, QObject *parent)
: QObject(parent),
m_controller(controller),
m_descriptionVisible(true),
m_contextLinesNumber(3),
m_ignoreWhitespaces(true),
m_syncScrollBars(true),
m_currentDiffFileIndex(-1)
{
connect(m_controller, SIGNAL(cleared(QString)), this, SLOT(slotUpdateDiffFileIndex()));
connect(m_controller, SIGNAL(diffContentsChanged(QList<DiffEditorController::DiffFilesContents>,QString)),
this, SLOT(slotUpdateDiffFileIndex()));
slotUpdateDiffFileIndex();
}
DiffEditorGuiController::~DiffEditorGuiController()
{
}
DiffEditorController *DiffEditorGuiController::controller() const
{
return m_controller;
}
bool DiffEditorGuiController::isDescriptionVisible() const
{
return m_descriptionVisible;
}
int DiffEditorGuiController::contextLinesNumber() const
{
return m_contextLinesNumber;
}
bool DiffEditorGuiController::isIgnoreWhitespaces() const
{
return m_ignoreWhitespaces;
}
bool DiffEditorGuiController::horizontalScrollBarSynchronization() const
{
return m_syncScrollBars;
}
int DiffEditorGuiController::currentDiffFileIndex() const
{
return m_currentDiffFileIndex;
}
void DiffEditorGuiController::slotUpdateDiffFileIndex()
{
m_currentDiffFileIndex = (m_controller->diffContents().isEmpty() ? -1 : 0);
}
void DiffEditorGuiController::setDescriptionVisible(bool on)
{
if (m_descriptionVisible == on)
return;
m_descriptionVisible = on;
emit descriptionVisibilityChanged(on);
}
void DiffEditorGuiController::setContextLinesNumber(int lines)
{
const int l = qMax(lines, -1);
if (m_contextLinesNumber == l)
return;
m_contextLinesNumber = l;
emit contextLinesNumberChanged(l);
}
void DiffEditorGuiController::setIgnoreWhitespaces(bool ignore)
{
if (m_ignoreWhitespaces == ignore)
return;
m_ignoreWhitespaces = ignore;
emit ignoreWhitespacesChanged(ignore);
}
void DiffEditorGuiController::setHorizontalScrollBarSynchronization(bool on)
{
if (m_syncScrollBars == on)
return;
m_syncScrollBars = on;
emit horizontalScrollBarSynchronizationChanged(on);
}
void DiffEditorGuiController::setCurrentDiffFileIndex(int diffFileIndex)
{
if (m_controller->diffContents().isEmpty())
return; // -1 is the only valid value in this case
const int newIndex = qBound(0, diffFileIndex, m_controller->diffContents().count() - 1);
if (m_currentDiffFileIndex == newIndex)
return;
m_currentDiffFileIndex = newIndex;
emit currentDiffFileIndexChanged(newIndex);
}
} // namespace DiffEditor

View File

@@ -0,0 +1,84 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef DIFFEDITORGUICONTROLLER_H
#define DIFFEDITORGUICONTROLLER_H
#include "diffeditor_global.h"
#include <QObject>
namespace DiffEditor {
class DiffEditorController;
class DIFFEDITOR_EXPORT DiffEditorGuiController : public QObject
{
Q_OBJECT
public:
DiffEditorGuiController(DiffEditorController *controller, QObject *parent = 0);
~DiffEditorGuiController();
DiffEditorController *controller() const;
bool isDescriptionVisible() const;
int contextLinesNumber() const;
bool isIgnoreWhitespaces() const;
bool horizontalScrollBarSynchronization() const;
int currentDiffFileIndex() const;
public slots:
void setDescriptionVisible(bool on);
void setContextLinesNumber(int lines);
void setIgnoreWhitespaces(bool ignore);
void setHorizontalScrollBarSynchronization(bool on);
void setCurrentDiffFileIndex(int diffFileIndex);
signals:
void descriptionVisibilityChanged(bool on);
void contextLinesNumberChanged(int lines);
void ignoreWhitespacesChanged(bool ignore);
void horizontalScrollBarSynchronizationChanged(bool on);
void currentDiffFileIndexChanged(int diffFileIndex);
private slots:
void slotUpdateDiffFileIndex();
private:
DiffEditorController *m_controller;
bool m_descriptionVisible;
int m_contextLinesNumber;
bool m_ignoreWhitespaces;
bool m_syncScrollBars;
int m_currentDiffFileIndex;
};
} // namespace DiffEditor
#endif // DIFFEDITORGUICONTROLLER_H

View File

@@ -28,6 +28,8 @@
****************************************************************************/
#include "sidebysidediffeditorwidget.h"
#include "diffeditorguicontroller.h"
#include <QPlainTextEdit>
#include <QVBoxLayout>
#include <QPlainTextDocumentLayout>
@@ -960,6 +962,7 @@ void SideDiffEditorWidget::drawCollapsedBlockPopup(QPainter &painter,
SideBySideDiffEditorWidget::SideBySideDiffEditorWidget(QWidget *parent)
: QWidget(parent)
, m_guiController(0)
, m_controller(0)
, m_foldingBlocker(false)
{
@@ -1034,40 +1037,46 @@ SideBySideDiffEditorWidget::~SideBySideDiffEditorWidget()
}
void SideBySideDiffEditorWidget::setDiffEditorController(DiffEditorController *controller)
void SideBySideDiffEditorWidget::setDiffEditorGuiController(DiffEditorGuiController *controller)
{
if (m_controller) {
if (m_guiController) {
disconnect(m_controller, SIGNAL(cleared(QString)), this, SLOT(clear(QString)));
disconnect(m_controller, SIGNAL(diffContentsChanged(QList<DiffEditorController::DiffFilesContents>,QString)),
this, SLOT(setDiff(QList<DiffEditorController::DiffFilesContents>,QString)));
disconnect(m_controller, SIGNAL(contextLinesNumberChanged(int)),
disconnect(m_guiController, SIGNAL(contextLinesNumberChanged(int)),
this, SLOT(setContextLinesNumber(int)));
disconnect(m_controller, SIGNAL(ignoreWhitespacesChanged(bool)),
disconnect(m_guiController, SIGNAL(ignoreWhitespacesChanged(bool)),
this, SLOT(setIgnoreWhitespaces(bool)));
disconnect(m_controller, SIGNAL(currentDiffFileIndexChanged(int)),
disconnect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
this, SLOT(setCurrentDiffFileIndex(int)));
clear(tr("No controller"));
}
m_controller = controller;
if (m_controller) {
m_guiController = controller;
m_controller = 0;
if (m_guiController) {
m_controller = m_guiController->controller();
connect(m_controller, SIGNAL(cleared(QString)), this, SLOT(clear(QString)));
connect(m_controller, SIGNAL(diffContentsChanged(QList<DiffEditorController::DiffFilesContents>,QString)),
this, SLOT(setDiff(QList<DiffEditorController::DiffFilesContents>,QString)));
connect(m_controller, SIGNAL(contextLinesNumberChanged(int)),
connect(m_guiController, SIGNAL(contextLinesNumberChanged(int)),
this, SLOT(setContextLinesNumber(int)));
connect(m_controller, SIGNAL(ignoreWhitespacesChanged(bool)),
connect(m_guiController, SIGNAL(ignoreWhitespacesChanged(bool)),
this, SLOT(setIgnoreWhitespaces(bool)));
connect(m_controller, SIGNAL(currentDiffFileIndexChanged(int)),
connect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
this, SLOT(setCurrentDiffFileIndex(int)));
setDiff(m_controller->diffContents(), m_controller->workingDirectory());
}
}
DiffEditorController *SideBySideDiffEditorWidget::diffEditorController() const
DiffEditorGuiController *SideBySideDiffEditorWidget::diffEditorGuiController() const
{
return m_controller;
return m_guiController;
}
void SideBySideDiffEditorWidget::clear(const QString &message)
@@ -1122,10 +1131,9 @@ void SideBySideDiffEditorWidget::handleWhitespaces(const QList<Diff> &input,
return;
Differ::splitDiffList(input, leftOutput, rightOutput);
if (m_controller && m_controller->isIgnoreWhitespaces()) {
if (m_guiController && m_guiController->isIgnoreWhitespaces()) {
QList<Diff> leftDiffList = Differ::moveWhitespaceIntoEqualities(*leftOutput);
QList<Diff> rightDiffList = Differ::moveWhitespaceIntoEqualities(*rightOutput);
Differ::diffBetweenEqualities(leftDiffList, rightDiffList, leftOutput, rightOutput);
}
}
@@ -1172,7 +1180,7 @@ void SideBySideDiffEditorWidget::setCurrentDiffFileIndex(int diffFileIndex)
FileData SideBySideDiffEditorWidget::calculateContextData(const ChunkData &originalData) const
{
const int contextLinesNumber = m_controller ? m_controller->contextLinesNumber() : 3;
const int contextLinesNumber = m_guiController ? m_guiController->contextLinesNumber() : 3;
if (contextLinesNumber < 0)
return FileData(originalData);
@@ -1652,13 +1660,13 @@ void SideBySideDiffEditorWidget::rightVSliderChanged()
void SideBySideDiffEditorWidget::leftHSliderChanged()
{
if (!m_controller || m_controller->horizontalScrollBarSynchronization())
if (!m_guiController || m_guiController->horizontalScrollBarSynchronization())
m_rightEditor->horizontalScrollBar()->setValue(m_leftEditor->horizontalScrollBar()->value());
}
void SideBySideDiffEditorWidget::rightHSliderChanged()
{
if (!m_controller || m_controller->horizontalScrollBarSynchronization())
if (!m_guiController || m_guiController->horizontalScrollBarSynchronization())
m_leftEditor->horizontalScrollBar()->setValue(m_rightEditor->horizontalScrollBar()->value());
}
@@ -1667,10 +1675,10 @@ void SideBySideDiffEditorWidget::leftCursorPositionChanged()
leftVSliderChanged();
leftHSliderChanged();
if (!m_controller)
if (!m_guiController)
return;
m_controller->setCurrentDiffFileIndex(m_leftEditor->fileIndexForBlockNumber(m_leftEditor->textCursor().blockNumber()));
m_guiController->setCurrentDiffFileIndex(m_leftEditor->fileIndexForBlockNumber(m_leftEditor->textCursor().blockNumber()));
}
void SideBySideDiffEditorWidget::rightCursorPositionChanged()
@@ -1678,10 +1686,10 @@ void SideBySideDiffEditorWidget::rightCursorPositionChanged()
rightVSliderChanged();
rightHSliderChanged();
if (!m_controller)
if (!m_guiController)
return;
m_controller->setCurrentDiffFileIndex(m_rightEditor->fileIndexForBlockNumber(m_rightEditor->textCursor().blockNumber()));
m_guiController->setCurrentDiffFileIndex(m_rightEditor->fileIndexForBlockNumber(m_rightEditor->textCursor().blockNumber()));
}
void SideBySideDiffEditorWidget::leftDocumentSizeChanged()

View File

@@ -47,6 +47,7 @@ QT_END_NAMESPACE
namespace DiffEditor {
class DiffEditorGuiController;
class SideDiffEditorWidget;
class ChunkData;
class FileData;
@@ -58,8 +59,8 @@ public:
SideBySideDiffEditorWidget(QWidget *parent = 0);
~SideBySideDiffEditorWidget();
void setDiffEditorController(DiffEditorController *controller);
DiffEditorController *diffEditorController() const;
void setDiffEditorGuiController(DiffEditorGuiController *controller);
DiffEditorGuiController *diffEditorGuiController() const;
#ifdef WITH_TESTS
static void testAssemblyRows();
@@ -106,6 +107,7 @@ private:
void synchronizeFoldings(SideDiffEditorWidget *source, SideDiffEditorWidget *destination);
void jumpToOriginalFile(const QString &fileName, int lineNumber, int columnNumber);
DiffEditorGuiController *m_guiController;
DiffEditorController *m_controller;
SideDiffEditorWidget *m_leftEditor;
SideDiffEditorWidget *m_rightEditor;