forked from qt-creator/qt-creator
VCS: Always allow "Revert Chunk"
Remove revertDiffChunkEnabled property Any diff view might relate to previous changes, so it makes sense to always allow reverting them Change-Id: I8da0fb2d8625ac98140d1bde0296a4478bc6a0b7 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
3c342a49dc
commit
671bfb9250
@@ -622,7 +622,6 @@ void CvsPlugin::cvsDiff(const CvsDiffParameters &p)
|
|||||||
|
|
||||||
// Wire up the parameter widget to trigger a re-run on
|
// Wire up the parameter widget to trigger a re-run on
|
||||||
// parameter change and 'revert' from inside the diff editor.
|
// parameter change and 'revert' from inside the diff editor.
|
||||||
diffEditorWidget->setRevertDiffChunkEnabled(true);
|
|
||||||
CvsDiffParameterWidget *pw = new CvsDiffParameterWidget(p);
|
CvsDiffParameterWidget *pw = new CvsDiffParameterWidget(p);
|
||||||
connect(pw, SIGNAL(reRunDiff(Cvs::Internal::CvsDiffParameters)),
|
connect(pw, SIGNAL(reRunDiff(Cvs::Internal::CvsDiffParameters)),
|
||||||
this, SLOT(cvsDiff(Cvs::Internal::CvsDiffParameters)));
|
this, SLOT(cvsDiff(Cvs::Internal::CvsDiffParameters)));
|
||||||
|
|||||||
@@ -470,7 +470,6 @@ void GitClient::diff(const QString &workingDirectory,
|
|||||||
editor = createVcsEditor(editorId, title,
|
editor = createVcsEditor(editorId, title,
|
||||||
workingDirectory, CodecSource, "originalFileName", workingDirectory, argWidget);
|
workingDirectory, CodecSource, "originalFileName", workingDirectory, argWidget);
|
||||||
connect(editor, SIGNAL(diffChunkReverted(VcsBase::DiffChunk)), argWidget, SLOT(executeCommand()));
|
connect(editor, SIGNAL(diffChunkReverted(VcsBase::DiffChunk)), argWidget, SLOT(executeCommand()));
|
||||||
editor->setRevertDiffChunkEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GitCommitDiffArgumentsWidget *argWidget = qobject_cast<GitCommitDiffArgumentsWidget *>(editor->configurationWidget());
|
GitCommitDiffArgumentsWidget *argWidget = qobject_cast<GitCommitDiffArgumentsWidget *>(editor->configurationWidget());
|
||||||
@@ -528,7 +527,6 @@ void GitClient::diff(const QString &workingDirectory,
|
|||||||
|
|
||||||
editor = createVcsEditor(editorId, title, sourceFile, CodecSource, "originalFileName", sourceFile, argWidget);
|
editor = createVcsEditor(editorId, title, sourceFile, CodecSource, "originalFileName", sourceFile, argWidget);
|
||||||
connect(editor, SIGNAL(diffChunkReverted(VcsBase::DiffChunk)), argWidget, SLOT(executeCommand()));
|
connect(editor, SIGNAL(diffChunkReverted(VcsBase::DiffChunk)), argWidget, SLOT(executeCommand()));
|
||||||
editor->setRevertDiffChunkEnabled(true);
|
|
||||||
}
|
}
|
||||||
editor->setDiffBaseDirectory(workingDirectory);
|
editor->setDiffBaseDirectory(workingDirectory);
|
||||||
|
|
||||||
|
|||||||
@@ -1300,7 +1300,6 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
|||||||
VcsBase::VcsBaseEditorWidget *diffEditorWidget = qobject_cast<VcsBase::VcsBaseEditorWidget *>(editor->widget());
|
VcsBase::VcsBaseEditorWidget *diffEditorWidget = qobject_cast<VcsBase::VcsBaseEditorWidget *>(editor->widget());
|
||||||
// Wire up the parameter widget to trigger a re-run on
|
// Wire up the parameter widget to trigger a re-run on
|
||||||
// parameter change and 'revert' from inside the diff editor.
|
// parameter change and 'revert' from inside the diff editor.
|
||||||
diffEditorWidget->setRevertDiffChunkEnabled(true);
|
|
||||||
PerforceDiffParameterWidget *pw = new PerforceDiffParameterWidget(p);
|
PerforceDiffParameterWidget *pw = new PerforceDiffParameterWidget(p);
|
||||||
connect(pw, SIGNAL(reRunDiff(Perforce::Internal::PerforceDiffParameters)),
|
connect(pw, SIGNAL(reRunDiff(Perforce::Internal::PerforceDiffParameters)),
|
||||||
this, SLOT(p4Diff(Perforce::Internal::PerforceDiffParameters)));
|
this, SLOT(p4Diff(Perforce::Internal::PerforceDiffParameters)));
|
||||||
|
|||||||
@@ -622,7 +622,6 @@ void SubversionPlugin::svnDiff(const Subversion::Internal::SubversionDiffParamet
|
|||||||
|
|
||||||
// Wire up the parameter widget to trigger a re-run on
|
// Wire up the parameter widget to trigger a re-run on
|
||||||
// parameter change and 'revert' from inside the diff editor.
|
// parameter change and 'revert' from inside the diff editor.
|
||||||
diffEditorWidget->setRevertDiffChunkEnabled(true);
|
|
||||||
SubversionDiffParameterWidget *pw = new SubversionDiffParameterWidget(p);
|
SubversionDiffParameterWidget *pw = new SubversionDiffParameterWidget(p);
|
||||||
connect(pw, SIGNAL(reRunDiff(Subversion::Internal::SubversionDiffParameters)),
|
connect(pw, SIGNAL(reRunDiff(Subversion::Internal::SubversionDiffParameters)),
|
||||||
this, SLOT(svnDiff(Subversion::Internal::SubversionDiffParameters)));
|
this, SLOT(svnDiff(Subversion::Internal::SubversionDiffParameters)));
|
||||||
|
|||||||
@@ -357,7 +357,6 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
|
|||||||
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
|
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
|
||||||
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, true,
|
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, true,
|
||||||
vcsCmdString.toLatin1().constData(), id);
|
vcsCmdString.toLatin1().constData(), id);
|
||||||
editor->setRevertDiffChunkEnabled(true);
|
|
||||||
editor->setDiffBaseDirectory(workingDir);
|
editor->setDiffBaseDirectory(workingDir);
|
||||||
|
|
||||||
VcsBaseEditorParameterWidget *paramWidget = createDiffEditor(workingDir, files, extraOptions);
|
VcsBaseEditorParameterWidget *paramWidget = createDiffEditor(workingDir, files, extraOptions);
|
||||||
|
|||||||
@@ -603,7 +603,6 @@ public:
|
|||||||
bool m_fileLogAnnotateEnabled;
|
bool m_fileLogAnnotateEnabled;
|
||||||
TextEditor::BaseTextEditor *m_editor;
|
TextEditor::BaseTextEditor *m_editor;
|
||||||
QWidget *m_configurationWidget;
|
QWidget *m_configurationWidget;
|
||||||
bool m_revertChunkEnabled;
|
|
||||||
bool m_mouseDragging;
|
bool m_mouseDragging;
|
||||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||||
|
|
||||||
@@ -619,7 +618,6 @@ VcsBaseEditorWidgetPrivate::VcsBaseEditorWidgetPrivate(VcsBaseEditorWidget *edit
|
|||||||
m_fileLogAnnotateEnabled(false),
|
m_fileLogAnnotateEnabled(false),
|
||||||
m_editor(0),
|
m_editor(0),
|
||||||
m_configurationWidget(0),
|
m_configurationWidget(0),
|
||||||
m_revertChunkEnabled(false),
|
|
||||||
m_mouseDragging(false)
|
m_mouseDragging(false)
|
||||||
{
|
{
|
||||||
m_textCursorHandlers.append(new ChangeTextCursorHandler(editorWidget));
|
m_textCursorHandlers.append(new ChangeTextCursorHandler(editorWidget));
|
||||||
@@ -922,7 +920,7 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
|
|||||||
connect(applyAction, SIGNAL(triggered()), this, SLOT(slotApplyDiffChunk()));
|
connect(applyAction, SIGNAL(triggered()), this, SLOT(slotApplyDiffChunk()));
|
||||||
// Revert a chunk from a VCS diff, which might be linked to reloading the diff.
|
// Revert a chunk from a VCS diff, which might be linked to reloading the diff.
|
||||||
QAction *revertAction = menu->addAction(tr("Revert Chunk..."));
|
QAction *revertAction = menu->addAction(tr("Revert Chunk..."));
|
||||||
revertAction->setEnabled(isRevertDiffChunkEnabled() && canApply);
|
revertAction->setEnabled(canApply);
|
||||||
revertAction->setData(qVariantFromValue(Internal::DiffChunkAction(chunk, true)));
|
revertAction->setData(qVariantFromValue(Internal::DiffChunkAction(chunk, true)));
|
||||||
connect(revertAction, SIGNAL(triggered()), this, SLOT(slotApplyDiffChunk()));
|
connect(revertAction, SIGNAL(triggered()), this, SLOT(slotApplyDiffChunk()));
|
||||||
}
|
}
|
||||||
@@ -1412,16 +1410,6 @@ void VcsBaseEditorWidget::slotPaste()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VcsBaseEditorWidget::isRevertDiffChunkEnabled() const
|
|
||||||
{
|
|
||||||
return d->m_revertChunkEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VcsBaseEditorWidget::setRevertDiffChunkEnabled(bool e)
|
|
||||||
{
|
|
||||||
d->m_revertChunkEnabled = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VcsBaseEditorWidget::canApplyDiffChunk(const DiffChunk &dc) const
|
bool VcsBaseEditorWidget::canApplyDiffChunk(const DiffChunk &dc) const
|
||||||
{
|
{
|
||||||
if (!dc.isValid())
|
if (!dc.isValid())
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ class VCSBASE_EXPORT VcsBaseEditorWidget : public TextEditor::BaseTextEditorWidg
|
|||||||
Q_PROPERTY(QString annotateRevisionTextFormat READ annotateRevisionTextFormat WRITE setAnnotateRevisionTextFormat)
|
Q_PROPERTY(QString annotateRevisionTextFormat READ annotateRevisionTextFormat WRITE setAnnotateRevisionTextFormat)
|
||||||
Q_PROPERTY(QString copyRevisionTextFormat READ copyRevisionTextFormat WRITE setCopyRevisionTextFormat)
|
Q_PROPERTY(QString copyRevisionTextFormat READ copyRevisionTextFormat WRITE setCopyRevisionTextFormat)
|
||||||
Q_PROPERTY(bool isFileLogAnnotateEnabled READ isFileLogAnnotateEnabled WRITE setFileLogAnnotateEnabled)
|
Q_PROPERTY(bool isFileLogAnnotateEnabled READ isFileLogAnnotateEnabled WRITE setFileLogAnnotateEnabled)
|
||||||
Q_PROPERTY(bool revertDiffChunkEnabled READ isRevertDiffChunkEnabled WRITE setRevertDiffChunkEnabled)
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -142,10 +141,6 @@ public:
|
|||||||
QString diffBaseDirectory() const;
|
QString diffBaseDirectory() const;
|
||||||
void setDiffBaseDirectory(const QString &d);
|
void setDiffBaseDirectory(const QString &d);
|
||||||
|
|
||||||
// Diff: Can revert?
|
|
||||||
bool isRevertDiffChunkEnabled() const;
|
|
||||||
void setRevertDiffChunkEnabled(bool e);
|
|
||||||
|
|
||||||
bool isModified() const;
|
bool isModified() const;
|
||||||
|
|
||||||
EditorContentType contentType() const;
|
EditorContentType contentType() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user