Commit f08ff20e authored by hjk's avatar hjk

Vcs: Move some static functions from *EditorWidget to *Editor

Change-Id: Ic7c0a3bca982f5728e28ff9f3e1e054b5a902ea9
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 96598dc5
......@@ -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));
......