diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2017-02-03 16:31:17 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2017-02-05 07:45:00 +0000 |
commit | 28b61a9f9c6bf633a472e8a485294082882a01d1 (patch) | |
tree | 22aa47d5ccb4902fd58e4f43ae7e7a760b10d6bd /src/plugins/git/gitplugin.cpp | |
parent | 67933e4c1f49e9e270e053d063232cda65dad193 (diff) | |
download | qt-creator-28b61a9f9c6bf633a472e8a485294082882a01d1.tar.gz |
Git: Avoid repeating calls to currentState() in updateActions
Change-Id: I9352b7d9ad064e6dc4eb694a9175c8f32b5b25c8
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Diffstat (limited to 'src/plugins/git/gitplugin.cpp')
-rw-r--r-- | src/plugins/git/gitplugin.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index f8f921f4d4..5d4e167f86 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1319,13 +1319,14 @@ void GitPlugin::stashList() void GitPlugin::updateActions(VcsBasePlugin::ActionState as) { - const bool repositoryEnabled = currentState().hasTopLevel(); + const VcsBasePluginState state = currentState(); + const bool repositoryEnabled = state.hasTopLevel(); if (m_stashDialog) - m_stashDialog->refresh(currentState().topLevel(), false); + m_stashDialog->refresh(state.topLevel(), false); if (m_branchDialog) - m_branchDialog->refresh(currentState().topLevel(), false); + m_branchDialog->refresh(state.topLevel(), false); if (m_remoteDialog) - m_remoteDialog->refresh(currentState().topLevel(), false); + m_remoteDialog->refresh(state.topLevel(), false); m_commandLocator->setEnabled(repositoryEnabled); if (!enableMenuAction(as, m_menuAction)) @@ -1334,12 +1335,12 @@ void GitPlugin::updateActions(VcsBasePlugin::ActionState as) updateVersionWarning(); // Note: This menu is visible if there is no repository. Only // 'Create Repository'/'Show' actions should be available. - const QString fileName = currentState().currentFileName(); + const QString fileName = state.currentFileName(); foreach (ParameterAction *fileAction, m_fileActions) fileAction->setParameter(fileName); // If the current file looks like a patch, offer to apply - m_applyCurrentFilePatchAction->setParameter(currentState().currentPatchFileDisplayName()); - const QString projectName = currentState().currentProjectName(); + m_applyCurrentFilePatchAction->setParameter(state.currentPatchFileDisplayName()); + const QString projectName = state.currentProjectName(); foreach (ParameterAction *projectAction, m_projectActions) projectAction->setParameter(projectName); @@ -1347,7 +1348,7 @@ void GitPlugin::updateActions(VcsBasePlugin::ActionState as) repositoryAction->setEnabled(repositoryEnabled); m_submoduleUpdateAction->setVisible(repositoryEnabled - && !m_gitClient->submoduleList(currentState().topLevel()).isEmpty()); + && !m_gitClient->submoduleList(state.topLevel()).isEmpty()); updateContinueAndAbortCommands(); updateRepositoryBrowserAction(); |