forked from qt-creator/qt-creator
VCS: Consolidate submit editor actions setup
Change-Id: I36754779b6a9aa35de705b368daf8c2a1de058c6 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
f1f506b479
commit
767137157e
@@ -74,8 +74,6 @@ using namespace VcsBase;
|
||||
namespace Perforce {
|
||||
namespace Internal {
|
||||
|
||||
const char SUBMIT_CURRENT[] = "Perforce.SubmitCurrentLog";
|
||||
const char DIFF_SELECTED[] = "Perforce.DiffSelectedFilesInLog";
|
||||
const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.p4.submit";
|
||||
|
||||
const char PERFORCE_CONTEXT[] = "Perforce Context";
|
||||
@@ -213,8 +211,6 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
mtools->addMenu(perforceContainer);
|
||||
m_menuAction = perforceContainer->menu()->menuAction();
|
||||
|
||||
Context perforcesubmitcontext(PERFORCE_SUBMIT_EDITOR_ID);
|
||||
|
||||
Command *command;
|
||||
|
||||
m_diffFileAction = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
|
||||
@@ -378,21 +374,6 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
|
||||
command = ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, context);
|
||||
connect(m_filelogAction, &QAction::triggered, this, &PerforcePlugin::filelogFile);
|
||||
perforceContainer->addAction(command);
|
||||
|
||||
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Submit"), this);
|
||||
command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, perforcesubmitcontext);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_submitCurrentLogAction, &QAction::triggered, this, &PerforcePlugin::submitCurrentLog);
|
||||
|
||||
m_diffSelectedFiles = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||
ActionManager::registerAction(m_diffSelectedFiles, DIFF_SELECTED, perforcesubmitcontext);
|
||||
|
||||
m_undoAction = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, perforcesubmitcontext);
|
||||
|
||||
m_redoAction = new QAction(tr("&Redo"), this);
|
||||
ActionManager::registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -623,7 +604,6 @@ IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const
|
||||
PerforceSubmitEditor *submitEditor = static_cast<PerforceSubmitEditor*>(editor);
|
||||
setSubmitEditor(submitEditor);
|
||||
submitEditor->restrictToProjectFiles(depotFileNames);
|
||||
submitEditor->registerActions(m_undoAction, m_redoAction, m_submitCurrentLogAction, m_diffSelectedFiles);
|
||||
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &PerforcePlugin::slotSubmitDiff);
|
||||
submitEditor->setCheckScriptWorkingDirectory(m_settings.topLevel());
|
||||
@@ -1295,7 +1275,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
|
||||
showOutputInEditor(tr("p4 describe %1").arg(n), result.stdOut, VcsBase::DiffOutput, source, codec);
|
||||
}
|
||||
|
||||
void PerforcePlugin::submitCurrentLog()
|
||||
void PerforcePlugin::commitFromEditor()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
QTC_ASSERT(submitEditor(), return);
|
||||
|
||||
Reference in New Issue
Block a user