mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 09:05:48 -04:00
Identities list - different color circle for people who has downvotes
This commit is contained in:
parent
fe46b0aaa1
commit
2bb9becbec
3 changed files with 21 additions and 6 deletions
|
@ -1427,6 +1427,7 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||||
item->setData(
|
item->setData(
|
||||||
RSID_COL_VOTES,SortRole,
|
RSID_COL_VOTES,SortRole,
|
||||||
static_cast<uint32_t>(idd.mReputation.mOverallReputationLevel));
|
static_cast<uint32_t>(idd.mReputation.mOverallReputationLevel));
|
||||||
|
item->setData(RSID_COL_VOTES,Qt::UserRole,idd.mReputation.mFriendsNegativeVotes>0);
|
||||||
|
|
||||||
if(isOwnId)
|
if(isOwnId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,8 @@
|
||||||
#define REPUTATION_REMOTELY_NEGATIVE_ICON ":/icons/biohazard_yellow.png"
|
#define REPUTATION_REMOTELY_NEGATIVE_ICON ":/icons/biohazard_yellow.png"
|
||||||
#define REPUTATION_LOCALLY_NEGATIVE_ICON ":/icons/biohazard_red.png"
|
#define REPUTATION_LOCALLY_NEGATIVE_ICON ":/icons/biohazard_red.png"
|
||||||
#define REPUTATION_VOID ":/icons/void_128.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 TIMER_INTERVAL 500
|
||||||
#define MAX_ATTEMPTS 10
|
#define MAX_ATTEMPTS 10
|
||||||
|
@ -95,11 +97,13 @@ void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||||
// get pixmap
|
// get pixmap
|
||||||
unsigned int icon_index = qvariant_cast<unsigned int>(index.data(Qt::DecorationRole));
|
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)
|
if(icon_index > mMaxLevelToDisplay)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
QIcon icon = GxsIdDetails::getReputationIcon(
|
QIcon icon = GxsIdDetails::getReputationIcon(
|
||||||
RsReputationLevel(icon_index), 0xff );
|
RsReputationLevel(icon_index), 0xff, downvoted );
|
||||||
|
|
||||||
QPixmap pix = icon.pixmap(r.size());
|
QPixmap pix = icon.pixmap(r.size());
|
||||||
|
|
||||||
|
@ -1081,7 +1085,7 @@ QString nickname ;
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon GxsIdDetails::getReputationIcon(
|
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 )
|
if( static_cast<uint32_t>(icon_index) >= min_reputation )
|
||||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_VOID);
|
return FilesDefs::getIconFromQtResourcePath(REPUTATION_VOID);
|
||||||
|
@ -1093,11 +1097,21 @@ QIcon GxsIdDetails::getReputationIcon(
|
||||||
case RsReputationLevel::LOCALLY_POSITIVE:
|
case RsReputationLevel::LOCALLY_POSITIVE:
|
||||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_LOCALLY_POSITIVE_ICON);
|
return FilesDefs::getIconFromQtResourcePath(REPUTATION_LOCALLY_POSITIVE_ICON);
|
||||||
case RsReputationLevel::REMOTELY_POSITIVE:
|
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:
|
case RsReputationLevel::REMOTELY_NEGATIVE:
|
||||||
return FilesDefs::getIconFromQtResourcePath(REPUTATION_REMOTELY_NEGATIVE_ICON);
|
return FilesDefs::getIconFromQtResourcePath(REPUTATION_REMOTELY_NEGATIVE_ICON);
|
||||||
case RsReputationLevel::NEUTRAL:
|
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:
|
default:
|
||||||
std::cerr << "Asked for unidentified icon index "
|
std::cerr << "Asked for unidentified icon index "
|
||||||
<< static_cast<uint32_t>(icon_index) << std::endl;
|
<< static_cast<uint32_t>(icon_index) << std::endl;
|
||||||
|
@ -1118,7 +1132,7 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
||||||
}
|
}
|
||||||
|
|
||||||
if(icon_types & ICON_TYPE_REPUTATION)
|
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)
|
if(icon_types & ICON_TYPE_AVATAR)
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
|
|
||||||
static QIcon getLoadingIcon(const RsGxsId &id);
|
static QIcon getLoadingIcon(const RsGxsId &id);
|
||||||
static QIcon getReputationIcon(
|
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);
|
static void GenerateCombinedPixmap(QPixmap &pixmap, const QList<QIcon> &icons, int iconSize);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue