mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-11 10:45:39 +03:00
Make CommitList display: Working tree clean
This commit is contained in:
parent
04991eb1df
commit
0c549c7d1f
@ -150,6 +150,17 @@ public:
|
|||||||
resetWalker();
|
resetWalker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_working_tree_clean(void) const {
|
||||||
|
if (mStatus.isRunning()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
git::Diff stat = status();
|
||||||
|
if (!stat.isValid()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return stat.count() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
void suppressResetWalker(bool suppress) { mSuppressResetWalker = suppress; }
|
void suppressResetWalker(bool suppress) { mSuppressResetWalker = suppress; }
|
||||||
|
|
||||||
bool isResetWalkerSuppressed() { return mSuppressResetWalker; }
|
bool isResetWalkerSuppressed() { return mSuppressResetWalker; }
|
||||||
@ -186,8 +197,8 @@ public:
|
|||||||
|
|
||||||
// Update status row.
|
// Update status row.
|
||||||
bool head = (!mRef.isValid() || mRef.isHead());
|
bool head = (!mRef.isValid() || mRef.isHead());
|
||||||
bool valid = (!mStatus.isFinished() || status().isValid());
|
if (mShowCleanStatus && head && mStatus.isFinished() &&
|
||||||
if (mShowCleanStatus && head && valid && mPathspec.isEmpty()) {
|
mPathspec.isEmpty()) {
|
||||||
QVector<Column> row;
|
QVector<Column> row;
|
||||||
if (mGraphVisible && mRef.isValid() && mStatus.isFinished()) {
|
if (mGraphVisible && mRef.isValid() && mStatus.isFinished()) {
|
||||||
row.append({Segment(Bottom, kTaintedColor), Segment(Dot, QColor())});
|
row.append({Segment(Bottom, kTaintedColor), Segment(Dot, QColor())});
|
||||||
@ -322,17 +333,19 @@ public:
|
|||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const {
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const {
|
||||||
const Row &row = mRows.at(index.row());
|
const Row &row = mRows.at(index.row());
|
||||||
bool status = !row.commit.isValid();
|
bool commit_is_valid = row.commit.isValid();
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
if (!status)
|
if (commit_is_valid)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
if (!mStatus.isFinished())
|
||||||
return mStatus.isFinished() ? tr("Uncommitted changes")
|
return tr("Checking for uncommitted changes");
|
||||||
: tr("Checking for uncommitted changes");
|
return is_working_tree_clean() ? tr("Working tree clean")
|
||||||
|
: tr("Uncommitted changes");
|
||||||
|
|
||||||
case Qt::FontRole: {
|
case Qt::FontRole: {
|
||||||
if (!status)
|
if (commit_is_valid)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
QFont font = static_cast<QWidget *>(QObject::parent())->font();
|
QFont font = static_cast<QWidget *>(QObject::parent())->font();
|
||||||
@ -341,19 +354,19 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Qt::TextAlignmentRole:
|
case Qt::TextAlignmentRole:
|
||||||
if (!status)
|
if (commit_is_valid)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
return QVariant(Qt::AlignHCenter | Qt::AlignVCenter);
|
return QVariant(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
if (!status)
|
if (commit_is_valid)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
return mStatus.isFinished() ? QVariant() : mProgress;
|
return mStatus.isFinished() ? QVariant() : mProgress;
|
||||||
|
|
||||||
case CommitList::Role::DiffRole: {
|
case CommitList::Role::DiffRole: {
|
||||||
if (status)
|
if (!commit_is_valid)
|
||||||
return QVariant::fromValue(this->status());
|
return QVariant::fromValue(this->status());
|
||||||
|
|
||||||
bool ignoreWhitespace = Settings::instance()->isWhitespaceIgnored();
|
bool ignoreWhitespace = Settings::instance()->isWhitespaceIgnored();
|
||||||
@ -363,7 +376,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
case CommitList::Role::CommitRole:
|
case CommitList::Role::CommitRole:
|
||||||
return status ? QVariant() : QVariant::fromValue(row.commit);
|
return commit_is_valid ? QVariant::fromValue(row.commit) : QVariant();
|
||||||
|
|
||||||
case CommitList::Role::GraphRole: {
|
case CommitList::Role::GraphRole: {
|
||||||
QVariantList columns;
|
QVariantList columns;
|
||||||
|
Loading…
Reference in New Issue
Block a user