forked from qt-creator/qt-creator
Git - added ability to launch git gui
Change-Id: I65ed3e0408e43e354a289bbbd385aec2e254746c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -2576,6 +2576,19 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
return success;
|
||||
}
|
||||
|
||||
bool GitClient::launchGitGui(const QString &workingDirectory) {
|
||||
bool success;
|
||||
QString gitBinary = gitBinaryPath(&success);
|
||||
if (success)
|
||||
success = QProcess::startDetached(gitBinary, QStringList(QLatin1String("gui")),
|
||||
workingDirectory);
|
||||
|
||||
if (!success)
|
||||
outputWindow()->appendError(tr("Cannot launch git gui"));
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
QString GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const
|
||||
{
|
||||
return settings()->gitBinaryPath(ok, errorMessage);
|
||||
|
||||
@@ -295,6 +295,7 @@ public:
|
||||
|
||||
void launchGitK(const QString &workingDirectory, const QString &fileName);
|
||||
void launchGitK(const QString &workingDirectory) { launchGitK(workingDirectory, QString()); }
|
||||
bool launchGitGui(const QString &workingDirectory);
|
||||
|
||||
void launchRepositoryBrowser(const QString &workingDirectory);
|
||||
|
||||
|
||||
@@ -634,6 +634,12 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
// --------------
|
||||
gitToolsMenu->addSeparator(globalcontext);
|
||||
|
||||
createRepositoryAction(gitToolsMenu, tr("Git Gui"), Core::Id("Git.GitGui"),
|
||||
globalcontext, true, SLOT(gitGui()));
|
||||
|
||||
// --------------
|
||||
gitToolsMenu->addSeparator(globalcontext);
|
||||
|
||||
m_repositoryBrowserAction
|
||||
= createRepositoryAction(gitToolsMenu,
|
||||
tr("Repository Browser"), Core::Id("Git.LaunchRepositoryBrowser"),
|
||||
@@ -927,6 +933,13 @@ void GitPlugin::gitkForCurrentFolder()
|
||||
}
|
||||
}
|
||||
|
||||
void GitPlugin::gitGui()
|
||||
{
|
||||
const VcsBase::VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
m_gitClient->launchGitGui(state.topLevel());
|
||||
}
|
||||
|
||||
void GitPlugin::startAmendCommit()
|
||||
{
|
||||
startCommit(AmendCommit);
|
||||
|
||||
@@ -123,6 +123,7 @@ private slots:
|
||||
void unstageFile();
|
||||
void gitkForCurrentFile();
|
||||
void gitkForCurrentFolder();
|
||||
void gitGui();
|
||||
void cleanProject();
|
||||
void cleanRepository();
|
||||
void updateSubmodules();
|
||||
|
||||
Reference in New Issue
Block a user