Commit 3814e262 authored by hjk's avatar hjk

DiffEditor: Rename DiffEditorEditable to DiffEditor

More in line with current naming conventions.

Change-Id: I63f6677bd12d82f6749032996585d761f1a74fb7
Reviewed-by: default avatarJarek Kobus <jaroslaw.kobus@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 76fc9722
......@@ -27,7 +27,7 @@
**
****************************************************************************/
#include "diffeditoreditable.h"
#include "diffeditor.h"
#include "diffeditorfile.h"
#include "diffeditorwidget.h"
#include "diffeditorconstants.h"
......@@ -45,9 +45,9 @@
namespace DiffEditor {
///////////////////////////////// DiffEditorEditable //////////////////////////////////
///////////////////////////////// DiffEditor //////////////////////////////////
DiffEditorEditable::DiffEditorEditable(DiffEditorWidget *editorWidget)
DiffEditor::DiffEditor(DiffEditorWidget *editorWidget)
: IEditor(0),
m_file(new Internal::DiffEditorFile(QLatin1String(Constants::DIFF_EDITOR_MIMETYPE), this)),
m_editorWidget(editorWidget),
......@@ -59,20 +59,20 @@ DiffEditorEditable::DiffEditorEditable(DiffEditorWidget *editorWidget)
this, SLOT(activateEntry(int)));
}
DiffEditorEditable::~DiffEditorEditable()
DiffEditor::~DiffEditor()
{
delete m_toolWidget;
if (m_widget)
delete m_widget;
}
bool DiffEditorEditable::createNew(const QString &contents)
bool DiffEditor::createNew(const QString &contents)
{
Q_UNUSED(contents)
return true;
}
bool DiffEditorEditable::open(QString *errorString, const QString &fileName, const QString &realFileName)
bool DiffEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
Q_UNUSED(errorString)
Q_UNUSED(fileName)
......@@ -80,25 +80,25 @@ bool DiffEditorEditable::open(QString *errorString, const QString &fileName, con
return true;
}
Core::IDocument *DiffEditorEditable::document()
Core::IDocument *DiffEditor::document()
{
return m_file;
}
QString DiffEditorEditable::displayName() const
QString DiffEditor::displayName() const
{
if (m_displayName.isEmpty())
m_displayName = QCoreApplication::translate("DiffEditor", Constants::DIFF_EDITOR_DISPLAY_NAME);
return m_displayName;
}
void DiffEditorEditable::setDisplayName(const QString &title)
void DiffEditor::setDisplayName(const QString &title)
{
m_displayName = title;
emit changed();
}
Core::Id DiffEditorEditable::id() const
Core::Id DiffEditor::id() const
{
return Constants::DIFF_EDITOR_ID;
}
......@@ -114,7 +114,7 @@ static QToolBar *createToolBar(const QWidget *someWidget)
return toolBar;
}
QWidget *DiffEditorEditable::toolBar()
QWidget *DiffEditor::toolBar()
{
if (m_toolWidget)
return m_toolWidget;
......@@ -156,7 +156,7 @@ QWidget *DiffEditorEditable::toolBar()
return m_toolWidget;
}
void DiffEditorEditable::setDiff(const QList<DiffEditorWidget::DiffFilesContents> &diffFileList,
void DiffEditor::setDiff(const QList<DiffEditorWidget::DiffFilesContents> &diffFileList,
const QString &workingDirectory)
{
m_entriesComboBox->clear();
......@@ -200,27 +200,27 @@ void DiffEditorEditable::setDiff(const QList<DiffEditorWidget::DiffFilesContents
m_editorWidget->setDiff(diffFileList, workingDirectory);
}
void DiffEditorEditable::clear(const QString &message)
void DiffEditor::clear(const QString &message)
{
m_entriesComboBox->clear();
updateEntryToolTip();
m_editorWidget->clear(message);
}
void DiffEditorEditable::updateEntryToolTip()
void DiffEditor::updateEntryToolTip()
{
const QString &toolTip = m_entriesComboBox->itemData(
m_entriesComboBox->currentIndex(), Qt::ToolTipRole).toString();
m_entriesComboBox->setToolTip(toolTip);
}
void DiffEditorEditable::entryActivated(int index)
void DiffEditor::entryActivated(int index)
{
updateEntryToolTip();
m_editorWidget->navigateToDiffFile(index);
}
void DiffEditorEditable::activateEntry(int index)
void DiffEditor::activateEntry(int index)
{
m_entriesComboBox->blockSignals(true);
m_entriesComboBox->setCurrentIndex(index);
......
......@@ -47,12 +47,12 @@ namespace Internal {
class DiffEditorFile;
}
class DIFFEDITOR_EXPORT DiffEditorEditable : public Core::IEditor
class DIFFEDITOR_EXPORT DiffEditor : public Core::IEditor
{
Q_OBJECT
public:
explicit DiffEditorEditable(DiffEditorWidget *editorWidget);
virtual ~DiffEditorEditable();
explicit DiffEditor(DiffEditorWidget *editorWidget);
virtual ~DiffEditor();
public:
void setDiff(const QList<DiffEditorWidget::DiffFilesContents> &diffFileList,
......
......@@ -3,13 +3,13 @@ include(../../qtcreatorplugin.pri)
HEADERS += diffeditor_global.h \
diffeditorconstants.h \
diffeditoreditable.h \
diffeditor.h \
diffeditorfile.h \
diffeditorplugin.h \
diffeditorwidget.h \
differ.h
SOURCES += diffeditoreditable.cpp \
SOURCES += diffeditor.cpp \
diffeditorfile.cpp \
diffeditorplugin.cpp \
diffeditorwidget.cpp \
......
......@@ -28,7 +28,7 @@
****************************************************************************/
#include "diffeditorplugin.h"
#include "diffeditoreditable.h"
#include "diffeditor.h"
#include "diffeditorwidget.h"
#include "diffeditorconstants.h"
......@@ -67,7 +67,7 @@ QString DiffEditorFactory::displayName() const
Core::IEditor *DiffEditorFactory::createEditor(QWidget *parent)
{
DiffEditorWidget *editorWidget = new DiffEditorWidget(parent);
DiffEditorEditable *editor = new DiffEditorEditable(editorWidget);
DiffEditor *editor = new DiffEditor(editorWidget);
return editor;
}
......@@ -136,15 +136,15 @@ void DiffEditorPlugin::diff()
const Core::Id editorId = Constants::DIFF_EDITOR_ID;
//: Editor title
QString title = tr("Diff \"%1\", \"%2\"").arg(fileName1).arg(fileName2);
DiffEditorEditable *editorEditable = qobject_cast<DiffEditorEditable *>
DiffEditor *editor = qobject_cast<DiffEditor *>
(Core::EditorManager::openEditorWithContents(editorId, &title, QString()));
if (!editorEditable)
if (!editor)
return;
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch);
DiffEditorWidget *editorWidget = editorEditable->editorWidget();
DiffEditorWidget *editorWidget = editor->editorWidget();
const QString text1 = getFileContents(fileName1, editorWidget->codec());
const QString text2 = getFileContents(fileName2, editorWidget->codec());
......@@ -157,7 +157,7 @@ void DiffEditorPlugin::diff()
QList<DiffEditorWidget::DiffFilesContents> list;
list.append(dfc);
editorEditable->setDiff(list);
editor->setDiff(list);
}
QString DiffEditorPlugin::getFileContents(const QString &fileName, QTextCodec *codec) const
......
......@@ -56,8 +56,7 @@
#include <vcsbase/vcsbaseoutputwindow.h>
#include <vcsbase/vcsbaseplugin.h>
#include <diffeditor/diffeditorwidget.h>
#include <diffeditor/diffeditoreditable.h>
#include <diffeditor/diffeditor.h>
#include <diffeditor/diffeditorconstants.h>
#include <QCoreApplication>
......@@ -108,7 +107,7 @@ public:
}
};
GitDiffHandler(DiffEditor::DiffEditorEditable *editor,
GitDiffHandler(DiffEditor::DiffEditor *editor,
const QString &gitPath,
const QString &workingDirectory,
const QProcessEnvironment &environment,
......@@ -139,7 +138,7 @@ private:
void feedEditor();
QString workingTreeContents(const QString &fileName) const;
QPointer<DiffEditor::DiffEditorEditable> m_editor;
QPointer<DiffEditor::DiffEditor> m_editor;
const QString m_gitPath;
const QString m_workingDirectory;
const QProcessEnvironment m_processEnvironment;
......@@ -170,7 +169,7 @@ inline bool operator<(const GitDiffHandler::Revision &rev1, const GitDiffHandler
return rev1.id < rev2.id;
}
GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditorEditable *editor,
GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditor *editor,
const QString &gitPath,
const QString &workingDirectory,
const QProcessEnvironment &environment,
......@@ -823,7 +822,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis
return rc;
}
DiffEditor::DiffEditorEditable *GitClient::findExistingDiffEditor(const char *registerDynamicProperty,
DiffEditor::DiffEditor *GitClient::findExistingDiffEditor(const char *registerDynamicProperty,
const QString &dynamicPropertyValue) const
{
Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue);
......@@ -834,7 +833,7 @@ DiffEditor::DiffEditorEditable *GitClient::findExistingDiffEditor(const char *re
Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
outputEditor->createNew(m_msgWait);
return qobject_cast<DiffEditor::DiffEditorEditable *>(outputEditor);
return qobject_cast<DiffEditor::DiffEditor *>(outputEditor);
}
/* Create an editor associated to VCS output of a source file/directory
......@@ -889,10 +888,10 @@ void GitClient::diff(const QString &workingDirectory,
const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID;
QString title = tr("Git Diff");
DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("originalFileName", workingDirectory);
DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("originalFileName", workingDirectory);
if (!editorEditable) {
editorEditable = qobject_cast<DiffEditor::DiffEditorEditable *>(
editorEditable = qobject_cast<DiffEditor::DiffEditor *>(
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
editorEditable->document()->setProperty("originalFileName", workingDirectory);
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); // should probably go outside this block
......@@ -977,9 +976,9 @@ void GitClient::diff(const QString &workingDirectory,
QString title = tr("Git Diff \"%1\"").arg(fileName);
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileName);
DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("originalFileName", sourceFile);
DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("originalFileName", sourceFile);
if (!editorEditable) {
editorEditable = qobject_cast<DiffEditor::DiffEditorEditable *>(
editorEditable = qobject_cast<DiffEditor::DiffEditor *>(
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
editorEditable->document()->setProperty("originalFileName", sourceFile);
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch);
......@@ -1026,9 +1025,9 @@ void GitClient::diffBranch(const QString &workingDirectory,
const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID;
QString title = tr("Git Diff Branch \"%1\"").arg(branchName);
DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("BranchName", branchName);
DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("BranchName", branchName);
if (!editorEditable) {
editorEditable = qobject_cast<DiffEditor::DiffEditorEditable *>(
editorEditable = qobject_cast<DiffEditor::DiffEditor *>(
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
editorEditable->document()->setProperty("BranchName", branchName);
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch);
......@@ -1143,10 +1142,10 @@ void GitClient::show(const QString &source, const QString &id,
if (settings()->boolValue(GitSettings::useDiffEditorKey)) {
const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID;
DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("show", id);
DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("show", id);
if (!editorEditable) {
editorEditable = qobject_cast<DiffEditor::DiffEditorEditable *>(
editorEditable = qobject_cast<DiffEditor::DiffEditor *>(
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
editorEditable->document()->setProperty("show", id);
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); // should probably go outside this block
......
......@@ -61,7 +61,7 @@ namespace Utils {
}
namespace DiffEditor {
class DiffEditorEditable;
class DiffEditor;
}
namespace Git {
......@@ -335,7 +335,7 @@ private:
QTextCodec *getSourceCodec(const QString &file) const;
VcsBase::VcsBaseEditorWidget *findExistingVCSEditor(const char *registerDynamicProperty,
const QString &dynamicPropertyValue) const;
DiffEditor::DiffEditorEditable *findExistingDiffEditor(const char *registerDynamicProperty,
DiffEditor::DiffEditor *findExistingDiffEditor(const char *registerDynamicProperty,
const QString &dynamicPropertyValue) const;
enum CodecType { CodecSource, CodecLogOutput, CodecNone };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment