Git: Introduce diff repository and group actions.

This commit is contained in:
Friedemann Kleint
2010-01-05 16:36:27 +01:00
parent c55b5b7b31
commit 40f5d38b91
2 changed files with 23 additions and 5 deletions

View File

@@ -110,6 +110,7 @@ GitPlugin::GitPlugin() :
m_core(0), m_core(0),
m_diffAction(0), m_diffAction(0),
m_diffProjectAction(0), m_diffProjectAction(0),
m_diffRepositoryAction(0),
m_statusRepositoryAction(0), m_statusRepositoryAction(0),
m_logAction(0), m_logAction(0),
m_blameAction(0), m_blameAction(0),
@@ -270,11 +271,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffCurrentProject())); connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffCurrentProject()));
gitContainer->addAction(command); gitContainer->addAction(command);
m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
command = actionManager->registerAction(m_statusRepositoryAction, "Git.StatusRepository", globalcontext);
connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
gitContainer->addAction(command);
m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
command = actionManager->registerAction(m_logProjectAction, "Git.LogProject", globalcontext); command = actionManager->registerAction(m_logProjectAction, "Git.LogProject", globalcontext);
command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+K"))); command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+K")));
@@ -282,6 +278,18 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject())); connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
gitContainer->addAction(command); gitContainer->addAction(command);
gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Repository"), this));
m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
command = actionManager->registerAction(m_diffRepositoryAction, "Git.DiffRepository", globalcontext);
connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository()));
gitContainer->addAction(command);
m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
command = actionManager->registerAction(m_statusRepositoryAction, "Git.StatusRepository", globalcontext);
connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
gitContainer->addAction(command);
m_undoRepositoryAction = new QAction(tr("Undo Repository Changes"), this); m_undoRepositoryAction = new QAction(tr("Undo Repository Changes"), this);
command = actionManager->registerAction(m_undoRepositoryAction, "Git.UndoRepository", globalcontext); command = actionManager->registerAction(m_undoRepositoryAction, "Git.UndoRepository", globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
@@ -390,6 +398,13 @@ void GitPlugin::diffCurrentProject()
m_gitClient->diff(state.currentProjectTopLevel(), QStringList(), state.relativeCurrentProject()); m_gitClient->diff(state.currentProjectTopLevel(), QStringList(), state.relativeCurrentProject());
} }
void GitPlugin::diffRepository()
{
const VCSBase::VCSBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
m_gitClient->diff(state.topLevel(), QStringList(), QStringList());
}
void GitPlugin::statusRepository() void GitPlugin::statusRepository()
{ {
const VCSBase::VCSBasePluginState state = currentState(); const VCSBase::VCSBasePluginState state = currentState();
@@ -673,6 +688,7 @@ void GitPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
m_undoRepositoryAction->setEnabled(projectEnabled); m_undoRepositoryAction->setEnabled(projectEnabled);
const bool repositoryEnabled = currentState().hasTopLevel(); const bool repositoryEnabled = currentState().hasTopLevel();
m_diffRepositoryAction->setEnabled(repositoryEnabled);
m_statusRepositoryAction->setEnabled(repositoryEnabled); m_statusRepositoryAction->setEnabled(repositoryEnabled);
m_branchListAction->setEnabled(repositoryEnabled); m_branchListAction->setEnabled(repositoryEnabled);
m_stashListAction->setEnabled(repositoryEnabled); m_stashListAction->setEnabled(repositoryEnabled);

View File

@@ -88,6 +88,7 @@ public:
private slots: private slots:
void diffCurrentFile(); void diffCurrentFile();
void diffCurrentProject(); void diffCurrentProject();
void diffRepository();
void submitEditorDiff(const QStringList &unstaged, const QStringList &staged); void submitEditorDiff(const QStringList &unstaged, const QStringList &staged);
void submitCurrentLog(); void submitCurrentLog();
void statusRepository(); void statusRepository();
@@ -121,6 +122,7 @@ private:
Core::ICore *m_core; Core::ICore *m_core;
Utils::ParameterAction *m_diffAction; Utils::ParameterAction *m_diffAction;
Utils::ParameterAction *m_diffProjectAction; Utils::ParameterAction *m_diffProjectAction;
QAction *m_diffRepositoryAction;
QAction *m_statusRepositoryAction; QAction *m_statusRepositoryAction;
Utils::ParameterAction *m_logAction; Utils::ParameterAction *m_logAction;
Utils::ParameterAction *m_blameAction; Utils::ParameterAction *m_blameAction;