diff options
author | Ken Moore <ken@pcbsd.org> | 2016-09-13 14:11:39 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2016-09-13 14:11:39 -0400 |
commit | 0b8657008bf89226d24259dcbe5730aa76a483e2 (patch) | |
tree | 05423a3574acd27a924b6db4dafdb1a7e546bec9 /src-qt5/desktop-utils/lumina-fm/gitCompat.h | |
parent | Merge in all the translation files from the lumina-i18n repository into the m... (diff) | |
download | lumina-0b8657008bf89226d24259dcbe5730aa76a483e2.tar.gz lumina-0b8657008bf89226d24259dcbe5730aa76a483e2.tar.bz2 lumina-0b8657008bf89226d24259dcbe5730aa76a483e2.zip |
Add the beginnings of git integration within lumina-fm. Currently it can detect whether the user is looking at a git repo or not, and can probe/show the status of the repo if within one.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/gitCompat.h')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/gitCompat.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/gitCompat.h b/src-qt5/desktop-utils/lumina-fm/gitCompat.h index 6578bd5b..44c6d5b1 100644 --- a/src-qt5/desktop-utils/lumina-fm/gitCompat.h +++ b/src-qt5/desktop-utils/lumina-fm/gitCompat.h @@ -6,7 +6,7 @@ //=========================================== // This is the backend classe for interacting with the "git" utility //=========================================== -#ifdef _LUMINA_FM_GIT_COMPAT_H +#ifndef _LUMINA_FM_GIT_COMPAT_H #define _LUMINA_FM_GIT_COMPAT_H #include <QProcess> @@ -19,8 +19,8 @@ class GIT{ public: //Check if the git utility is installed and available static bool isAvailable(){ - QString bin = "git" - return isValidBinary(bin); + QString bin = "git"; + return LUtils::isValidBinary(bin); } //Return if the current directory is a git repository @@ -28,7 +28,8 @@ public: QProcess P; P.setProcessEnvironment(QProcessEnvironment::systemEnvironment()); P.setWorkingDirectory(dir); - P.exec("git",QStringList() <<"status" << "--porcelain" ); + P.start("git",QStringList() <<"status" << "--porcelain" ); + P.waitForFinished(); return (0==P.exitCode()); } @@ -38,22 +39,24 @@ public: P.setProcessEnvironment(QProcessEnvironment::systemEnvironment()); P.setWorkingDirectory(dir); P.setProcessChannelMode(QProcess::MergedChannels); - P.exec("git",QStringList() <<"status" ); + P.start("git",QStringList() <<"status" ); + P.waitForFinished(); return P.readAllStandardOutput(); } //Setup a process for running the clone operation (so the calling process can hook up any watchers and start it when ready) - static QProcess setupClone(QString indir, QString url, QString branch = "", int depth = -1){ - QProcess P; - P.setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); - P.setWorkingDirectory(indir); - P.setProgram("git"); + static QProcess* setupClone(QString indir, QString url, QString branch = "", int depth = -1){ + //NOTE: The returned QProcess needs to be cleaned up when finished + QProcess *P = new QProcess(); + P->setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); + P->setWorkingDirectory(indir); + P->setProgram("git"); QStringList args; args << "clone"; if(!branch.isEmpty()){ args << "-b" << branch; } if(depth>0){ args << "--depth" << QString::number(depth); } args << url; - P.setArguments(args); + P->setArguments(args); return P; } }; |