Commit cacdc6c7 authored by Tobias Hunger's avatar Tobias Hunger

Add display name to VCS plugin structs

Reviewed-by: Friedemann Kleint
parent a22e64a0
......@@ -37,7 +37,8 @@ const char * const CVS_SUBMIT_MIMETYPE = "application/vnd.nokia.text.cvs.submit"
const char * const CVSEDITOR = "CVS Editor";
const char * const CVSEDITOR_KIND = "CVS Editor";
const char * const CVSCOMMITEDITOR = "CVS Commit Editor";
const char * const CVSCOMMITEDITOR_KIND = "CVS Commit Editor";
const char * const CVSCOMMITEDITOR_ID = "CVS Commit Editor";
const char * const CVSCOMMITEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "CVS Commit Editor");
const char * const SUBMIT_CURRENT = "CVS.SubmitCurrentLog";
const char * const DIFF_SELECTED = "CVS.DiffSelectedFilesInLog";
enum { debug = 0 };
......
......@@ -102,22 +102,26 @@ static const char * const CMD_ID_SEPARATOR4 = "CVS.Separator4";
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
"CVS Command Log Editor", // kind
"CVS Command Log Editor", // id
QT_TRANSLATE_NOOP("VCS", "CVS Command Log Editor"), // display name
"CVS Command Log Editor", // context
"application/vnd.nokia.text.scs_cvs_commandlog",
"scslog"},
{ VCSBase::LogOutput,
"CVS File Log Editor", // kind
"CVS File Log Editor", // id
QT_TRANSLATE_NOOP("VCS", "CVS File Log Editor"), // display name
"CVS File Log Editor", // context
"application/vnd.nokia.text.scs_cvs_filelog",
"scsfilelog"},
{ VCSBase::AnnotateOutput,
"CVS Annotation Editor", // kind
"CVS Annotation Editor", // id
QT_TRANSLATE_NOOP("VCS", "CVS Annotation Editor"), // display name
"CVS Annotation Editor", // context
"application/vnd.nokia.text.scs_cvs_annotation",
"scsannotate"},
{ VCSBase::DiffOutput,
"CVS Diff Editor", // kind
"CVS Diff Editor", // id
QT_TRANSLATE_NOOP("VCS", "CVS Diff Editor"), // display name
"CVS Diff Editor", // context
"text/x-patch","diff"}
};
......@@ -146,7 +150,7 @@ Core::IEditor* locateEditor(const char *property, const QString &entry)
CVSPlugin *CVSPlugin::m_cvsPluginInstance = 0;
CVSPlugin::CVSPlugin() :
VCSBase::VCSBasePlugin(QLatin1String(CVS::Constants::CVSCOMMITEDITOR_KIND)),
VCSBase::VCSBasePlugin(QLatin1String(CVS::Constants::CVSCOMMITEDITOR_ID)),
m_addAction(0),
m_deleteAction(0),
m_revertAction(0),
......@@ -189,7 +193,8 @@ bool CVSPlugin::isCommitEditorOpen() const
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
CVS::Constants::CVS_SUBMIT_MIMETYPE,
CVS::Constants::CVSCOMMITEDITOR_KIND,
CVS::Constants::CVSCOMMITEDITOR_ID,
CVS::Constants::CVSCOMMITEDITOR_DISPLAY_NAME,
CVS::Constants::CVSCOMMITEDITOR
};
......@@ -478,7 +483,7 @@ void CVSPlugin::cvsDiff(const QString &workingDir, const QStringList &files)
CVSSubmitEditor *CVSPlugin::openCVSSubmitEditor(const QString &fileName)
{
Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::CVSCOMMITEDITOR_KIND));
Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::CVSCOMMITEDITOR_ID));
CVSSubmitEditor *submitEditor = qobject_cast<CVSSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, /**/);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
......
......@@ -152,7 +152,7 @@ QString GitClient::findRepositoryForDirectory(const QString &dir)
* existing instance and to reuse it (in case, say, 'git diff foo' is
* already open). */
VCSBase::VCSBaseEditor
*GitClient::createVCSEditor(const QString &kind,
*GitClient::createVCSEditor(const QString &id,
QString title,
// Source file or directory
const QString &source,
......@@ -170,7 +170,7 @@ VCSBase::VCSBaseEditor
QTC_ASSERT(rc, return 0);
} else {
// Create new, set wait message, set up with source and codec
outputEditor = m_core->editorManager()->openEditorWithContents(kind, &title, m_msgWait);
outputEditor = m_core->editorManager()->openEditorWithContents(id, &title, m_msgWait);
outputEditor->file()->setProperty(registerDynamicProperty, dynamicPropertyValue);
rc = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor);
connect(rc, SIGNAL(annotateRevisionRequested(QString,QString,int)),
......@@ -194,10 +194,10 @@ void GitClient::diff(const QString &workingDirectory,
qDebug() << "diff" << workingDirectory << unstagedFileNames << stagedFileNames;
const QString binary = QLatin1String(Constants::GIT_BINARY);
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID);
const QString title = tr("Git Diff");
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, workingDirectory, true, "originalFileName", workingDirectory);
VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, workingDirectory, true, "originalFileName", workingDirectory);
editor->setDiffBaseDirectory(workingDirectory);
// Create a batch of 2 commands to be run after each other in case
......@@ -241,10 +241,10 @@ void GitClient::diff(const QString &workingDirectory,
if (!fileName.isEmpty())
arguments << diffArgs << QLatin1String("--") << fileName;
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID);
const QString title = tr("Git Diff %1").arg(fileName);
const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileName);
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "originalFileName", sourceFile);
VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, true, "originalFileName", sourceFile);
executeGit(workingDirectory, arguments, editor);
}
......@@ -277,9 +277,9 @@ void GitClient::log(const QString &workingDirectory, const QStringList &fileName
const QString msgArg = fileNames.empty() ? workingDirectory :
fileNames.join(QString(", "));
const QString title = tr("Git Log %1").arg(msgArg);
const QString kind = QLatin1String(Git::Constants::GIT_LOG_EDITOR_KIND);
const QString editorId = QLatin1String(Git::Constants::GIT_LOG_EDITOR_ID);
const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileNames);
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, false, "logFileName", sourceFile);
VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, false, "logFileName", sourceFile);
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
executeGit(workingDirectory, arguments, editor);
}
......@@ -292,8 +292,8 @@ void GitClient::show(const QString &source, const QString &id)
arguments << QLatin1String("show") << QLatin1String(noColorOption) << id;
const QString title = tr("Git Show %1").arg(id);
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, source, true, "show", id);
const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID);
VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, source, true, "show", id);
const QFileInfo sourceFi(source);
const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath();
......@@ -325,12 +325,12 @@ void GitClient::blame(const QString &workingDirectory,
arguments << QLatin1String("--") << fileName;
if (!revision.isEmpty())
arguments << revision;
const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND);
const QString editorId = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_ID);
const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDirectory, QStringList(fileName), revision);
const QString title = tr("Git Blame %1").arg(id);
const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileName);
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "blameFileName", id);
VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, true, "blameFileName", id);
executeGit(workingDirectory, arguments, editor, false, GitCommand::NoReport, lineNumber);
}
......
......@@ -30,20 +30,27 @@
#ifndef GIT_CONSTANTS_H
#define GIT_CONSTANTS_H
#include <QtCore/QtGlobal>
namespace Git {
namespace Constants {
const char * const GIT_COMMAND_LOG_EDITOR_KIND = "Git Command Log Editor";
const char * const GIT_COMMAND_LOG_EDITOR_ID = "Git Command Log Editor";
const char * const GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Git Command Log Editor");
const char * const C_GIT_COMMAND_LOG_EDITOR = "Git Command Log Editor";
const char * const GIT_LOG_EDITOR_KIND = "Git File Log Editor";
const char * const GIT_LOG_EDITOR_ID = "Git File Log Editor";
const char * const GIT_LOG_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Git File Log Editor");
const char * const C_GIT_LOG_EDITOR = "Git File Log Editor";
const char * const GIT_BLAME_EDITOR_KIND = "Git Annotation Editor";
const char * const GIT_BLAME_EDITOR_ID = "Git Annotation Editor";
const char * const GIT_BLAME_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Git Annotation Editor");
const char * const C_GIT_BLAME_EDITOR = "Git Annotation Editor";
const char * const GIT_DIFF_EDITOR_KIND = "Git Diff Editor";
const char * const GIT_DIFF_EDITOR_ID = "Git Diff Editor";
const char * const GIT_DIFF_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Git Diff Editor");
const char * const C_GIT_DIFF_EDITOR = "Git Diff Editor";
const char * const C_GITSUBMITEDITOR = "Git Submit Editor";
const char * const GITSUBMITEDITOR_KIND = "Git Submit Editor";
const char * const GITSUBMITEDITOR_ID = "Git Submit Editor";
const char * const GITSUBMITEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Git Submit Editor");
const char * const SUBMIT_CURRENT = "Git.SubmitCurrentLog";
const char * const DIFF_SELECTED = "Git.DiffSelectedFilesInLog";
const char * const SUBMIT_MIMETYPE = "application/vnd.nokia.text.git.submit";
......
......@@ -71,22 +71,26 @@
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
Git::Constants::GIT_COMMAND_LOG_EDITOR_KIND,
Git::Constants::GIT_COMMAND_LOG_EDITOR_ID,
Git::Constants::GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_COMMAND_LOG_EDITOR,
"application/vnd.nokia.text.scs_git_commandlog",
"gitlog"},
{ VCSBase::LogOutput,
Git::Constants::GIT_LOG_EDITOR_KIND,
Git::Constants::GIT_LOG_EDITOR_ID,
Git::Constants::GIT_LOG_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_LOG_EDITOR,
"application/vnd.nokia.text.scs_git_filelog",
"gitfilelog"},
{ VCSBase::AnnotateOutput,
Git::Constants::GIT_BLAME_EDITOR_KIND,
Git::Constants::GIT_BLAME_EDITOR_ID,
Git::Constants::GIT_BLAME_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_BLAME_EDITOR,
"application/vnd.nokia.text.scs_git_annotation",
"gitsannotate"},
{ VCSBase::DiffOutput,
Git::Constants::GIT_DIFF_EDITOR_KIND,
Git::Constants::GIT_DIFF_EDITOR_ID,
Git::Constants::GIT_DIFF_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_DIFF_EDITOR,
"text/x-patch","diff"}
};
......@@ -106,7 +110,7 @@ using namespace Git::Internal;
GitPlugin *GitPlugin::m_instance = 0;
GitPlugin::GitPlugin() :
VCSBase::VCSBasePlugin(QLatin1String(Git::Constants::GITSUBMITEDITOR_KIND)),
VCSBase::VCSBasePlugin(QLatin1String(Git::Constants::GITSUBMITEDITOR_ID)),
m_core(0),
m_diffAction(0),
m_diffProjectAction(0),
......@@ -166,7 +170,8 @@ GitPlugin *GitPlugin::instance()
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Git::Constants::SUBMIT_MIMETYPE,
Git::Constants::GITSUBMITEDITOR_KIND,
Git::Constants::GITSUBMITEDITOR_ID,
Git::Constants::GITSUBMITEDITOR_DISPLAY_NAME,
Git::Constants::C_GITSUBMITEDITOR
};
......@@ -518,7 +523,7 @@ void GitPlugin::startCommit()
Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd)
{
Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, QLatin1String(Constants::GITSUBMITEDITOR_KIND));
Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, QLatin1String(Constants::GITSUBMITEDITOR_ID));
if (Git::Constants::debug)
qDebug() << Q_FUNC_INFO << fileName << editor;
m_core->editorManager()->ensureEditorManagerVisible();
......
......@@ -54,24 +54,33 @@ const char * const CHANGEIDEXACT40 = "[a-f0-9]{40,40}";
const char * const DIFFIDENTIFIER = "^[-+]{3,3} [ab]{1,1}.*"; // match e.g. +++ b/filename
//BaseEditorParameters
const char * const COMMANDLOG_ID = "Mercurial Command Log Editor";
const char * const COMMANDLOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial Command Log Editor");
const char * const COMMANDLOG = "Mercurial Command Log Editor";
const char * const COMMANDAPP = "application/vnd.nokia.text.scs_mercurial_commandlog";
const char * const COMMANDEXT = "vcsMercurialCommand";
const char * const FILELOG_ID = "Mercurial File Log Editor";
const char * const FILELOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial File Log Editor");
const char * const FILELOG = "Mercurial File Log Editor";
const char * const LOGAPP = "application/vnd.nokia.text.scs_mercurial_log";
const char * const LOGEXT = "vcsMercurialLog";
const char * const ANNOTATELOG_ID = "Mercurial Annotation Editor";
const char * const ANNOTATELOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial Annotation Editor");
const char * const ANNOTATELOG = "Mercurial Annotation Editor";
const char * const ANNOTATEAPP = "application/vnd.nokia.text.scs_mercurial_annotatelog";
const char * const ANNOTATEEXT = "vcsMercurialAnnotate";
const char * const DIFFLOG_ID = "Mercurial Diff Editor";
const char * const DIFFLOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial Diff Editor");
const char * const DIFFLOG = "Mercurial Diff Editor";
const char * const DIFFAPP = "text/x-patch";
const char * const DIFFEXT = "diff";
//SubmitEditorParameters
const char * const COMMITKIND = "Mercurial Commit Log Editor";
const char * const COMMIT_ID = "Mercurial Commit Log Editor";
const char * const COMMIT_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial Commit Log Editor");
const char * const COMMITMIMETYPE = "application/vnd.nokia.text.scs_mercurial_commitlog";
//menu items
......
......@@ -74,25 +74,29 @@ using namespace Mercurial;
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput, //type
Constants::COMMANDLOG, // kind
Constants::COMMANDLOG_ID, // id
Constants::COMMANDLOG_DISPLAY_NAME, // display name
Constants::COMMANDLOG, // context
Constants::COMMANDAPP, // mime type
Constants::COMMANDEXT}, //extension
{ VCSBase::LogOutput,
Constants::FILELOG,
Constants::FILELOG_ID,
Constants::FILELOG_DISPLAY_NAME,
Constants::FILELOG,
Constants::LOGAPP,
Constants::LOGEXT},
{ VCSBase::AnnotateOutput,
Constants::ANNOTATELOG,
Constants::ANNOTATELOG_ID,
Constants::ANNOTATELOG_DISPLAY_NAME,
Constants::ANNOTATELOG,
Constants::ANNOTATEAPP,
Constants::ANNOTATEEXT},
{ VCSBase::DiffOutput,
Constants::DIFFLOG,
Constants::DIFFLOG_ID,
Constants::DIFFLOG_DISPLAY_NAME,
Constants::DIFFLOG,
Constants::DIFFAPP,
Constants::DIFFEXT}
......@@ -100,8 +104,9 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
static const VCSBase::VCSBaseSubmitEditorParameters submitEditorParameters = {
Constants::COMMITMIMETYPE,
Constants::COMMITKIND,
Constants::COMMITKIND
Constants::COMMIT_ID,
Constants::COMMIT_DISPLAY_NAME,
Constants::COMMIT_ID
};
// Utility to find a parameter set by type
......@@ -115,7 +120,7 @@ static inline const VCSBase::VCSBaseEditorParameters *findType(int ie)
MercurialPlugin *MercurialPlugin::m_instance = 0;
MercurialPlugin::MercurialPlugin() :
VCSBase::VCSBasePlugin(QLatin1String(Constants::COMMITKIND)),
VCSBase::VCSBasePlugin(QLatin1String(Constants::COMMIT_ID)),
optionsPage(0),
m_client(0),
changeLog(0),
......@@ -475,7 +480,7 @@ void MercurialPlugin::outgoing()
void MercurialPlugin::createSubmitEditorActions()
{
QList<int> context = QList<int>()<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::COMMITKIND));
QList<int> context = QList<int>()<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::COMMIT_ID));
Core::Command *command;
editorCommit = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this);
......@@ -529,7 +534,7 @@ void MercurialPlugin::showCommitWidget(const QList<QPair<QString, QString> > &st
}
Core::IEditor *editor = core->editorManager()->openEditor(changeLog->fileName(),
QLatin1String(Constants::COMMITKIND));
QLatin1String(Constants::COMMIT_ID));
if (!editor) {
outputWindow->appendError(tr("Unable to create an editor for the commit."));
return;
......
......@@ -30,24 +30,31 @@
#ifndef PERFORCE_CONSTANTS_H
#define PERFORCE_CONSTANTS_H
#include <QtCore/QtGlobal>
namespace Perforce {
namespace Constants {
const char * const PERFORCEEDITOR_CONTEXT = "Perforce Editor";
const char * const PERFORCE_SUBMIT_EDITOR_ID = "Perforce.SubmitEditor";
const char * const PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce.SubmitEditor");
const char * const PERFORCESUBMITEDITOR_CONTEXT = "Perforce Submit Editor";
const char * const PERFORCE_COMMANDLOG_EDITOR_ID = "Perfoirce.CommandLogEditor";
const char * const PERFORCE_COMMANDLOG_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce CommandLog Editor");
const char * const PERFORCE_COMMANDLOG_EDITOR_CONTEXT = "Perforce Command Log Editor";
const char * const PERFORCE_LOG_EDITOR_ID = "Perforce.LogEditor";
const char * const PERFORCE_LOG_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce Log Editor");
const char * const PERFORCE_LOG_EDITOR_CONTEXT = "Perforce Log Editor";
const char * const PERFORCE_DIFF_EDITOR_ID = "Perforce.DiffEditor";
const char * const PERFORCE_DIFF_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce Diff Editor");
const char * const PERFORCE_DIFF_EDITOR_CONTEXT = "Perforce Diff Editor";
const char * const PERFORCE_ANNOTATION_EDITOR_ID = "Perforce.AnnotationEditor";
const char * const PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce Annotation Editor");
const char * const PERFORCE_ANNOTATION_EDITOR_CONTEXT = "Perforce Annotation Editor";
const char * const SUBMIT_CURRENT = "Perforce.SubmitCurrentLog";
......
......@@ -72,21 +72,25 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_ID,
Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_CONTEXT,
"application/vnd.nokia.text.scs_commandlog",
"scslog"},
{ VCSBase::LogOutput,
Perforce::Constants::PERFORCE_LOG_EDITOR_ID,
Perforce::Constants::PERFORCE_LOG_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCE_LOG_EDITOR_CONTEXT,
"application/vnd.nokia.text.scs_filelog",
"scsfilelog"},
{ VCSBase::AnnotateOutput,
Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_ID,
Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_CONTEXT,
"application/vnd.nokia.text.scs_annotation",
"scsannotate"},
{ VCSBase::DiffOutput,
Perforce::Constants::PERFORCE_DIFF_EDITOR_ID,
Perforce::Constants::PERFORCE_DIFF_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCE_DIFF_EDITOR_CONTEXT,
"text/x-patch","diff"}
};
......@@ -205,6 +209,7 @@ PerforcePlugin::PerforcePlugin() :
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Perforce::Constants::SUBMIT_MIMETYPE,
Perforce::Constants::PERFORCE_SUBMIT_EDITOR_ID,
Perforce::Constants::PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCESUBMITEDITOR_CONTEXT
};
......
......@@ -30,14 +30,18 @@
#ifndef SUBVERSION_CONSTANTS_H
#define SUBVERSION_CONSTANTS_H
#include <QtCore/QtGlobal>
namespace Subversion {
namespace Constants {
const char * const SUBVERSION_SUBMIT_MIMETYPE = "application/vnd.nokia.text.subversion.submit";
const char * const SUBVERSIONEDITOR = "Subversion Editor";
const char * const SUBVERSIONEDITOR_KIND = "Subversion Editor";
const char * const SUBVERSIONEDITOR_ID = "Subversion Editor";
const char * const SUBVERSIONEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Subversion Editor");
const char * const SUBVERSIONCOMMITEDITOR = "Subversion Commit Editor";
const char * const SUBVERSIONCOMMITEDITOR_KIND = "Subversion Commit Editor";
const char * const SUBVERSIONCOMMITEDITOR_ID = "Subversion Commit Editor";
const char * const SUBVERSIONCOMMITEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Subversion Commit Editor");
const char * const SUBMIT_CURRENT = "Subversion.SubmitCurrentLog";
const char * const DIFF_SELECTED = "Subversion.DiffSelectedFilesInLog";
enum { debug = 0 };
......
......@@ -97,22 +97,26 @@ static const char *nonInteractiveOptionC = "--non-interactive";
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
"Subversion Command Log Editor", // kind
"Subversion Command Log Editor", // id
QT_TRANSLATE_NOOP("VCS", "Subversion Command Log Editor"), // display name
"Subversion Command Log Editor", // context
"application/vnd.nokia.text.scs_svn_commandlog",
"scslog"},
{ VCSBase::LogOutput,
"Subversion File Log Editor", // kind
"Subversion File Log Editor", // id
QT_TRANSLATE_NOOP("VCS", "Subversion File Log Editor"), // display_name
"Subversion File Log Editor", // context
"application/vnd.nokia.text.scs_svn_filelog",
"scsfilelog"},
{ VCSBase::AnnotateOutput,
"Subversion Annotation Editor", // kind
"Subversion Annotation Editor", // id
QT_TRANSLATE_NOOP("VCS", "Subversion Annotation Editor"), // display_name
"Subversion Annotation Editor", // context
"application/vnd.nokia.text.scs_svn_annotation",
"scsannotate"},
{ VCSBase::DiffOutput,
"Subversion Diff Editor", // kind
"Subversion Diff Editor", // id
QT_TRANSLATE_NOOP("VCS", "Subversion Diff Editor"), // display_name
"Subversion Diff Editor", // context
"text/x-patch","diff"}
};
......@@ -175,7 +179,7 @@ static inline QStringList svnDirectories()
SubversionPlugin *SubversionPlugin::m_subversionPluginInstance = 0;
SubversionPlugin::SubversionPlugin() :
VCSBase::VCSBasePlugin(QLatin1String(Subversion::Constants::SUBVERSIONCOMMITEDITOR_KIND)),
VCSBase::VCSBasePlugin(QLatin1String(Subversion::Constants::SUBVERSIONCOMMITEDITOR_ID)),
m_svnDirectories(svnDirectories()),
m_addAction(0),
m_deleteAction(0),
......@@ -221,7 +225,8 @@ bool SubversionPlugin::isCommitEditorOpen() const
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Subversion::Constants::SUBVERSION_SUBMIT_MIMETYPE,
Subversion::Constants::SUBVERSIONCOMMITEDITOR_KIND,
Subversion::Constants::SUBVERSIONCOMMITEDITOR_ID,
Subversion::Constants::SUBVERSIONCOMMITEDITOR_DISPLAY_NAME,
Subversion::Constants::SUBVERSIONCOMMITEDITOR
};
......@@ -506,7 +511,7 @@ void SubversionPlugin::svnDiff(const QString &workingDir, const QStringList &fil
SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName)
{
Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_KIND));
Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_ID));
SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, /**/);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
......
......@@ -35,6 +35,8 @@
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h>
#include <QtCore/QCoreApplication>
namespace VCSBase {
struct BaseVCSEditorFactoryPrivate
......@@ -43,6 +45,7 @@ struct BaseVCSEditorFactoryPrivate
const VCSBaseEditorParameters *m_type;
const QString m_id;
QString m_displayName;
const QStringList m_mimeTypes;
TextEditor::TextEditorActionHandler *m_editorHandler;
};
......@@ -58,6 +61,7 @@ BaseVCSEditorFactoryPrivate::BaseVCSEditorFactoryPrivate(const VCSBaseEditorPara
BaseVCSEditorFactory::BaseVCSEditorFactory(const VCSBaseEditorParameters *t)
: m_d(new BaseVCSEditorFactoryPrivate(t))
{
m_d->m_displayName = QCoreApplication::translate("VCS", t->displayName);
}
BaseVCSEditorFactory::~BaseVCSEditorFactory()
......@@ -77,7 +81,7 @@ QString BaseVCSEditorFactory::id() const
QString BaseVCSEditorFactory::displayName() const
{
return tr("Base VCS Editor", "VCSBase BaseVCSEditorFactory display name.");
return m_d->m_displayName;
}
Core::IFile *BaseVCSEditorFactory::open(const QString &fileName)
......
......@@ -82,6 +82,7 @@ public:
bool duplicateSupported() const { return false; }
Core::IEditor *duplicate(QWidget * /*parent*/) { return 0; }
QString id() const { return m_id; }
QString displayName() const { return m_displayName; }
bool isTemporary() const { return true; }
......@@ -91,13 +92,15 @@ signals:
private:
QString m_id;
QString m_displayName;
QList<int> m_context;
};
VCSBaseEditorEditable::VCSBaseEditorEditable(VCSBaseEditor *editor,
const VCSBaseEditorParameters *type) :
BaseTextEditorEditable(editor),
m_id(type->id)
m_id(type->id),
m_displayName(QCoreApplication::translate("VCS", type->displayName))
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(QLatin1String(type->context))
......
......@@ -74,8 +74,8 @@ enum EditorContentType {
// VCS commands with redirection.
struct VCSBASE_EXPORT VCSBaseEditorParameters {
EditorContentType type;
QString id;
QString displayName;
const char *id;
const char *displayName;
const char *context;
const char *mimeType;
const char *extension;
......
......@@ -308,6 +308,8 @@ Core::IFile *VCSBaseSubmitEditor::file()
QString VCSBaseSubmitEditor::displayName() const
{
if (m_d->m_displayName.isEmpty())
m_d->m_displayName = QCoreApplication::translate("VCS", m_d->m_parameters->displayName);
return m_d->m_displayName;
}
......
......@@ -56,8 +56,8 @@ struct VCSBaseSubmitEditorPrivate;
/* Utility struct to parametrize a VCSBaseSubmitEditor. */
struct VCSBASE_EXPORT VCSBaseSubmitEditorParameters {
const char *mimeType;
QString id;
QString displayName;
const char *id;
const char *displayName;
const char *context;
};
......
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