mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-19 14:55:54 -04:00
Merge 2bb9becbec88d2fbb0309f472675ccebb58b76bf into 8fcc52b304f35a5c7df95efbe2abdd0574048a15
This commit is contained in:
commit
8ec46b2963
@ -1443,6 +1443,7 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
item->setData(
|
||||
RSID_COL_VOTES,SortRole,
|
||||
static_cast<uint32_t>(idd.mReputation.mOverallReputationLevel));
|
||||
item->setData(RSID_COL_VOTES,Qt::UserRole,idd.mReputation.mFriendsNegativeVotes>0);
|
||||
|
||||
if(isOwnId)
|
||||
{
|
||||
|
@ -56,6 +56,8 @@
|
||||
#define REPUTATION_REMOTELY_NEGATIVE_ICON ":/icons/biohazard_yellow.png"
|
||||
#define REPUTATION_LOCALLY_NEGATIVE_ICON ":/icons/biohazard_red.png"
|
||||
#define REPUTATION_VOID ":/icons/void_128.png"
|
||||
#define REPUTATION_HAS_DOWNVOTES ":/icons/bullet_yellow_128.png"
|
||||
#define REPUTATION_HAS_DOWNVOTES_NEUTRAL ":/icons/bullet_red_128.png"
|
||||
|
||||
#define TIMER_INTERVAL 500
|
||||
#define MAX_ATTEMPTS 10
|
||||
@ -97,11 +99,13 @@ void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||
// get pixmap
|
||||
unsigned int icon_index = qvariant_cast<unsigned int>(index.data(Qt::DecorationRole));
|
||||
|
||||
bool downvoted = qvariant_cast<bool>(index.data(Qt::UserRole));
|
||||
|
||||
if(icon_index > mMaxLevelToDisplay)
|
||||
return ;
|
||||
|
||||
QIcon icon = GxsIdDetails::getReputationIcon(
|
||||
RsReputationLevel(icon_index), 0xff );
|
||||
RsReputationLevel(icon_index), 0xff, downvoted );
|
||||
|
||||
QPixmap pix = icon.pixmap(r.size());
|
||||
|
||||
@ -1138,7 +1142,7 @@ QString nickname ;
|
||||
}
|
||||
|
||||
QIcon GxsIdDetails::getReputationIcon(
|
||||
RsReputationLevel icon_index, uint32_t min_reputation )
|
||||
RsReputationLevel icon_index, uint32_t min_reputation,bool has_downvotes )
|
||||
{
|
||||
if( static_cast<uint32_t>(icon_index) >= min_reputation )
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_VOID);
|
||||
@ -1150,11 +1154,21 @@ QIcon GxsIdDetails::getReputationIcon(
|
||||
case RsReputationLevel::LOCALLY_POSITIVE:
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_LOCALLY_POSITIVE_ICON);
|
||||
case RsReputationLevel::REMOTELY_POSITIVE:
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_REMOTELY_POSITIVE_ICON);
|
||||
{
|
||||
if(has_downvotes)
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_HAS_DOWNVOTES);
|
||||
else
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_REMOTELY_POSITIVE_ICON);
|
||||
}
|
||||
case RsReputationLevel::REMOTELY_NEGATIVE:
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_REMOTELY_NEGATIVE_ICON);
|
||||
case RsReputationLevel::NEUTRAL:
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_NEUTRAL_ICON);
|
||||
{
|
||||
if(has_downvotes)
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_HAS_DOWNVOTES_NEUTRAL);
|
||||
else
|
||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_NEUTRAL_ICON);
|
||||
}
|
||||
default:
|
||||
std::cerr << "Asked for unidentified icon index "
|
||||
<< static_cast<uint32_t>(icon_index) << std::endl;
|
||||
@ -1175,7 +1189,7 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
||||
}
|
||||
|
||||
if(icon_types & ICON_TYPE_REPUTATION)
|
||||
icons.push_back(getReputationIcon(details.mReputation.mOverallReputationLevel,minimal_required_reputation)) ;
|
||||
icons.push_back(getReputationIcon(details.mReputation.mOverallReputationLevel,minimal_required_reputation,details.mReputation.mFriendsNegativeVotes>0)) ;
|
||||
|
||||
if(icon_types & ICON_TYPE_AVATAR)
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
|
||||
static QIcon getLoadingIcon(const RsGxsId &id);
|
||||
static QIcon getReputationIcon(
|
||||
RsReputationLevel icon_index, uint32_t min_reputation );
|
||||
RsReputationLevel icon_index, uint32_t min_reputation, bool has_downvotes );
|
||||
|
||||
static void GenerateCombinedPixmap(QPixmap &pixmap, const QList<QIcon> &icons, int iconSize);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user