Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
b1a7f281
Commit
b1a7f281
authored
Feb 22, 2021
by
Waqar Ahmed
Committed by
Christoph Cullmann
Feb 24, 2021
Browse files
Show tooltip with file path and status
parent
eb99ab6a
Changes
3
Hide whitespace changes
Inline
Side-by-side
addons/project/git/gitstatus.cpp
View file @
b1a7f281
...
...
@@ -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"
);
Dominik Haumann
@dhaumann
·
Feb 25, 2021
Developer
This should be
i18n()
everywhere...
@waqar
This should be `i18n()` everywhere... @waqar
Waqar Ahmed
@waqar
·
Feb 25, 2021
Author
Developer
done, thanks
done, thanks
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
();
}
addons/project/git/gitstatus.h
View file @
b1a7f281
...
...
@@ -63,6 +63,8 @@ struct GitParsedStatus {
};
GitParsedStatus
parseStatus
(
const
QByteArray
&
raw
);
QString
statusString
(
GitStatus
s
);
}
#endif // GITSTATUS_H
addons/project/gitstatusmodel.cpp
View file @
b1a7f281
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment