diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2018-08-28 00:03:59 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2018-08-28 07:26:14 +0000 |
commit | 767137157e4971413ee0ab4f9ee5ea48a2b43737 (patch) | |
tree | d0397f2692a7cc469863ba84de647a81f51d2dc6 /src/plugins/perforce | |
parent | f1f506b47970b746d472acb65eb94014f9fafe33 (diff) | |
download | qt-creator-767137157e4971413ee0ab4f9ee5ea48a2b43737.tar.gz |
VCS: Consolidate submit editor actions setup
Change-Id: I36754779b6a9aa35de705b368daf8c2a1de058c6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/perforce')
-rw-r--r-- | src/plugins/perforce/perforceplugin.cpp | 22 | ||||
-rw-r--r-- | src/plugins/perforce/perforceplugin.h | 6 |
2 files changed, 2 insertions, 26 deletions
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 143b07f71a..e63f351676 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -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); diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h index 814969537a..c7824c0548 100644 --- a/src/plugins/perforce/perforceplugin.h +++ b/src/plugins/perforce/perforceplugin.h @@ -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; |