Commit b1a7f281 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Show tooltip with file path and status

parent eb99ab6a
......@@ -93,3 +93,35 @@ GitUtils::GitParsedStatus GitUtils::parseStatus(const QByteArray &raw)
return {untracked, unmerge, staged, changed};
}
QString GitUtils::statusString(GitUtils::GitStatus s)
{
switch (s) {
case WorkingTree_Modified:
case Index_Modified:
return QStringLiteral(" ‣ Modified");
Please register or sign in to reply
case Untracked:
return QStringLiteral(" ‣ Untracked");
case Index_Renamed:
return QStringLiteral(" ‣ Renamed");
case Index_Deleted:
case WorkingTree_Deleted:
return QStringLiteral(" ‣ Deleted");
case Index_Added:
case WorkingTree_IntentToAdd:
return QStringLiteral(" ‣ Added");
case Index_Copied:
return QStringLiteral(" ‣ Copied");
case Ignored:
return QStringLiteral(" ‣ Ignored");
case Unmerge_AddedByThem:
case Unmerge_AddedByUs:
case Unmerge_BothAdded:
case Unmerge_BothDeleted:
case Unmerge_BothModified:
case Unmerge_DeletedByThem:
case Unmerge_DeletedByUs:
return QStringLiteral(" ‣ Conflict");
}
return QString();
}
......@@ -63,6 +63,8 @@ struct GitParsedStatus {
};
GitParsedStatus parseStatus(const QByteArray &raw);
QString statusString(GitStatus s);
}
#endif // GITSTATUS_H
......@@ -132,6 +132,8 @@ QVariant GitStatusModel::data(const QModelIndex &index, int role) const
return QIcon::fromTheme(QMimeDatabase().mimeTypeForFile(m_nodes[rootIndex].at(row).file, QMimeDatabase::MatchExtension).iconName());
} else if (role == Role::TreeItemType) {
return ItemType::NodeFile;
} else if (role == Qt::ToolTipRole) {
return QString(m_nodes[rootIndex].at(row).file + GitUtils::statusString(m_nodes[rootIndex].at(row).status));
} else if (role == Qt::TextAlignmentRole) {
if (index.column() == 0) {
return Qt::AlignLeft;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment