mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Client] Alt badges, breadcrumb trail, investigate button
AltTableDelegate paints palette-tinted match badges with paint-through selection, style warning/critical icons on nonzero counts, and font/elision handling. TabAlts gains a clickable breadcrumb trail, an Investigate-this-user button, and bold usernames. Async alts responses are guarded against stale investigations.
This commit is contained in:
parent
4d645e7513
commit
803e1e9ec3
5 changed files with 234 additions and 0 deletions
35
cockatrice/src/interface/widgets/tabs/alt_table_delegate.h
Normal file
35
cockatrice/src/interface/widgets/tabs/alt_table_delegate.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ALT_TABLE_DELEGATE_H
|
||||
#define ALT_TABLE_DELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
/**
|
||||
* Badge + icon painting for the User Alts table. The match-evidence column
|
||||
* renders as a palette-tinted pill per match type (email / client id / IP),
|
||||
* with the style's warning icon once an IP is shared by more than the VPN
|
||||
* threshold. Warn/ban counts gain the style's warning/critical icons when
|
||||
* nonzero. Selected rows and unknown content fall back to default painting.
|
||||
*/
|
||||
class AltTableDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AltTableDelegate(int viaColumn,
|
||||
int warnsColumn,
|
||||
int bansColumn,
|
||||
int sharedColumn,
|
||||
QObject *parent = nullptr);
|
||||
void setVpnThreshold(int threshold);
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
[[nodiscard]] QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
int viaColumn;
|
||||
int warnsColumn;
|
||||
int bansColumn;
|
||||
int sharedColumn;
|
||||
int vpnThreshold = 10;
|
||||
};
|
||||
|
||||
#endif // ALT_TABLE_DELEGATE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue