Commit a202bbee authored by hjk's avatar hjk

Vcs: Use Core::Ids for editor kinds

Change-Id: I9ef5bcc996a05b93dbc80fee179912d8e4fd07c4
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 27f261f0
......@@ -122,17 +122,17 @@ void BazaarClient::view(const QString &source, const QString &id, const QStringL
VcsBaseClient::view(source, id, args);
}
QString BazaarClient::vcsEditorKind(VcsCommand cmd) const
Core::Id BazaarClient::vcsEditorKind(VcsCommand cmd) const
{
switch (cmd) {
case AnnotateCommand:
return QLatin1String(Constants::ANNOTATELOG);
return Constants::ANNOTATELOG;
case DiffCommand:
return QLatin1String(Constants::DIFFLOG);
return Constants::DIFFLOG;
case LogCommand:
return QLatin1String(Constants::FILELOG);
return Constants::FILELOG;
default:
return QString();
return Core::Id();
}
}
......
......@@ -59,7 +59,7 @@ public:
QString findTopLevelForFile(const QFileInfo &file) const;
protected:
QString vcsEditorKind(VcsCommand cmd) const;
Core::Id vcsEditorKind(VcsCommand cmd) const;
QString vcsCommandString(VcsCommand cmd) const;
QStringList revisionSpec(const QString &revision) const;
VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
......
......@@ -248,10 +248,9 @@ void MercurialClient::incoming(const QString &repositoryRoot, const QString &rep
id += repository;
}
const QString kind = QLatin1String(Constants::DIFFLOG);
const QString title = tr("Hg incoming %1").arg(id);
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, repositoryRoot,
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG, title, repositoryRoot,
true, "incoming", id);
VcsBase::Command *cmd = createCommand(repository, editor);
if (!repository.isEmpty() && VcsBase::VcsBasePlugin::isSshPromptConfigured())
......@@ -264,11 +263,10 @@ void MercurialClient::outgoing(const QString &repositoryRoot)
QStringList args;
args << QLatin1String("outgoing") << QLatin1String("-g") << QLatin1String("-p");
const QString kind = QLatin1String(Constants::DIFFLOG);
const QString title = tr("Hg outgoing %1").
arg(QDir::toNativeSeparators(repositoryRoot));
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, repositoryRoot, true,
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG, title, repositoryRoot, true,
"outgoing", repositoryRoot);
VcsBase::Command *cmd = createCommand(repositoryRoot, editor);
......@@ -332,16 +330,18 @@ QString MercurialClient::findTopLevelForFile(const QFileInfo &file) const
VcsBase::VcsBasePlugin::findRepositoryForDirectory(file.absolutePath(), repositoryCheckFile);
}
QString MercurialClient::vcsEditorKind(VcsCommand cmd) const
Core::Id MercurialClient::vcsEditorKind(VcsCommand cmd) const
{
switch (cmd)
{
case AnnotateCommand : return QLatin1String(Constants::ANNOTATELOG);
case DiffCommand : return QLatin1String(Constants::DIFFLOG);
case LogCommand : return QLatin1String(Constants::FILELOG);
default : return QLatin1String("");
switch (cmd) {
case AnnotateCommand:
return Constants::ANNOTATELOG;
case DiffCommand:
return Constants::DIFFLOG;
case LogCommand:
return Constants::FILELOG;
default:
return Core::Id();
}
return QLatin1String("");
}
QStringList MercurialClient::revisionSpec(const QString &revision) const
......
......@@ -80,7 +80,7 @@ public:
QString findTopLevelForFile(const QFileInfo &file) const;
protected:
QString vcsEditorKind(VcsCommand cmd) const;
Core::Id vcsEditorKind(VcsCommand cmd) const;
QStringList revisionSpec(const QString &revision) const;
VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
const QStringList &files,
......
......@@ -333,7 +333,7 @@ void VcsBaseClient::annotate(const QString &workingDir, const QString &file,
const QString vcsCmdString = vcsCommandString(AnnotateCommand);
QStringList args;
args << vcsCmdString << revisionSpec(revision) << extraOptions << file;
const QString kind = vcsEditorKind(AnnotateCommand);
const Core::Id kind = vcsEditorKind(AnnotateCommand);
const QString id = VcsBase::VcsBaseEditorWidget::getSource(workingDir, QStringList(file));
const QString title = vcsEditorTitle(vcsCmdString, id);
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, file);
......@@ -350,7 +350,7 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
const QStringList &extraOptions)
{
const QString vcsCmdString = vcsCommandString(DiffCommand);
const QString kind = vcsEditorKind(DiffCommand);
const Core::Id kind = vcsEditorKind(DiffCommand);
const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDir, files);
const QString title = vcsEditorTitle(vcsCmdString, id);
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
......@@ -376,7 +376,7 @@ void VcsBaseClient::log(const QString &workingDir, const QStringList &files,
bool enableAnnotationContextMenu)
{
const QString vcsCmdString = vcsCommandString(LogCommand);
const QString kind = vcsEditorKind(LogCommand);
const Core::Id kind = vcsEditorKind(LogCommand);
const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDir, files);
const QString title = vcsEditorTitle(vcsCmdString, id);
const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
......@@ -477,7 +477,7 @@ void VcsBaseClient::view(const QString &source, const QString &id,
{
QStringList args;
args << extraOptions << revisionSpec(id);
const QString kind = vcsEditorKind(DiffCommand);
const Core::Id kind = vcsEditorKind(DiffCommand);
const QString title = vcsEditorTitle(vcsCommandString(LogCommand), id);
VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source,
......@@ -552,7 +552,7 @@ QString VcsBaseClient::vcsEditorTitle(const QString &vcsCmd, const QString &sour
QFileInfo(sourceId).fileName();
}
VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(const QString &kind, QString title,
VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(Core::Id kind, QString title,
const QString &source, bool setSourceCodec,
const char *registerDynamicProperty,
const QString &dynamicPropertyValue) const
......@@ -566,7 +566,7 @@ VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(const QString &kind
baseEditor = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
QTC_ASSERT(baseEditor, return 0);
} else {
outputEditor = Core::EditorManager::openEditorWithContents(Core::Id::fromString(kind), &title, progressMsg);
outputEditor = Core::EditorManager::openEditorWithContents(kind, &title, progressMsg);
outputEditor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
baseEditor = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
connect(baseEditor, SIGNAL(annotateRevisionRequested(QString,QString,int)),
......
......@@ -31,6 +31,7 @@
#define VCSBASECLIENT_H
#include "vcsbase_global.h"
#include <coreplugin/id.h>
#include <QObject>
#include <QStringList>
......@@ -148,7 +149,7 @@ protected:
StatusCommand
};
virtual QString vcsCommandString(VcsCommand cmd) const;
virtual QString vcsEditorKind(VcsCommand cmd) const = 0;
virtual Core::Id vcsEditorKind(VcsCommand cmd) const = 0;
virtual QStringList revisionSpec(const QString &revision) const = 0;
virtual VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
......@@ -170,7 +171,7 @@ protected:
const QStringList &args,
unsigned flags = 0,
QTextCodec *outputCodec = 0);
VcsBase::VcsBaseEditorWidget *createVcsEditor(const QString &kind, QString title,
VcsBase::VcsBaseEditorWidget *createVcsEditor(Core::Id kind, QString title,
const QString &source, bool setSourceCodec,
const char *registerDynamicProperty,
const QString &dynamicPropertyValue) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment