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
@@ -104,9 +104,6 @@ const char COMMIT[] = "Bazaar.Action.Commit";
|
||||
const char UNCOMMIT[] = "Bazaar.Action.UnCommit";
|
||||
const char CREATE_REPOSITORY[] = "Bazaar.Action.CreateRepository";
|
||||
|
||||
// Submit editor actions
|
||||
const char DIFFEDITOR[] = "Bazaar.Action.Editor.Diff";
|
||||
|
||||
const VcsBaseEditorParameters editorParameters[] = {
|
||||
{ LogOutput, // type
|
||||
Constants::FILELOG_ID, // id
|
||||
@@ -175,8 +172,6 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
|
||||
|
||||
createMenu(context);
|
||||
|
||||
createSubmitEditorActions();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -486,26 +481,6 @@ void BazaarPlugin::update()
|
||||
m_client->update(state.topLevel(), revertUi.revisionLineEdit->text());
|
||||
}
|
||||
|
||||
void BazaarPlugin::createSubmitEditorActions()
|
||||
{
|
||||
Context context(COMMIT_ID);
|
||||
Command *command;
|
||||
|
||||
m_editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
|
||||
command = ActionManager::registerAction(m_editorCommit, COMMIT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_editorCommit, &QAction::triggered, this, &BazaarPlugin::commitFromEditor);
|
||||
|
||||
m_editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||
ActionManager::registerAction(m_editorDiff, DIFFEDITOR, context);
|
||||
|
||||
m_editorUndo = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_editorUndo, Core::Constants::UNDO, context);
|
||||
|
||||
m_editorRedo = new QAction(tr("&Redo"), this);
|
||||
ActionManager::registerAction(m_editorRedo, Core::Constants::REDO, context);
|
||||
}
|
||||
|
||||
void BazaarPlugin::commit()
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
@@ -559,7 +534,6 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &stat
|
||||
}
|
||||
setSubmitEditor(commitEditor);
|
||||
|
||||
commitEditor->registerActions(m_editorUndo, m_editorRedo, m_editorCommit, m_editorDiff);
|
||||
connect(commitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &BazaarPlugin::diffFromEditorSelected);
|
||||
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
|
||||
|
@@ -96,13 +96,12 @@ private:
|
||||
void update();
|
||||
void commit();
|
||||
void showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status);
|
||||
void commitFromEditor();
|
||||
void commitFromEditor() override;
|
||||
void uncommit();
|
||||
void diffFromEditorSelected(const QStringList &files);
|
||||
|
||||
// Functions
|
||||
void createMenu(const Core::Context &context);
|
||||
void createSubmitEditorActions();
|
||||
void createFileActions(const Core::Context &context);
|
||||
void createDirectoryActions(const Core::Context &context);
|
||||
void createRepositoryActions(const Core::Context &context);
|
||||
@@ -127,11 +126,6 @@ private:
|
||||
Utils::ParameterAction *m_revertFile = nullptr;
|
||||
Utils::ParameterAction *m_statusFile = nullptr;
|
||||
|
||||
// Submit editor actions
|
||||
QAction *m_editorCommit = nullptr;
|
||||
QAction *m_editorDiff = nullptr;
|
||||
QAction *m_editorUndo = nullptr;
|
||||
QAction *m_editorRedo = nullptr;
|
||||
QAction *m_menuAction = nullptr;
|
||||
|
||||
QString m_submitRepository;
|
||||
|
@@ -35,8 +35,6 @@ const char VCS_ID_CLEARCASE[] = "E.ClearCase";
|
||||
const char CLEARCASE_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.clearcase.submit";
|
||||
const char CLEARCASECHECKINEDITOR_ID[] = "ClearCase Check In Editor";
|
||||
const char CLEARCASECHECKINEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "ClearCase Check In Editor");
|
||||
const char CHECKIN_SELECTED[] = "ClearCase.CheckInSelected";
|
||||
const char DIFF_SELECTED[] = "ClearCase.DiffSelected";
|
||||
const char TASK_INDEX[] = "ClearCase.Task.Index";
|
||||
const char KEEP_ACTIVITY[] = "__KEEP__";
|
||||
enum { debug = 0 };
|
||||
|
@@ -567,23 +567,6 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
|
||||
clearcaseMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
// Actions of the submit editor
|
||||
Context clearcasecheckincontext(Constants::CLEARCASECHECKINEDITOR_ID);
|
||||
|
||||
m_checkInSelectedAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Check In"), this);
|
||||
command = ActionManager::registerAction(m_checkInSelectedAction, Constants::CHECKIN_SELECTED, clearcasecheckincontext);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_checkInSelectedAction, &QAction::triggered, this, &ClearCasePlugin::checkInSelected);
|
||||
|
||||
m_checkInDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff Selected Files"), this);
|
||||
ActionManager::registerAction(m_checkInDiffAction , Constants::DIFF_SELECTED, clearcasecheckincontext);
|
||||
|
||||
m_submitUndoAction = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, clearcasecheckincontext);
|
||||
|
||||
m_submitRedoAction = new QAction(tr("&Redo"), this);
|
||||
ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, clearcasecheckincontext);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -745,7 +728,6 @@ ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString
|
||||
EditorManager::openEditor(fileName, Constants::CLEARCASECHECKINEDITOR_ID);
|
||||
ClearCaseSubmitEditor *submitEditor = qobject_cast<ClearCaseSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return 0);
|
||||
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_checkInSelectedAction, m_checkInDiffAction);
|
||||
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &ClearCasePlugin::diffCheckInFiles);
|
||||
submitEditor->setCheckScriptWorkingDirectory(m_checkInView);
|
||||
@@ -1441,7 +1423,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
|
||||
}
|
||||
}
|
||||
|
||||
void ClearCasePlugin::checkInSelected()
|
||||
void ClearCasePlugin::commitFromEditor()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
QTC_ASSERT(submitEditor(), return);
|
||||
|
@@ -210,7 +210,7 @@ private:
|
||||
void historyCurrentFile();
|
||||
void annotateCurrentFile();
|
||||
void viewStatus();
|
||||
void checkInSelected();
|
||||
void commitFromEditor() override;
|
||||
void diffCheckInFiles(const QStringList &);
|
||||
void updateIndex();
|
||||
void updateView();
|
||||
@@ -281,10 +281,6 @@ private:
|
||||
QAction *m_checkInAllAction = nullptr;
|
||||
QAction *m_statusAction = nullptr;
|
||||
|
||||
QAction *m_checkInSelectedAction = nullptr;
|
||||
QAction *m_checkInDiffAction = nullptr;
|
||||
QAction *m_submitUndoAction = nullptr;
|
||||
QAction *m_submitRedoAction = nullptr;
|
||||
QAction *m_menuAction = nullptr;
|
||||
bool m_submitActionTriggered = false;
|
||||
QMutex *m_activityMutex;
|
||||
|
@@ -120,8 +120,6 @@ const char CMD_ID_REPOSITORYUPDATE[] = "CVS.RepositoryUpdate";
|
||||
const char CVS_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.cvs.submit";
|
||||
const char CVSCOMMITEDITOR_ID[] = "CVS Commit Editor";
|
||||
const char CVSCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "CVS Commit Editor");
|
||||
const char SUBMIT_CURRENT[] = "CVS.SubmitCurrentLog";
|
||||
const char DIFF_SELECTED[] = "CVS.DiffSelectedFilesInLog";
|
||||
|
||||
const VcsBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
@@ -410,23 +408,6 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
connect(m_revertRepositoryAction, &QAction::triggered, this, &CvsPlugin::revertAll);
|
||||
cvsMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
// Actions of the submit editor
|
||||
Context cvscommitcontext(CVSCOMMITEDITOR_ID);
|
||||
|
||||
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
|
||||
command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, cvscommitcontext);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_submitCurrentLogAction, &QAction::triggered, this, &CvsPlugin::submitCurrentLog);
|
||||
|
||||
m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||
ActionManager::registerAction(m_submitDiffAction , DIFF_SELECTED, cvscommitcontext);
|
||||
|
||||
m_submitUndoAction = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext);
|
||||
|
||||
m_submitRedoAction = new QAction(tr("&Redo"), this);
|
||||
ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -494,7 +475,6 @@ CvsSubmitEditor *CvsPlugin::openCVSSubmitEditor(const QString &fileName)
|
||||
IEditor *editor = EditorManager::openEditor(fileName, CVSCOMMITEDITOR_ID);
|
||||
CvsSubmitEditor *submitEditor = qobject_cast<CvsSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return 0);
|
||||
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
|
||||
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &CvsPlugin::diffCommitFiles);
|
||||
|
||||
@@ -1107,7 +1087,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
|
||||
return true;
|
||||
}
|
||||
|
||||
void CvsPlugin::submitCurrentLog()
|
||||
void CvsPlugin::commitFromEditor()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
QTC_ASSERT(submitEditor(), return);
|
||||
|
@@ -114,7 +114,7 @@ private:
|
||||
void projectStatus();
|
||||
void updateDirectory();
|
||||
void updateProject();
|
||||
void submitCurrentLog();
|
||||
void commitFromEditor() override;
|
||||
void diffCommitFiles(const QStringList &);
|
||||
void logProject();
|
||||
void logRepository();
|
||||
@@ -188,10 +188,6 @@ private:
|
||||
QAction *m_updateRepositoryAction = nullptr;
|
||||
QAction *m_statusRepositoryAction = nullptr;
|
||||
|
||||
QAction *m_submitCurrentLogAction = nullptr;
|
||||
QAction *m_submitDiffAction = nullptr;
|
||||
QAction *m_submitUndoAction = nullptr;
|
||||
QAction *m_submitRedoAction = nullptr;
|
||||
QAction *m_menuAction = nullptr;
|
||||
bool m_submitActionTriggered = false;
|
||||
|
||||
|
@@ -46,8 +46,6 @@ const char GIT_REBASE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Reba
|
||||
const char GIT_CONTEXT[] = "Git Context";
|
||||
const char GITSUBMITEDITOR_ID[] = "Git Submit Editor";
|
||||
const char GITSUBMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Submit Editor");
|
||||
const char SUBMIT_CURRENT[] = "Git.SubmitCurrentLog";
|
||||
const char DIFF_SELECTED[] = "Git.DiffSelectedFilesInLog";
|
||||
const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.git.submit";
|
||||
const char C_GITEDITORID[] = "Git Editor";
|
||||
|
||||
|
@@ -640,22 +640,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
connect(createRepositoryAction, &QAction::triggered, this, &GitPlugin::createRepository);
|
||||
gitContainer->addAction(createRepositoryCommand);
|
||||
|
||||
// Submit editor
|
||||
Context submitContext(Constants::GITSUBMITEDITOR_ID);
|
||||
m_submitCurrentAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
|
||||
Command *command = ActionManager::registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_submitCurrentAction, &QAction::triggered, this, &GitPlugin::submitCurrentLog);
|
||||
|
||||
m_diffSelectedFilesAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||
ActionManager::registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext);
|
||||
|
||||
m_undoAction = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, submitContext);
|
||||
|
||||
m_redoAction = new QAction(tr("&Redo"), this);
|
||||
ActionManager::registerAction(m_redoAction, Core::Constants::REDO, submitContext);
|
||||
|
||||
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
|
||||
this, &GitPlugin::updateContinueAndAbortCommands);
|
||||
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
|
||||
@@ -1002,9 +986,6 @@ IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &
|
||||
GitSubmitEditor *submitEditor = qobject_cast<GitSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return 0);
|
||||
setSubmitEditor(submitEditor);
|
||||
// The actions are for some reason enabled by the context switching
|
||||
// mechanism. Disable them correctly.
|
||||
submitEditor->registerActions(m_undoAction, m_redoAction, m_submitCurrentAction, m_diffSelectedFilesAction);
|
||||
submitEditor->setCommitData(cd);
|
||||
submitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
|
||||
QString title;
|
||||
@@ -1024,7 +1005,7 @@ IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &
|
||||
return editor;
|
||||
}
|
||||
|
||||
void GitPlugin::submitCurrentLog()
|
||||
void GitPlugin::commitFromEditor()
|
||||
{
|
||||
// Close the submit editor
|
||||
m_submitActionTriggered = true;
|
||||
|
@@ -108,7 +108,7 @@ private slots:
|
||||
private:
|
||||
void diffCurrentFile();
|
||||
void diffCurrentProject();
|
||||
void submitCurrentLog();
|
||||
void commitFromEditor() override;
|
||||
void logFile();
|
||||
void blameFile();
|
||||
void logProject();
|
||||
@@ -186,10 +186,6 @@ private:
|
||||
|
||||
Core::CommandLocator *m_commandLocator = nullptr;
|
||||
|
||||
QAction *m_submitCurrentAction = nullptr;
|
||||
QAction *m_diffSelectedFilesAction = nullptr;
|
||||
QAction *m_undoAction = nullptr;
|
||||
QAction *m_redoAction = nullptr;
|
||||
QAction *m_menuAction = nullptr;
|
||||
QAction *m_repositoryBrowserAction = nullptr;
|
||||
QAction *m_mergeToolAction = nullptr;
|
||||
|
@@ -86,8 +86,5 @@ const char OUTGOING[] = "Mercurial.Action.Outgoing";
|
||||
const char COMMIT[] = "Mercurial.Action.Commit";
|
||||
const char CREATE_REPOSITORY[] = "Mercurial.Action.CreateRepository";
|
||||
|
||||
// Submit editor actions
|
||||
const char DIFFEDITOR[] = "Mercurial.Action.Editor.Diff";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace mercurial
|
||||
|
@@ -145,8 +145,6 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
|
||||
|
||||
createMenu(context);
|
||||
|
||||
createSubmitEditorActions();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -472,25 +470,6 @@ void MercurialPlugin::outgoing()
|
||||
m_client->outgoing(state.topLevel());
|
||||
}
|
||||
|
||||
void MercurialPlugin::createSubmitEditorActions()
|
||||
{
|
||||
Core::Context context(Constants::COMMIT_ID);
|
||||
|
||||
editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
|
||||
Core::Command *command = Core::ActionManager::registerAction(editorCommit, Core::Id(Constants::COMMIT), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
connect(editorCommit, &QAction::triggered, this, &MercurialPlugin::commitFromEditor);
|
||||
|
||||
editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||
Core::ActionManager::registerAction(editorDiff, Core::Id(Constants::DIFFEDITOR), context);
|
||||
|
||||
editorUndo = new QAction(tr("&Undo"), this);
|
||||
Core::ActionManager::registerAction(editorUndo, Core::Id(Core::Constants::UNDO), context);
|
||||
|
||||
editorRedo = new QAction(tr("&Redo"), this);
|
||||
Core::ActionManager::registerAction(editorRedo, Core::Id(Core::Constants::REDO), context);
|
||||
}
|
||||
|
||||
void MercurialPlugin::commit()
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
@@ -538,7 +517,6 @@ void MercurialPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &s
|
||||
CommitEditor *commitEditor = static_cast<CommitEditor *>(editor);
|
||||
setSubmitEditor(commitEditor);
|
||||
|
||||
commitEditor->registerActions(editorUndo, editorRedo, editorCommit, editorDiff);
|
||||
connect(commitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &MercurialPlugin::diffFromEditorSelected);
|
||||
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
|
||||
|
@@ -98,7 +98,7 @@ private:
|
||||
void outgoing();
|
||||
void commit();
|
||||
void showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status);
|
||||
void commitFromEditor();
|
||||
void commitFromEditor() override;
|
||||
void diffFromEditorSelected(const QStringList &files);
|
||||
|
||||
//TODO implement
|
||||
@@ -116,7 +116,6 @@ private:
|
||||
void serve();*/
|
||||
|
||||
void createMenu(const Core::Context &context);
|
||||
void createSubmitEditorActions();
|
||||
void createFileActions(const Core::Context &context);
|
||||
void createDirectoryActions(const Core::Context &context);
|
||||
void createRepositoryActions(const Core::Context &context);
|
||||
@@ -142,11 +141,6 @@ private:
|
||||
Utils::ParameterAction *statusFile = nullptr;
|
||||
|
||||
QAction *m_createRepositoryAction = nullptr;
|
||||
// Submit editor actions
|
||||
QAction *editorCommit = nullptr;
|
||||
QAction *editorDiff = nullptr;
|
||||
QAction *editorUndo = nullptr;
|
||||
QAction *editorRedo = nullptr;
|
||||
QAction *m_menuAction = nullptr;
|
||||
|
||||
QString m_submitRepository;
|
||||
|
@@ -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);
|
||||
|
@@ -136,7 +136,7 @@ private:
|
||||
void logProject();
|
||||
void logRepository();
|
||||
|
||||
void submitCurrentLog();
|
||||
void commitFromEditor() override;
|
||||
void printPendingChanges();
|
||||
void slotSubmitDiff(const QStringList &files);
|
||||
void setTopLevel(const QString &);
|
||||
@@ -234,14 +234,10 @@ private:
|
||||
QAction *m_filelogAction = nullptr;
|
||||
Utils::ParameterAction *m_logProjectAction = nullptr;
|
||||
QAction *m_logRepositoryAction = nullptr;
|
||||
QAction *m_submitCurrentLogAction = nullptr;
|
||||
QAction *m_updateAllAction = nullptr;
|
||||
bool m_submitActionTriggered = false;
|
||||
QAction *m_diffSelectedFiles = nullptr;
|
||||
QString m_commitMessageFileName;
|
||||
mutable QString m_tempFilePattern;
|
||||
QAction *m_undoAction = nullptr;
|
||||
QAction *m_redoAction = nullptr;
|
||||
QAction *m_menuAction = nullptr;
|
||||
|
||||
static PerforcePlugin *m_instance;
|
||||
|
@@ -49,8 +49,5 @@ const char SUBVERSION_BLAME_EDITOR_ID[] = "Subversion Annotation Editor";
|
||||
const char SUBVERSION_BLAME_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Subversion Annotation Editor");
|
||||
const char SUBVERSION_BLAME_MIMETYPE[] = "text/vnd.qtcreator.svn.annotation";
|
||||
|
||||
const char SUBMIT_CURRENT[] = "Subversion.SubmitCurrentLog";
|
||||
const char DIFF_SELECTED[] = "Subversion.DiffSelectedFilesInLog";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace Subversion
|
||||
|
@@ -386,23 +386,6 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
||||
subversionMenu->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
// Actions of the submit editor
|
||||
Context svncommitcontext(Constants::SUBVERSION_COMMIT_EDITOR_ID);
|
||||
|
||||
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
|
||||
command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, svncommitcontext);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_submitCurrentLogAction, &QAction::triggered, this, &SubversionPlugin::submitCurrentLog);
|
||||
|
||||
m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||
ActionManager::registerAction(m_submitDiffAction , DIFF_SELECTED, svncommitcontext);
|
||||
|
||||
m_submitUndoAction = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, svncommitcontext);
|
||||
|
||||
m_submitRedoAction = new QAction(tr("&Redo"), this);
|
||||
ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -485,7 +468,6 @@ SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QStri
|
||||
SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return 0);
|
||||
setSubmitEditor(submitEditor);
|
||||
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
|
||||
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
this, &SubversionPlugin::diffCommitFiles);
|
||||
submitEditor->setCheckScriptWorkingDirectory(m_commitRepository);
|
||||
@@ -867,7 +849,7 @@ void SubversionPlugin::slotDescribe()
|
||||
describe(state.topLevel(), QString::number(revision));
|
||||
}
|
||||
|
||||
void SubversionPlugin::submitCurrentLog()
|
||||
void SubversionPlugin::commitFromEditor()
|
||||
{
|
||||
m_submitActionTriggered = true;
|
||||
QTC_ASSERT(submitEditor(), return);
|
||||
|
@@ -122,7 +122,7 @@ private:
|
||||
void projectStatus();
|
||||
void slotDescribe();
|
||||
void updateProject();
|
||||
void submitCurrentLog();
|
||||
void commitFromEditor() override;
|
||||
void diffCommitFiles(const QStringList &);
|
||||
void logProject();
|
||||
void logRepository();
|
||||
@@ -171,10 +171,6 @@ private:
|
||||
Utils::ParameterAction *m_commitProjectAction = nullptr;
|
||||
QAction *m_describeAction = nullptr;
|
||||
|
||||
QAction *m_submitCurrentLogAction = nullptr;
|
||||
QAction *m_submitDiffAction = nullptr;
|
||||
QAction *m_submitUndoAction = nullptr;
|
||||
QAction *m_submitRedoAction = nullptr;
|
||||
QAction *m_menuAction = nullptr;
|
||||
bool m_submitActionTriggered = false;
|
||||
|
||||
|
@@ -24,24 +24,55 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "basevcssubmiteditorfactory.h"
|
||||
|
||||
#include "vcsbaseplugin.h"
|
||||
#include "vcsbasesubmiteditor.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
const char SUBMIT[] = "Vcs.Submit";
|
||||
const char DIFF_SELECTED[] = "Vcs.DiffSelectedFiles";
|
||||
|
||||
VcsSubmitEditorFactory::VcsSubmitEditorFactory
|
||||
(const VcsBaseSubmitEditorParameters *parameters,
|
||||
const EditorCreator &editorCreator,
|
||||
QObject *parent)
|
||||
: IEditorFactory(parent), m_editorCreator(editorCreator)
|
||||
VcsBasePlugin *plugin)
|
||||
: IEditorFactory(plugin), m_editorCreator(editorCreator)
|
||||
{
|
||||
setId(parameters->id);
|
||||
setDisplayName(QLatin1String(parameters->displayName));
|
||||
addMimeType(parameters->mimeType);
|
||||
|
||||
Context context(parameters->id);
|
||||
m_undoAction = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, context);
|
||||
|
||||
m_redoAction = new QAction(tr("&Redo"), this);
|
||||
ActionManager::registerAction(m_redoAction, Core::Constants::REDO, context);
|
||||
|
||||
QTC_ASSERT(plugin, return);
|
||||
m_submitAction = new QAction(VcsBaseSubmitEditor::submitIcon(),
|
||||
plugin->commitDisplayName(), this);
|
||||
Command *command = ActionManager::registerAction(m_submitAction, SUBMIT, context);
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
connect(m_submitAction, &QAction::triggered, plugin, &VcsBasePlugin::commitFromEditor);
|
||||
|
||||
m_diffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
|
||||
ActionManager::registerAction(m_diffAction, DIFF_SELECTED, context);
|
||||
}
|
||||
|
||||
Core::IEditor *VcsSubmitEditorFactory::createEditor()
|
||||
{
|
||||
return m_editorCreator();
|
||||
VcsBaseSubmitEditor *editor = m_editorCreator();
|
||||
editor->registerActions(m_undoAction, m_redoAction, m_submitAction, m_diffAction);
|
||||
return editor;
|
||||
}
|
||||
|
||||
} // namespace VcsBase
|
||||
|
@@ -30,10 +30,13 @@
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include <functional>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QAction);
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
class VcsBaseSubmitEditor;
|
||||
class VcsBaseSubmitEditorParameters;
|
||||
class VcsBasePlugin;
|
||||
|
||||
// Parametrizable base class for editor factories creating instances of
|
||||
// VcsBaseSubmitEditor subclasses.
|
||||
@@ -46,12 +49,16 @@ public:
|
||||
|
||||
VcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters,
|
||||
const EditorCreator &editorCreator,
|
||||
QObject *parent = nullptr);
|
||||
VcsBasePlugin *plugin);
|
||||
|
||||
Core::IEditor *createEditor() override;
|
||||
|
||||
private:
|
||||
EditorCreator m_editorCreator;
|
||||
QAction *m_submitAction = nullptr;
|
||||
QAction *m_diffAction = nullptr;
|
||||
QAction *m_undoAction = nullptr;
|
||||
QAction *m_redoAction = nullptr;
|
||||
};
|
||||
|
||||
} // namespace VcsBase
|
||||
|
@@ -177,9 +177,12 @@ public:
|
||||
QTextCodec *outputCodec = nullptr,
|
||||
const QProcessEnvironment &env = QProcessEnvironment());
|
||||
|
||||
protected:
|
||||
// Display name of the commit action:
|
||||
// Display name of the commit action
|
||||
virtual QString commitDisplayName() const;
|
||||
|
||||
virtual void commitFromEditor() = 0;
|
||||
|
||||
protected:
|
||||
// Prompt to save all files before commit:
|
||||
bool promptBeforeCommit();
|
||||
|
||||
|
Reference in New Issue
Block a user