use also as variable name mGitPath

This commit is contained in:
Martin Marmsoler 2023-11-12 10:19:34 +01:00
parent 9edf99fbed
commit 8374baad73
3 changed files with 10 additions and 7 deletions

View File

@ -51,7 +51,8 @@ void RecentRepositories::remove(int index) {
}
/*!
* gitpath: path to the git repository, does not neccesarly need to be the workdir
* gitpath: path to the git repository, does not neccesarly need to be the
* workdir
*/
void RecentRepositories::add(QString gitpath) {
emit repositoryAboutToBeAdded();

View File

@ -10,15 +10,17 @@
#include "RecentRepository.h"
RecentRepository::RecentRepository(const QString &gitpath, QObject *parent)
: QObject(parent), mPath(gitpath) {}
: QObject(parent), mGitPath(gitpath) {}
QString RecentRepository::gitpath() const { return mPath; }
QString RecentRepository::gitpath() const { return mGitPath; }
QString RecentRepository::name() const {
if (mPath.endsWith("/.git"))
return mPath.section('/', -mSections - 1, -2);
QString name;
if (mGitPath.endsWith("/.git"))
name = mGitPath.section('/', -mSections - 1, -2);
else
return mPath.section('/', -mSections, -1);
name = mGitPath.section('/', -mSections, -1);
return name;
}
void RecentRepository::increment() { ++mSections; }

View File

@ -24,7 +24,7 @@ public:
private:
void increment();
QString mPath;
QString mGitPath;
int mSections = 1;
friend class RecentRepositories;