forked from qt-creator/qt-creator
Vcs: Move some static functions from *EditorWidget to *Editor
Change-Id: Ic7c0a3bca982f5728e28ff9f3e1e054b5a902ea9 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -149,7 +149,7 @@ static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
|
||||
static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
|
||||
{
|
||||
const VcsBase::EditorContentType et = static_cast<VcsBase::EditorContentType>(ie);
|
||||
return VcsBase::VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters), et);
|
||||
return VcsBase::VcsBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters), et);
|
||||
}
|
||||
|
||||
static inline QString debugCodec(const QTextCodec *c)
|
||||
@@ -1021,8 +1021,8 @@ void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringLis
|
||||
{
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << files;
|
||||
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBase::VcsBaseEditorWidget::getCodec(source);
|
||||
const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, files);
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBase::VcsBaseEditor::getCodec(source);
|
||||
|
||||
if ((m_settings.diffType == GraphicalDiff) && (files.count() == 1)) {
|
||||
const QString file = files.first();
|
||||
@@ -1050,10 +1050,10 @@ void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringLis
|
||||
|
||||
// diff of a single file? re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, workingDir, files);
|
||||
const QString tag = VcsBase::VcsBaseEditor::editorTag(VcsBase::DiffOutput, workingDir, files);
|
||||
if (files.count() == 1) {
|
||||
// Show in the same editor if diff has been executed before
|
||||
if (IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
if (IEditor *existingEditor = VcsBase::VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
existingEditor->document()->setContents(result.toUtf8());
|
||||
EditorManager::activateEditor(existingEditor);
|
||||
setWorkingDirectory(existingEditor, workingDir);
|
||||
@@ -1064,7 +1064,7 @@ void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringLis
|
||||
const QString title = QString::fromLatin1("cc diff %1").arg(diffname);
|
||||
IEditor *editor = showOutputInEditor(title, result, VcsBase::DiffOutput, source, codec);
|
||||
setWorkingDirectory(editor, workingDir);
|
||||
VcsBase::VcsBaseEditorWidget::tagEditor(editor, tag);
|
||||
VcsBase::VcsBaseEditor::tagEditor(editor, tag);
|
||||
ClearCaseEditorWidget *diffEditorWidget = qobject_cast<ClearCaseEditorWidget *>(editor->widget());
|
||||
QTC_ASSERT(diffEditorWidget, return);
|
||||
if (files.count() == 1)
|
||||
@@ -1290,7 +1290,7 @@ void ClearCasePlugin::history(const QString &workingDir,
|
||||
const QStringList &files,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(workingDir, files);
|
||||
QTextCodec *codec = VcsBase::VcsBaseEditor::getCodec(workingDir, files);
|
||||
// no need for temp file
|
||||
QStringList args(QLatin1String("lshistory"));
|
||||
if (m_settings.historyCount > 0)
|
||||
@@ -1309,18 +1309,18 @@ void ClearCasePlugin::history(const QString &workingDir,
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
|
||||
const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDir, files);
|
||||
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::LogOutput, workingDir, files);
|
||||
if (IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, files);
|
||||
const QString tag = VcsBase::VcsBaseEditor::editorTag(VcsBase::LogOutput, workingDir, files);
|
||||
if (IEditor *editor = VcsBase::VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cc history %1").arg(id);
|
||||
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
|
||||
const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, files);
|
||||
IEditor *newEditor = showOutputInEditor(title, response.stdOut, VcsBase::LogOutput, source, codec);
|
||||
VcsBase::VcsBaseEditorWidget::tagEditor(newEditor, tag);
|
||||
VcsBase::VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
if (enableAnnotationContextMenu)
|
||||
VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
|
||||
VcsBase::VcsBaseEditor::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1388,7 +1388,7 @@ void ClearCasePlugin::vcsAnnotate(const QString &workingDir, const QString &file
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << file;
|
||||
|
||||
QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(file);
|
||||
QTextCodec *codec = VcsBase::VcsBaseEditor::getCodec(file);
|
||||
|
||||
// Determine id
|
||||
QString id = file;
|
||||
@@ -1410,7 +1410,7 @@ void ClearCasePlugin::vcsAnnotate(const QString &workingDir, const QString &file
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString source = workingDir + QLatin1Char('/') + file;
|
||||
if (lineNumber <= 0)
|
||||
lineNumber = VcsBase::VcsBaseEditorWidget::lineNumberOfCurrentEditor(source);
|
||||
lineNumber = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor(source);
|
||||
|
||||
QString headerSep(QLatin1String("-------------------------------------------------"));
|
||||
int pos = qMax(0, response.stdOut.indexOf(headerSep));
|
||||
@@ -1422,16 +1422,16 @@ void ClearCasePlugin::vcsAnnotate(const QString &workingDir, const QString &file
|
||||
stream << response.stdOut.mid(dataStart) << headerSep << QLatin1Char('\n')
|
||||
<< headerSep << QLatin1Char('\n') << response.stdOut.left(pos);
|
||||
const QStringList files = QStringList(file);
|
||||
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::AnnotateOutput, workingDir, files);
|
||||
if (IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
const QString tag = VcsBase::VcsBaseEditor::editorTag(VcsBase::AnnotateOutput, workingDir, files);
|
||||
if (IEditor *editor = VcsBase::VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(res.toUtf8());
|
||||
VcsBase::VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber);
|
||||
VcsBase::VcsBaseEditor::gotoLineOfEditor(editor, lineNumber);
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cc annotate %1").arg(id);
|
||||
IEditor *newEditor = showOutputInEditor(title, res, VcsBase::AnnotateOutput, source, codec);
|
||||
VcsBase::VcsBaseEditorWidget::tagEditor(newEditor, tag);
|
||||
VcsBase::VcsBaseEditorWidget::gotoLineOfEditor(newEditor, lineNumber);
|
||||
VcsBase::VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
VcsBase::VcsBaseEditor::gotoLineOfEditor(newEditor, lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1450,7 +1450,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
|
||||
|
||||
QStringList args(QLatin1String("describe"));
|
||||
args.push_back(id);
|
||||
QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(source);
|
||||
QTextCodec *codec = VcsBase::VcsBaseEditor::getCodec(source);
|
||||
const ClearCaseResponse response =
|
||||
runCleartool(topLevel, args, m_settings.timeOutMS(), 0, codec);
|
||||
description = response.stdOut;
|
||||
@@ -1459,14 +1459,14 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
|
||||
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, source, QStringList(), changeNr);
|
||||
if (IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
const QString tag = VcsBase::VcsBaseEditor::editorTag(VcsBase::DiffOutput, source, QStringList(), changeNr);
|
||||
if (IEditor *editor = VcsBase::VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(description.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cc describe %1").arg(id);
|
||||
IEditor *newEditor = showOutputInEditor(title, description, VcsBase::DiffOutput, source, codec);
|
||||
VcsBase::VcsBaseEditorWidget::tagEditor(newEditor, tag);
|
||||
VcsBase::VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2102,7 +2102,7 @@ QString ClearCasePlugin::getFile(const QString &nativeFile, const QString &prefi
|
||||
// runs external (GNU) diff, and returns the stdout result
|
||||
QString ClearCasePlugin::diffExternal(QString file1, QString file2, bool keep)
|
||||
{
|
||||
QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(file1);
|
||||
QTextCodec *codec = VcsBase::VcsBaseEditor::getCodec(file1);
|
||||
|
||||
// if file2 is empty, we should compare to predecessor
|
||||
if (file2.isEmpty()) {
|
||||
|
@@ -152,7 +152,7 @@ const VcsBaseEditorParameters editorParameters[] = {
|
||||
static inline const VcsBaseEditorParameters *findType(int ie)
|
||||
{
|
||||
const EditorContentType et = static_cast<EditorContentType>(ie);
|
||||
return VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters) / sizeof(editorParameters[0]), et);
|
||||
return VcsBaseEditor::findType(editorParameters, sizeof(editorParameters) / sizeof(editorParameters[0]), et);
|
||||
}
|
||||
|
||||
static inline QString debugCodec(const QTextCodec *c)
|
||||
@@ -759,10 +759,10 @@ void CvsPlugin::filelog(const QString &workingDir,
|
||||
const QString &file,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
QTextCodec *codec = VcsBaseEditorWidget::getCodec(workingDir, QStringList(file));
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, QStringList(file));
|
||||
// no need for temp file
|
||||
const QString id = VcsBaseEditorWidget::getTitleId(workingDir, QStringList(file));
|
||||
const QString source = VcsBaseEditorWidget::getSource(workingDir, file);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(file));
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
QStringList args;
|
||||
args << QLatin1String("log");
|
||||
args.append(file);
|
||||
@@ -774,16 +774,16 @@ void CvsPlugin::filelog(const QString &workingDir,
|
||||
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString tag = VcsBaseEditorWidget::editorTag(LogOutput, workingDir, QStringList(file));
|
||||
if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
const QString tag = VcsBaseEditor::editorTag(LogOutput, workingDir, QStringList(file));
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cvs log %1").arg(id);
|
||||
IEditor *newEditor = showOutputInEditor(title, response.stdOut, LogOutput, source, codec);
|
||||
VcsBaseEditorWidget::tagEditor(newEditor, tag);
|
||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
if (enableAnnotationContextMenu)
|
||||
VcsBaseEditorWidget::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
|
||||
VcsBaseEditor::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -898,9 +898,9 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
const QStringList files(file);
|
||||
QTextCodec *codec = VcsBaseEditorWidget::getCodec(workingDir, files);
|
||||
const QString id = VcsBaseEditorWidget::getTitleId(workingDir, files, revision);
|
||||
const QString source = VcsBaseEditorWidget::getSource(workingDir, file);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, files);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files, revision);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
QStringList args;
|
||||
args << QLatin1String("annotate");
|
||||
if (!revision.isEmpty())
|
||||
@@ -915,18 +915,18 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file,
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
if (lineNumber < 1)
|
||||
lineNumber = VcsBaseEditorWidget::lineNumberOfCurrentEditor(file);
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(file);
|
||||
|
||||
const QString tag = VcsBaseEditorWidget::editorTag(AnnotateOutput, workingDir, QStringList(file), revision);
|
||||
if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir, QStringList(file), revision);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber);
|
||||
VcsBaseEditor::gotoLineOfEditor(editor, lineNumber);
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cvs annotate %1").arg(id);
|
||||
IEditor *newEditor = showOutputInEditor(title, response.stdOut, AnnotateOutput, source, codec);
|
||||
VcsBaseEditorWidget::tagEditor(newEditor, tag);
|
||||
VcsBaseEditorWidget::gotoLineOfEditor(newEditor, lineNumber);
|
||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
VcsBaseEditor::gotoLineOfEditor(newEditor, lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
|
||||
for (QList<CvsLogEntry>::iterator it = entries.begin(); it != lend; ++it) {
|
||||
// Before fiddling file names, try to find codec
|
||||
if (!codec)
|
||||
codec = VcsBaseEditorWidget::getCodec(repositoryPath, QStringList(it->file));
|
||||
codec = VcsBaseEditor::getCodec(repositoryPath, QStringList(it->file));
|
||||
// Run log
|
||||
QStringList args(QLatin1String("log"));
|
||||
args << (QLatin1String("-r") + it->revisions.front().revision) << it->file;
|
||||
@@ -1115,14 +1115,14 @@ bool CvsPlugin::describe(const QString &repositoryPath,
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString commitId = entries.front().revisions.front().commitId;
|
||||
if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(commitId)) {
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(commitId)) {
|
||||
editor->document()->setContents(output.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
setDiffBaseDirectory(editor, repositoryPath);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cvs describe %1").arg(commitId);
|
||||
IEditor *newEditor = showOutputInEditor(title, output, DiffOutput, entries.front().file, codec);
|
||||
VcsBaseEditorWidget::tagEditor(newEditor, commitId);
|
||||
VcsBaseEditor::tagEditor(newEditor, commitId);
|
||||
setDiffBaseDirectory(newEditor, repositoryPath);
|
||||
}
|
||||
return true;
|
||||
|
@@ -514,9 +514,7 @@ public:
|
||||
|
||||
void executeCommand()
|
||||
{
|
||||
int line = -1;
|
||||
if (m_editor)
|
||||
line = m_editor->lineNumberOfCurrentEditor();
|
||||
int line = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor();
|
||||
m_client->blame(m_workingDirectory, baseArguments(), m_fileName, m_revision, line);
|
||||
}
|
||||
|
||||
@@ -809,7 +807,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis
|
||||
// Exists already
|
||||
EditorManager::activateEditor(outputEditor);
|
||||
outputEditor->document()->setContents(m_msgWait.toUtf8());
|
||||
rc = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
|
||||
rc = VcsBaseEditor::getVcsBaseEditor(outputEditor);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -955,7 +953,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(
|
||||
IEditor *outputEditor = EditorManager::openEditorWithContents(id, &title,
|
||||
m_msgWait.toUtf8());
|
||||
outputEditor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
|
||||
rc = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
|
||||
rc = VcsBaseEditor::getVcsBaseEditor(outputEditor);
|
||||
connect(rc, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
|
||||
this, SLOT(slotBlameRevisionRequested(QString,QString,QString,int)));
|
||||
QTC_ASSERT(rc, return 0);
|
||||
@@ -1026,7 +1024,7 @@ void GitClient::diff(const QString &workingDirectory,
|
||||
void GitClient::diff(const QString &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
const QString title = tr("Git Diff \"%1\"").arg(fileName);
|
||||
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(
|
||||
const QString sourceFile = VcsBase::VcsBaseEditor::getSource(
|
||||
workingDirectory, fileName);
|
||||
const QString documentId = QLatin1String("File:") + sourceFile;
|
||||
DiffEditor::DiffEditorDocument *diffEditorDocument =
|
||||
@@ -1096,7 +1094,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
||||
const QString msgArg = fileName.isEmpty() ? workingDirectory : fileName;
|
||||
const QString title = tr("Git Log \"%1\"").arg(msgArg);
|
||||
const Id editorId = Git::Constants::GIT_LOG_EDITOR_ID;
|
||||
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileName);
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDirectory, fileName);
|
||||
VcsBase::VcsBaseEditorWidget *editor = findExistingVCSEditor("logFileName", sourceFile);
|
||||
if (!editor)
|
||||
editor = createVcsEditor(editorId, title, sourceFile, CodecLogOutput, "logFileName", sourceFile,
|
||||
@@ -1222,7 +1220,7 @@ void GitClient::slotBlameRevisionRequested(const QString &workingDirectory, cons
|
||||
|
||||
QTextCodec *GitClient::getSourceCodec(const QString &file) const
|
||||
{
|
||||
return QFileInfo(file).isFile() ? VcsBase::VcsBaseEditorWidget::getCodec(file)
|
||||
return QFileInfo(file).isFile() ? VcsBase::VcsBaseEditor::getCodec(file)
|
||||
: encoding(file, "gui.encoding");
|
||||
}
|
||||
|
||||
@@ -1233,9 +1231,9 @@ void GitClient::blame(const QString &workingDirectory,
|
||||
int lineNumber)
|
||||
{
|
||||
const Id editorId = Git::Constants::GIT_BLAME_EDITOR_ID;
|
||||
const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDirectory, QStringList(fileName), revision);
|
||||
const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDirectory, QStringList(fileName), revision);
|
||||
const QString title = tr("Git Blame \"%1\"").arg(id);
|
||||
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileName);
|
||||
const QString sourceFile = VcsBase::VcsBaseEditor::getSource(workingDirectory, fileName);
|
||||
|
||||
VcsBase::VcsBaseEditorWidget *editor = findExistingVCSEditor("blameFileName", id);
|
||||
if (!editor) {
|
||||
@@ -3266,7 +3264,7 @@ void GitClient::subversionLog(const QString &workingDirectory)
|
||||
// Create a command editor, no highlighting or interaction.
|
||||
const QString title = tr("Git SVN Log");
|
||||
const Id editorId = Git::Constants::C_GIT_COMMAND_LOG_EDITOR;
|
||||
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, QStringList());
|
||||
const QString sourceFile = VcsBase::VcsBaseEditor::getSource(workingDirectory, QStringList());
|
||||
VcsBase::VcsBaseEditorWidget *editor = findExistingVCSEditor("svnLog", sourceFile);
|
||||
if (!editor)
|
||||
editor = createVcsEditor(editorId, title, sourceFile, CodecNone, "svnLog", sourceFile, 0);
|
||||
|
@@ -726,7 +726,7 @@ void GitPlugin::blameFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
const int lineNumber = VcsBaseEditorWidget::lineNumberOfCurrentEditor(state.currentFile());
|
||||
const int lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(state.currentFile());
|
||||
m_gitClient->blame(state.currentFileTopLevel(), QStringList(), state.relativeCurrentFile(), QString(), lineNumber);
|
||||
}
|
||||
|
||||
|
@@ -121,7 +121,7 @@ const VcsBaseEditorParameters editorParameters[] = {
|
||||
static inline const VcsBaseEditorParameters *findType(int ie)
|
||||
{
|
||||
const EditorContentType et = static_cast<EditorContentType>(ie);
|
||||
return VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(editorParameters[0]), et);
|
||||
return VcsBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(editorParameters[0]), et);
|
||||
}
|
||||
|
||||
static inline QString debugCodec(const QTextCodec *c)
|
||||
@@ -468,7 +468,7 @@ void PerforcePlugin::revertCurrentFile()
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
|
||||
QTextCodec *codec = VcsBaseEditorWidget::getCodec(state.currentFile());
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(state.currentFile());
|
||||
QStringList args;
|
||||
args << QLatin1String("diff") << QLatin1String("-sa") << state.relativeCurrentFile();
|
||||
PerforceResponse result = runP4Cmd(state.currentFileTopLevel(), args,
|
||||
@@ -724,9 +724,9 @@ void PerforcePlugin::annotate(const QString &workingDir,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
const QStringList files = QStringList(fileName);
|
||||
QTextCodec *codec = VcsBaseEditorWidget::getCodec(workingDir, files);
|
||||
const QString id = VcsBaseEditorWidget::getTitleId(workingDir, files, changeList);
|
||||
const QString source = VcsBaseEditorWidget::getSource(workingDir, files);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, files);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files, changeList);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, files);
|
||||
QStringList args;
|
||||
args << QLatin1String("annotate") << QLatin1String("-cqi");
|
||||
if (changeList.isEmpty())
|
||||
@@ -738,11 +738,11 @@ void PerforcePlugin::annotate(const QString &workingDir,
|
||||
QStringList(), QByteArray(), codec);
|
||||
if (!result.error) {
|
||||
if (lineNumber < 1)
|
||||
lineNumber = VcsBaseEditorWidget::lineNumberOfCurrentEditor();
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor();
|
||||
IEditor *ed = showOutputInEditor(tr("p4 annotate %1").arg(id),
|
||||
result.stdOut, VcsBase::AnnotateOutput,
|
||||
source, codec);
|
||||
VcsBaseEditorWidget::gotoLineOfEditor(ed, lineNumber);
|
||||
VcsBaseEditor::gotoLineOfEditor(ed, lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -779,8 +779,8 @@ void PerforcePlugin::logRepository()
|
||||
void PerforcePlugin::filelog(const QString &workingDir, const QString &fileName,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
const QString id = VcsBaseEditorWidget::getTitleId(workingDir, QStringList(fileName));
|
||||
QTextCodec *codec = VcsBaseEditorWidget::getCodec(workingDir, QStringList(fileName));
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(fileName));
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, QStringList(fileName));
|
||||
QStringList args;
|
||||
args << QLatin1String("filelog") << QLatin1String("-li");
|
||||
if (m_settings.logCount() > 0)
|
||||
@@ -791,11 +791,11 @@ void PerforcePlugin::filelog(const QString &workingDir, const QString &fileName,
|
||||
CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
QStringList(), QByteArray(), codec);
|
||||
if (!result.error) {
|
||||
const QString source = VcsBaseEditorWidget::getSource(workingDir, fileName);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
IEditor *editor = showOutputInEditor(tr("p4 filelog %1").arg(id), result.stdOut,
|
||||
VcsBase::LogOutput, source, codec);
|
||||
if (enableAnnotationContextMenu)
|
||||
VcsBaseEditorWidget::getVcsBaseEditor(editor)->setFileLogAnnotateEnabled(true);
|
||||
VcsBaseEditor::getVcsBaseEditor(editor)->setFileLogAnnotateEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1270,11 +1270,11 @@ void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files)
|
||||
|
||||
void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
||||
{
|
||||
QTextCodec *codec = VcsBaseEditorWidget::getCodec(p.workingDir, p.files);
|
||||
const QString id = VcsBaseEditorWidget::getTitleId(p.workingDir, p.files);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(p.workingDir, p.files);
|
||||
const QString id = VcsBaseEditor::getTitleId(p.workingDir, p.files);
|
||||
// Reuse existing editors for that id
|
||||
const QString tag = VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, p.workingDir, p.files);
|
||||
IEditor *existingEditor = VcsBaseEditorWidget::locateEditorByTag(tag);
|
||||
const QString tag = VcsBaseEditor::editorTag(VcsBase::DiffOutput, p.workingDir, p.files);
|
||||
IEditor *existingEditor = VcsBaseEditor::locateEditorByTag(tag);
|
||||
// Split arguments according to size
|
||||
QStringList args;
|
||||
args << QLatin1String("diff");
|
||||
@@ -1298,9 +1298,9 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
||||
}
|
||||
// Create new editor
|
||||
IEditor *editor = showOutputInEditor(tr("p4 diff %1").arg(id), result.stdOut, VcsBase::DiffOutput,
|
||||
VcsBaseEditorWidget::getSource(p.workingDir, p.files),
|
||||
VcsBaseEditor::getSource(p.workingDir, p.files),
|
||||
codec);
|
||||
VcsBaseEditorWidget::tagEditor(editor, tag);
|
||||
VcsBaseEditor::tagEditor(editor, tag);
|
||||
VcsBaseEditorWidget *diffEditorWidget = qobject_cast<VcsBaseEditorWidget *>(editor->widget());
|
||||
// Wire up the parameter widget to trigger a re-run on
|
||||
// parameter change and 'revert' from inside the diff editor.
|
||||
@@ -1314,7 +1314,7 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
||||
|
||||
void PerforcePlugin::describe(const QString & source, const QString &n)
|
||||
{
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditorWidget::getCodec(source);
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditor::getCodec(source);
|
||||
QStringList args;
|
||||
args << QLatin1String("describe") << QLatin1String("-du") << n;
|
||||
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
|
@@ -142,7 +142,7 @@ const VcsBaseEditorParameters editorParameters[] = {
|
||||
static const VcsBaseEditorParameters *findType(int ie)
|
||||
{
|
||||
const EditorContentType et = static_cast<EditorContentType>(ie);
|
||||
return VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(editorParameters[0]), et);
|
||||
return VcsBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(editorParameters[0]), et);
|
||||
}
|
||||
|
||||
static inline QString debugCodec(const QTextCodec *c)
|
||||
@@ -813,19 +813,19 @@ void SubversionPlugin::filelog(const QString &workingDir,
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
|
||||
const QString id = VcsBaseEditorWidget::getTitleId(workingDir, QStringList(file));
|
||||
const QString tag = VcsBaseEditorWidget::editorTag(LogOutput, workingDir,
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(file));
|
||||
const QString tag = VcsBaseEditor::editorTag(LogOutput, workingDir,
|
||||
QStringList(file));
|
||||
if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("svn log %1").arg(id);
|
||||
const QString source = VcsBaseEditorWidget::getSource(workingDir, file);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
IEditor *newEditor = showOutputInEditor(title, response.stdOut, LogOutput, source, /*codec*/0);
|
||||
VcsBaseEditorWidget::tagEditor(newEditor, tag);
|
||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
if (enableAnnotationContextMenu)
|
||||
VcsBaseEditorWidget::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
|
||||
VcsBaseEditor::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -868,8 +868,8 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil
|
||||
const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
const QString source = VcsBaseEditorWidget::getSource(workingDir, file);
|
||||
QTextCodec *codec = VcsBaseEditorWidget::getCodec(source);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source);
|
||||
|
||||
QStringList args(QLatin1String("annotate"));
|
||||
if (m_settings.boolValue(SubversionSettings::spaceIgnorantAnnotationKey))
|
||||
@@ -888,20 +888,20 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
if (lineNumber <= 0)
|
||||
lineNumber = VcsBaseEditorWidget::lineNumberOfCurrentEditor(source);
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(source);
|
||||
// Determine id
|
||||
const QStringList files = QStringList(file);
|
||||
const QString id = VcsBaseEditorWidget::getTitleId(workingDir, files, revision);
|
||||
const QString tag = VcsBaseEditorWidget::editorTag(AnnotateOutput, workingDir, files);
|
||||
if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files, revision);
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir, files);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber);
|
||||
VcsBaseEditor::gotoLineOfEditor(editor, lineNumber);
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("svn annotate %1").arg(id);
|
||||
IEditor *newEditor = showOutputInEditor(title, response.stdOut, AnnotateOutput, source, codec);
|
||||
VcsBaseEditorWidget::tagEditor(newEditor, tag);
|
||||
VcsBaseEditorWidget::gotoLineOfEditor(newEditor, lineNumber);
|
||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
VcsBaseEditor::gotoLineOfEditor(newEditor, lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -947,7 +947,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
|
||||
QTextStream(&diffArg) << (number - 1) << ':' << number;
|
||||
args.push_back(diffArg);
|
||||
|
||||
QTextCodec *codec = VcsBaseEditorWidget::getCodec(source);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source);
|
||||
const SubversionResponse response =
|
||||
runSvn(topLevel, args, m_settings.timeOutMs(),
|
||||
SshPasswordPrompt, codec);
|
||||
@@ -957,14 +957,14 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
|
||||
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString tag = VcsBaseEditorWidget::editorTag(DiffOutput, source, QStringList(), changeNr);
|
||||
if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
|
||||
const QString tag = VcsBaseEditor::editorTag(DiffOutput, source, QStringList(), changeNr);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(description.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("svn describe %1#%2").arg(fi.fileName(), changeNr);
|
||||
IEditor *newEditor = showOutputInEditor(title, description, DiffOutput, source, codec);
|
||||
VcsBaseEditorWidget::tagEditor(newEditor, tag);
|
||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -324,9 +324,9 @@ void VcsBaseClient::annotate(const QString &workingDir, const QString &file,
|
||||
QStringList args;
|
||||
args << vcsCmdString << revisionSpec(revision) << extraOptions << file;
|
||||
const Core::Id kind = vcsEditorKind(AnnotateCommand);
|
||||
const QString id = VcsBase::VcsBaseEditorWidget::getSource(workingDir, QStringList(file));
|
||||
const QString id = VcsBaseEditor::getSource(workingDir, QStringList(file));
|
||||
const QString title = vcsEditorTitle(vcsCmdString, id);
|
||||
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, file);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
|
||||
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, true,
|
||||
vcsCmdString.toLatin1().constData(), id);
|
||||
@@ -341,9 +341,9 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
|
||||
{
|
||||
const QString vcsCmdString = vcsCommandString(DiffCommand);
|
||||
const Core::Id kind = vcsEditorKind(DiffCommand);
|
||||
const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDir, files);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files);
|
||||
const QString title = vcsEditorTitle(vcsCmdString, id);
|
||||
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, files);
|
||||
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, true,
|
||||
vcsCmdString.toLatin1().constData(), id);
|
||||
editor->setWorkingDirectory(workingDir);
|
||||
@@ -358,7 +358,7 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
|
||||
QStringList args;
|
||||
const QStringList paramArgs = paramWidget != 0 ? paramWidget->arguments() : QStringList();
|
||||
args << vcsCmdString << extraOptions << paramArgs << files;
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBase::VcsBaseEditorWidget::getCodec(source);
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditor::getCodec(source);
|
||||
Command *command = createCommand(workingDir, editor);
|
||||
command->setCodec(codec);
|
||||
enqueueJob(command, args, exitCodeInterpreter(DiffCommand, command));
|
||||
@@ -370,9 +370,9 @@ void VcsBaseClient::log(const QString &workingDir, const QStringList &files,
|
||||
{
|
||||
const QString vcsCmdString = vcsCommandString(LogCommand);
|
||||
const Core::Id kind = vcsEditorKind(LogCommand);
|
||||
const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDir, files);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files);
|
||||
const QString title = vcsEditorTitle(vcsCmdString, id);
|
||||
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, files);
|
||||
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, true,
|
||||
vcsCmdString.toLatin1().constData(), id);
|
||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||
@@ -563,19 +563,19 @@ VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(Core::Id kind, QStr
|
||||
if (outputEditor) {
|
||||
// Exists already
|
||||
outputEditor->document()->setContents(progressMsg.toUtf8());
|
||||
baseEditor = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
|
||||
baseEditor = VcsBaseEditor::getVcsBaseEditor(outputEditor);
|
||||
QTC_ASSERT(baseEditor, return 0);
|
||||
Core::EditorManager::activateEditor(outputEditor);
|
||||
} else {
|
||||
outputEditor = Core::EditorManager::openEditorWithContents(kind, &title, progressMsg.toUtf8());
|
||||
outputEditor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
|
||||
baseEditor = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
|
||||
baseEditor = VcsBaseEditor::getVcsBaseEditor(outputEditor);
|
||||
connect(baseEditor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
|
||||
this, SLOT(annotateRevision(QString,QString,QString,int)));
|
||||
QTC_ASSERT(baseEditor, return 0);
|
||||
baseEditor->setSource(source);
|
||||
if (setSourceCodec)
|
||||
baseEditor->setCodec(VcsBase::VcsBaseEditorWidget::getCodec(source));
|
||||
baseEditor->setCodec(VcsBaseEditor::getCodec(source));
|
||||
}
|
||||
|
||||
baseEditor->setForceReadOnly(true);
|
||||
|
@@ -542,7 +542,7 @@ public:
|
||||
// Can be used for diff and log. Combo created on first call.
|
||||
QComboBox *entriesComboBox();
|
||||
|
||||
TextEditor::BaseTextEditorWidget *q;
|
||||
BaseTextEditorWidget *q;
|
||||
const VcsBaseEditorParameters *m_parameters;
|
||||
|
||||
QString m_workingDirectory;
|
||||
@@ -559,8 +559,6 @@ public:
|
||||
bool m_mouseDragging;
|
||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||
QPointer<Command> m_command;
|
||||
|
||||
private:
|
||||
QComboBox *m_entriesComboBox;
|
||||
};
|
||||
|
||||
@@ -600,7 +598,7 @@ QComboBox *VcsBaseEditorWidgetPrivate::entriesComboBox()
|
||||
policy.setHorizontalPolicy(QSizePolicy::Expanding);
|
||||
m_entriesComboBox->setSizePolicy(policy);
|
||||
|
||||
q->insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, m_entriesComboBox);
|
||||
q->insertExtraToolBarWidget(BaseTextEditorWidget::Left, m_entriesComboBox);
|
||||
return m_entriesComboBox;
|
||||
}
|
||||
|
||||
@@ -805,7 +803,7 @@ bool VcsBaseEditorWidget::isModified() const
|
||||
return false;
|
||||
}
|
||||
|
||||
TextEditor::BaseTextEditor *VcsBaseEditorWidget::createEditor()
|
||||
BaseTextEditor *VcsBaseEditorWidget::createEditor()
|
||||
{
|
||||
QTC_ASSERT("should not happen anymore" && false, return 0);
|
||||
}
|
||||
@@ -960,7 +958,7 @@ void VcsBaseEditorWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->buttons()) {
|
||||
d->m_mouseDragging = true;
|
||||
TextEditor::BaseTextEditorWidget::mouseMoveEvent(e);
|
||||
BaseTextEditorWidget::mouseMoveEvent(e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -981,7 +979,7 @@ void VcsBaseEditorWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
cursorShape = Qt::IBeamCursor;
|
||||
}
|
||||
}
|
||||
TextEditor::BaseTextEditorWidget::mouseMoveEvent(e);
|
||||
BaseTextEditorWidget::mouseMoveEvent(e);
|
||||
|
||||
if (overrideCursor)
|
||||
viewport()->setCursor(cursorShape);
|
||||
@@ -1002,7 +1000,7 @@ void VcsBaseEditorWidget::mouseReleaseEvent(QMouseEvent *e)
|
||||
}
|
||||
}
|
||||
}
|
||||
TextEditor::BaseTextEditorWidget::mouseReleaseEvent(e);
|
||||
BaseTextEditorWidget::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
@@ -1011,7 +1009,7 @@ void VcsBaseEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
QTextCursor cursor = cursorForPosition(e->pos());
|
||||
jumpToChangeFromDiff(cursor);
|
||||
}
|
||||
TextEditor::BaseTextEditorWidget::mouseDoubleClickEvent(e);
|
||||
BaseTextEditorWidget::mouseDoubleClickEvent(e);
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::keyPressEvent(QKeyEvent *e)
|
||||
@@ -1091,7 +1089,7 @@ void VcsBaseEditorWidget::jumpToChangeFromDiff(QTextCursor cursor)
|
||||
const QChar deletionIndicator = QLatin1Char('-');
|
||||
// find nearest change hunk
|
||||
QTextBlock block = cursor.block();
|
||||
if (TextEditor::BaseTextDocumentLayout::foldingIndent(block) <= 1)
|
||||
if (BaseTextDocumentLayout::foldingIndent(block) <= 1)
|
||||
/* We are in a diff header, do not jump anywhere. DiffHighlighter sets the foldingIndent for us. */
|
||||
return;
|
||||
for ( ; block.isValid() ; block = block.previous()) {
|
||||
@@ -1119,7 +1117,7 @@ void VcsBaseEditorWidget::jumpToChangeFromDiff(QTextCursor cursor)
|
||||
return;
|
||||
|
||||
Core::IEditor *ed = Core::EditorManager::openEditor(fileName);
|
||||
if (TextEditor::BaseTextEditor *editor = qobject_cast<TextEditor::BaseTextEditor *>(ed))
|
||||
if (BaseTextEditor *editor = qobject_cast<BaseTextEditor *>(ed))
|
||||
editor->gotoLine(chunkStart + lineCount);
|
||||
}
|
||||
|
||||
@@ -1130,7 +1128,7 @@ DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const
|
||||
QTC_ASSERT(hasDiff(), return rc);
|
||||
// Search back for start of chunk.
|
||||
QTextBlock block = cursor.block();
|
||||
if (block.isValid() && TextEditor::BaseTextDocumentLayout::foldingIndent(block) <= 1)
|
||||
if (block.isValid() && BaseTextDocumentLayout::foldingIndent(block) <= 1)
|
||||
/* We are in a diff header, not in a chunk! DiffHighlighter sets the foldingIndent for us. */
|
||||
return rc;
|
||||
|
||||
@@ -1173,7 +1171,7 @@ void VcsBaseEditorWidget::reportCommandFinished(bool ok, int exitCode, const QVa
|
||||
textDocument()->setPlainText(tr("Failed to retrieve data."));
|
||||
}
|
||||
|
||||
const VcsBaseEditorParameters *VcsBaseEditorWidget::findType(const VcsBaseEditorParameters *array,
|
||||
const VcsBaseEditorParameters *VcsBaseEditor::findType(const VcsBaseEditorParameters *array,
|
||||
int arraySize,
|
||||
EditorContentType et)
|
||||
{
|
||||
@@ -1210,7 +1208,7 @@ static QTextCodec *findProjectCodec(const QString &dir)
|
||||
return 0;
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditorWidget::getCodec(const QString &source)
|
||||
QTextCodec *VcsBaseEditor::getCodec(const QString &source)
|
||||
{
|
||||
if (!source.isEmpty()) {
|
||||
// Check file
|
||||
@@ -1226,22 +1224,22 @@ QTextCodec *VcsBaseEditorWidget::getCodec(const QString &source)
|
||||
return sys;
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditorWidget::getCodec(const QString &workingDirectory, const QStringList &files)
|
||||
QTextCodec *VcsBaseEditor::getCodec(const QString &workingDirectory, const QStringList &files)
|
||||
{
|
||||
if (files.empty())
|
||||
return getCodec(workingDirectory);
|
||||
return getCodec(workingDirectory + QLatin1Char('/') + files.front());
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *VcsBaseEditorWidget::getVcsBaseEditor(const Core::IEditor *editor)
|
||||
VcsBaseEditorWidget *VcsBaseEditor::getVcsBaseEditor(const Core::IEditor *editor)
|
||||
{
|
||||
if (const TextEditor::BaseTextEditor *be = qobject_cast<const TextEditor::BaseTextEditor *>(editor))
|
||||
if (const BaseTextEditor *be = qobject_cast<const BaseTextEditor *>(editor))
|
||||
return qobject_cast<VcsBaseEditorWidget *>(be->editorWidget());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Return line number of current editor if it matches.
|
||||
int VcsBaseEditorWidget::lineNumberOfCurrentEditor(const QString ¤tFile)
|
||||
int VcsBaseEditor::lineNumberOfCurrentEditor(const QString ¤tFile)
|
||||
{
|
||||
Core::IEditor *ed = Core::EditorManager::currentEditor();
|
||||
if (!ed)
|
||||
@@ -1251,16 +1249,16 @@ int VcsBaseEditorWidget::lineNumberOfCurrentEditor(const QString ¤tFile)
|
||||
if (!idocument || idocument->filePath() != currentFile)
|
||||
return -1;
|
||||
}
|
||||
const TextEditor::BaseTextEditor *eda = qobject_cast<const TextEditor::BaseTextEditor *>(ed);
|
||||
const BaseTextEditor *eda = qobject_cast<const BaseTextEditor *>(ed);
|
||||
if (!eda)
|
||||
return -1;
|
||||
return eda->currentLine();
|
||||
}
|
||||
|
||||
bool VcsBaseEditorWidget::gotoLineOfEditor(Core::IEditor *e, int lineNumber)
|
||||
bool VcsBaseEditor::gotoLineOfEditor(Core::IEditor *e, int lineNumber)
|
||||
{
|
||||
if (lineNumber >= 0 && e) {
|
||||
if (TextEditor::BaseTextEditor *be = qobject_cast<TextEditor::BaseTextEditor*>(e)) {
|
||||
if (BaseTextEditor *be = qobject_cast<BaseTextEditor*>(e)) {
|
||||
be->gotoLine(lineNumber);
|
||||
return true;
|
||||
}
|
||||
@@ -1270,7 +1268,7 @@ bool VcsBaseEditorWidget::gotoLineOfEditor(Core::IEditor *e, int lineNumber)
|
||||
|
||||
// Return source file or directory string depending on parameters
|
||||
// ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file').
|
||||
QString VcsBaseEditorWidget::getSource(const QString &workingDirectory,
|
||||
QString VcsBaseEditor::getSource(const QString &workingDirectory,
|
||||
const QString &fileName)
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
@@ -1284,7 +1282,7 @@ QString VcsBaseEditorWidget::getSource(const QString &workingDirectory,
|
||||
return rc;
|
||||
}
|
||||
|
||||
QString VcsBaseEditorWidget::getSource(const QString &workingDirectory,
|
||||
QString VcsBaseEditor::getSource(const QString &workingDirectory,
|
||||
const QStringList &fileNames)
|
||||
{
|
||||
return fileNames.size() == 1 ?
|
||||
@@ -1292,7 +1290,7 @@ QString VcsBaseEditorWidget::getSource(const QString &workingDirectory,
|
||||
workingDirectory;
|
||||
}
|
||||
|
||||
QString VcsBaseEditorWidget::getTitleId(const QString &workingDirectory,
|
||||
QString VcsBaseEditor::getTitleId(const QString &workingDirectory,
|
||||
const QStringList &fileNames,
|
||||
const QString &revision)
|
||||
{
|
||||
@@ -1321,7 +1319,7 @@ bool VcsBaseEditorWidget::setConfigurationWidget(VcsBaseEditorParameterWidget *w
|
||||
return false;
|
||||
|
||||
d->m_configurationWidget = w;
|
||||
insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Right, w);
|
||||
insertExtraToolBarWidget(BaseTextEditorWidget::Right, w);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1510,7 +1508,7 @@ void VcsBaseEditorWidget::slotApplyDiffChunk()
|
||||
}
|
||||
|
||||
// Tagging of editors for re-use.
|
||||
QString VcsBaseEditorWidget::editorTag(EditorContentType t,
|
||||
QString VcsBaseEditor::editorTag(EditorContentType t,
|
||||
const QString &workingDirectory,
|
||||
const QStringList &files,
|
||||
const QString &revision)
|
||||
@@ -1532,12 +1530,12 @@ QString VcsBaseEditorWidget::editorTag(EditorContentType t,
|
||||
|
||||
static const char tagPropertyC[] = "_q_VcsBaseEditorTag";
|
||||
|
||||
void VcsBaseEditorWidget::tagEditor(Core::IEditor *e, const QString &tag)
|
||||
void VcsBaseEditor::tagEditor(Core::IEditor *e, const QString &tag)
|
||||
{
|
||||
e->document()->setProperty(tagPropertyC, QVariant(tag));
|
||||
}
|
||||
|
||||
Core::IEditor* VcsBaseEditorWidget::locateEditorByTag(const QString &tag)
|
||||
Core::IEditor *VcsBaseEditor::locateEditorByTag(const QString &tag)
|
||||
{
|
||||
foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) {
|
||||
const QVariant tagPropertyValue = document->property(tagPropertyC);
|
||||
@@ -1555,7 +1553,7 @@ Core::IEditor* VcsBaseEditorWidget::locateEditorByTag(const QString &tag)
|
||||
// Tests need a fully set-up editor/widget combo.
|
||||
void VcsBase::VcsBaseEditorWidget::addDummyEditor()
|
||||
{
|
||||
TextEditor::BaseTextEditor *editor = new VcsBaseEditor(d->m_parameters);
|
||||
BaseTextEditor *editor = new VcsBaseEditor(d->m_parameters);
|
||||
// Pass on signals.
|
||||
connect(this, SIGNAL(describeRequested(QString,QString)),
|
||||
editor, SIGNAL(describeRequested(QString,QString)));
|
||||
|
@@ -37,14 +37,11 @@
|
||||
#include <QSet>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QRegExp;
|
||||
class QTextCodec;
|
||||
class QTextCursor;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core { class IVersionControl; }
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
namespace Internal {
|
||||
@@ -52,8 +49,8 @@ class ChangeTextCursorHandler;
|
||||
class VcsBaseEditorWidgetPrivate;
|
||||
}
|
||||
|
||||
class DiffHighlighter;
|
||||
class BaseAnnotationHighlighter;
|
||||
class VcsBaseEditorWidget;
|
||||
class VcsBaseEditorParameterWidget;
|
||||
class Command;
|
||||
|
||||
@@ -87,12 +84,54 @@ public:
|
||||
QByteArray header;
|
||||
};
|
||||
|
||||
class VcsBaseEditor : public TextEditor::BaseTextEditor
|
||||
class VCSBASE_EXPORT VcsBaseEditor : public TextEditor::BaseTextEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VcsBaseEditor(const VcsBaseEditorParameters *type);
|
||||
|
||||
// Utility to find a parameter set by type in an array.
|
||||
static const VcsBaseEditorParameters *
|
||||
findType(const VcsBaseEditorParameters *array, int arraySize, EditorContentType et);
|
||||
|
||||
// Utility to find the codec for a source (file or directory), querying
|
||||
// the editor manager and the project managers (defaults to system codec).
|
||||
// The codec should be set on editors displaying diff or annotation
|
||||
// output.
|
||||
static QTextCodec *getCodec(const QString &source);
|
||||
static QTextCodec *getCodec(const QString &workingDirectory, const QStringList &files);
|
||||
|
||||
// Utility to return the widget from the IEditor returned by the editor
|
||||
// manager which is a BaseTextEditor.
|
||||
static VcsBaseEditorWidget *getVcsBaseEditor(const Core::IEditor *editor);
|
||||
|
||||
// Utility to find the line number of the current editor. Optionally,
|
||||
// pass in the file name to match it. To be used when jumping to current
|
||||
// line number in a 'annnotate current file' slot, which checks if the
|
||||
// current file originates from the current editor or the project selection.
|
||||
static int lineNumberOfCurrentEditor(const QString ¤tFile = QString());
|
||||
|
||||
//Helper to go to line of editor if it is a text editor
|
||||
static bool gotoLineOfEditor(Core::IEditor *e, int lineNumber);
|
||||
|
||||
// Convenience functions to determine the source to pass on to a diff
|
||||
// editor if one has a call consisting of working directory and file arguments.
|
||||
// ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file').
|
||||
static QString getSource(const QString &workingDirectory, const QString &fileName);
|
||||
static QString getSource(const QString &workingDirectory, const QStringList &fileNames);
|
||||
// Convenience functions to determine an title/id to identify the editor
|
||||
// from the arguments (','-joined arguments or directory) + revision.
|
||||
static QString getTitleId(const QString &workingDirectory,
|
||||
const QStringList &fileNames,
|
||||
const QString &revision = QString());
|
||||
|
||||
/* Tagging editors: Sometimes, an editor should be re-used, for example, when showing
|
||||
* a diff of the same file with different diff-options. In order to be able to find
|
||||
* the editor, they get a 'tag' containing type and parameters (dynamic property string). */
|
||||
static void tagEditor(Core::IEditor *e, const QString &tag);
|
||||
static Core::IEditor* locateEditorByTag(const QString &tag);
|
||||
static QString editorTag(EditorContentType t, const QString &workingDirectory, const QStringList &files,
|
||||
const QString &revision = QString());
|
||||
signals:
|
||||
void describeRequested(const QString &source, const QString &change);
|
||||
void annotateRevisionRequested(const QString &workingDirectory, const QString &file,
|
||||
@@ -165,52 +204,10 @@ public:
|
||||
|
||||
EditorContentType contentType() const;
|
||||
|
||||
// Utility to find a parameter set by type in an array.
|
||||
static const VcsBaseEditorParameters *
|
||||
findType(const VcsBaseEditorParameters *array, int arraySize, EditorContentType et);
|
||||
|
||||
// Utility to find the codec for a source (file or directory), querying
|
||||
// the editor manager and the project managers (defaults to system codec).
|
||||
// The codec should be set on editors displaying diff or annotation
|
||||
// output.
|
||||
static QTextCodec *getCodec(const QString &source);
|
||||
static QTextCodec *getCodec(const QString &workingDirectory, const QStringList &files);
|
||||
|
||||
// Utility to return the widget from the IEditor returned by the editor
|
||||
// manager which is a BaseTextEditor.
|
||||
static VcsBaseEditorWidget *getVcsBaseEditor(const Core::IEditor *editor);
|
||||
|
||||
// Utility to find the line number of the current editor. Optionally,
|
||||
// pass in the file name to match it. To be used when jumping to current
|
||||
// line number in a 'annnotate current file' slot, which checks if the
|
||||
// current file originates from the current editor or the project selection.
|
||||
static int lineNumberOfCurrentEditor(const QString ¤tFile = QString());
|
||||
|
||||
//Helper to go to line of editor if it is a text editor
|
||||
static bool gotoLineOfEditor(Core::IEditor *e, int lineNumber);
|
||||
|
||||
// Convenience functions to determine the source to pass on to a diff
|
||||
// editor if one has a call consisting of working directory and file arguments.
|
||||
// ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file').
|
||||
static QString getSource(const QString &workingDirectory, const QString &fileName);
|
||||
static QString getSource(const QString &workingDirectory, const QStringList &fileNames);
|
||||
// Convenience functions to determine an title/id to identify the editor
|
||||
// from the arguments (','-joined arguments or directory) + revision.
|
||||
static QString getTitleId(const QString &workingDirectory,
|
||||
const QStringList &fileNames,
|
||||
const QString &revision = QString());
|
||||
|
||||
bool setConfigurationWidget(VcsBaseEditorParameterWidget *w);
|
||||
VcsBaseEditorParameterWidget *configurationWidget() const;
|
||||
|
||||
void setCommand(Command *command);
|
||||
/* Tagging editors: Sometimes, an editor should be re-used, for example, when showing
|
||||
* a diff of the same file with different diff-options. In order to be able to find
|
||||
* the editor, they get a 'tag' containing type and parameters (dynamic property string). */
|
||||
static void tagEditor(Core::IEditor *e, const QString &tag);
|
||||
static Core::IEditor* locateEditorByTag(const QString &tag);
|
||||
static QString editorTag(EditorContentType t, const QString &workingDirectory, const QStringList &files,
|
||||
const QString &revision = QString());
|
||||
signals:
|
||||
// These signals also exist in the opaque editable (IEditor) that is
|
||||
// handled by the editor manager for convenience. They are emitted
|
||||
|
Reference in New Issue
Block a user