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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user