mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 23:36:59 -05:00
Fix retroshare-gui compilation after RsReputations refactoring
This commit is contained in:
parent
a6e8a27fc0
commit
5ff4ebbd12
@ -285,7 +285,7 @@ void IdDetailsDialog::insertIdDetails(uint32_t token)
|
||||
|
||||
#endif
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
RsReputationInfo info;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),data.mPgpId,info) ;
|
||||
|
||||
#warning (csoler) Do we need to do this? This code is apparently not used.
|
||||
@ -302,23 +302,34 @@ void IdDetailsDialog::insertIdDetails(uint32_t token)
|
||||
ui->label_positive->setText(QString::number(info.mFriendsPositiveVotes));
|
||||
ui->label_negative->setText(QString::number(info.mFriendsNegativeVotes));
|
||||
|
||||
switch(info.mOverallReputationLevel)
|
||||
{
|
||||
case RsReputations::REPUTATION_LOCALLY_POSITIVE: ui->overallOpinion_TF->setText(tr("Positive")) ; break ;
|
||||
case RsReputations::REPUTATION_LOCALLY_NEGATIVE: ui->overallOpinion_TF->setText(tr("Negative (Banned by you)")) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_POSITIVE: ui->overallOpinion_TF->setText(tr("Positive (according to your friends)")) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_NEGATIVE: ui->overallOpinion_TF->setText(tr("Negative (according to your friends)")) ; break ;
|
||||
default:
|
||||
case RsReputations::REPUTATION_NEUTRAL: ui->overallOpinion_TF->setText(tr("Neutral")) ; break ;
|
||||
}
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
switch(info.mOverallReputationLevel)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break ;
|
||||
case RsReputations::OPINION_NEUTRAL : ui->ownOpinion_CB->setCurrentIndex(1); break ;
|
||||
case RsReputations::OPINION_POSITIVE: ui->ownOpinion_CB->setCurrentIndex(2); break ;
|
||||
default:
|
||||
std::cerr << "Unexpected value in own opinion: " << info.mOwnOpinion << std::endl;
|
||||
case RsReputationLevel::LOCALLY_POSITIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Positive")); break;
|
||||
case RsReputationLevel::LOCALLY_NEGATIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Negative (Banned by you)")); break;
|
||||
case RsReputationLevel::REMOTELY_POSITIVE:
|
||||
ui->overallOpinion_TF->setText(
|
||||
tr("Positive (according to your friends)"));
|
||||
break;
|
||||
case RsReputationLevel::REMOTELY_NEGATIVE:
|
||||
ui->overallOpinion_TF->setText(
|
||||
tr("Negative (according to your friends)"));
|
||||
break;
|
||||
case RsReputationLevel::NEUTRAL: // fallthrough
|
||||
default:
|
||||
ui->overallOpinion_TF->setText(tr("Neutral")); break;
|
||||
}
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
{
|
||||
case RsOpinion::NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break;
|
||||
case RsOpinion::NEUTRAL : ui->ownOpinion_CB->setCurrentIndex(1); break;
|
||||
case RsOpinion::POSITIVE: ui->ownOpinion_CB->setCurrentIndex(2); break;
|
||||
default:
|
||||
std::cerr << "Unexpected value in own opinion: "
|
||||
<< static_cast<uint32_t>(info.mOwnOpinion) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,19 +341,19 @@ void IdDetailsDialog::modifyReputation()
|
||||
#endif
|
||||
|
||||
RsGxsId id(ui->lineEdit_KeyId->text().toStdString());
|
||||
|
||||
RsReputations::Opinion op ;
|
||||
|
||||
switch(ui->ownOpinion_CB->currentIndex())
|
||||
{
|
||||
case 0: op = RsReputations::OPINION_NEGATIVE ; break ;
|
||||
case 1: op = RsReputations::OPINION_NEUTRAL ; break ;
|
||||
case 2: op = RsReputations::OPINION_POSITIVE ; break ;
|
||||
default:
|
||||
std::cerr << "Wrong value from opinion combobox. Bug??" << std::endl;
|
||||
|
||||
}
|
||||
rsReputations->setOwnOpinion(id,op) ;
|
||||
RsOpinion op;
|
||||
|
||||
switch(ui->ownOpinion_CB->currentIndex())
|
||||
{
|
||||
case 0: op = RsOpinion::NEGATIVE; break;
|
||||
case 1: op = RsOpinion::NEUTRAL ; break;
|
||||
case 2: op = RsOpinion::POSITIVE; break;
|
||||
default:
|
||||
std::cerr << "Wrong value from opinion combobox. Bug??" << std::endl;
|
||||
break;
|
||||
}
|
||||
rsReputations->setOwnOpinion(id,op);
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << mod;
|
||||
|
@ -344,7 +344,9 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||
ui->idTreeWidget->setColumnWidth(RSID_COL_IDTYPE, 18 * fontWidth);
|
||||
ui->idTreeWidget->setColumnWidth(RSID_COL_VOTES, 2 * fontWidth);
|
||||
|
||||
ui->idTreeWidget->setItemDelegateForColumn(RSID_COL_VOTES,new ReputationItemDelegate(RsReputations::ReputationLevel(0xff))) ;
|
||||
ui->idTreeWidget->setItemDelegateForColumn(
|
||||
RSID_COL_VOTES,
|
||||
new ReputationItemDelegate(RsReputationLevel(0xff)));
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * idheader = ui->idTreeWidget->header();
|
||||
@ -1444,8 +1446,9 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
RsIdentityDetails idd ;
|
||||
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),idd) ;
|
||||
|
||||
bool isBanned = idd.mReputation.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE;
|
||||
uint32_t item_flags = 0 ;
|
||||
bool isBanned = idd.mReputation.mOverallReputationLevel ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE;
|
||||
uint32_t item_flags = 0;
|
||||
|
||||
/* do filtering */
|
||||
bool ok = false;
|
||||
@ -1514,8 +1517,12 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||
|
||||
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;
|
||||
item->setTextAlignment(RSID_COL_VOTES, Qt::AlignRight | Qt::AlignVCenter);
|
||||
item->setData(RSID_COL_VOTES,Qt::DecorationRole, idd.mReputation.mOverallReputationLevel);
|
||||
item->setData(RSID_COL_VOTES,SortRole, idd.mReputation.mOverallReputationLevel);
|
||||
item->setData(
|
||||
RSID_COL_VOTES,Qt::DecorationRole,
|
||||
static_cast<uint32_t>(idd.mReputation.mOverallReputationLevel));
|
||||
item->setData(
|
||||
RSID_COL_VOTES,SortRole,
|
||||
static_cast<uint32_t>(idd.mReputation.mOverallReputationLevel));
|
||||
|
||||
if(isOwnId)
|
||||
{
|
||||
@ -1910,7 +1917,7 @@ void IdDialog::insertIdDetails(uint32_t token)
|
||||
|
||||
#endif
|
||||
|
||||
RsReputations::ReputationInfo info ;
|
||||
RsReputationInfo info;
|
||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),data.mPgpId,info) ;
|
||||
|
||||
QString frep_string ;
|
||||
@ -1925,23 +1932,32 @@ void IdDialog::insertIdDetails(uint32_t token)
|
||||
ui->label_positive->setText(QString::number(info.mFriendsPositiveVotes));
|
||||
ui->label_negative->setText(QString::number(info.mFriendsNegativeVotes));
|
||||
|
||||
switch(info.mOverallReputationLevel)
|
||||
{
|
||||
case RsReputations::REPUTATION_LOCALLY_POSITIVE: ui->overallOpinion_TF->setText(tr("Positive")) ; break ;
|
||||
case RsReputations::REPUTATION_LOCALLY_NEGATIVE: ui->overallOpinion_TF->setText(tr("Negative (Banned by you)")) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_POSITIVE: ui->overallOpinion_TF->setText(tr("Positive (according to your friends)")) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_NEGATIVE: ui->overallOpinion_TF->setText(tr("Negative (according to your friends)")) ; break ;
|
||||
default:
|
||||
case RsReputations::REPUTATION_NEUTRAL: ui->overallOpinion_TF->setText(tr("Neutral")) ; break ;
|
||||
}
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
switch(info.mOverallReputationLevel)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break ;
|
||||
case RsReputations::OPINION_NEUTRAL : ui->ownOpinion_CB->setCurrentIndex(1); break ;
|
||||
case RsReputations::OPINION_POSITIVE: ui->ownOpinion_CB->setCurrentIndex(2); break ;
|
||||
default:
|
||||
std::cerr << "Unexpected value in own opinion: " << info.mOwnOpinion << std::endl;
|
||||
case RsReputationLevel::LOCALLY_POSITIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Positive")); break;
|
||||
case RsReputationLevel::LOCALLY_NEGATIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Negative (Banned by you)")); break;
|
||||
case RsReputationLevel::REMOTELY_POSITIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Positive (according to your friends)"));
|
||||
break;
|
||||
case RsReputationLevel::REMOTELY_NEGATIVE:
|
||||
ui->overallOpinion_TF->setText(tr("Negative (according to your friends)"));
|
||||
break;
|
||||
case RsReputationLevel::NEUTRAL: // fallthrough
|
||||
default:
|
||||
ui->overallOpinion_TF->setText(tr("Neutral")) ; break ;
|
||||
}
|
||||
|
||||
switch(info.mOwnOpinion)
|
||||
{
|
||||
case RsOpinion::NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break;
|
||||
case RsOpinion::NEUTRAL : ui->ownOpinion_CB->setCurrentIndex(1); break;
|
||||
case RsOpinion::POSITIVE: ui->ownOpinion_CB->setCurrentIndex(2); break;
|
||||
default:
|
||||
std::cerr << "Unexpected value in own opinion: "
|
||||
<< static_cast<uint32_t>(info.mOwnOpinion) << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
// now fill in usage cases
|
||||
@ -2060,19 +2076,19 @@ void IdDialog::modifyReputation()
|
||||
#endif
|
||||
|
||||
RsGxsId id(ui->lineEdit_KeyId->text().toStdString());
|
||||
|
||||
RsReputations::Opinion op ;
|
||||
|
||||
switch(ui->ownOpinion_CB->currentIndex())
|
||||
{
|
||||
case 0: op = RsReputations::OPINION_NEGATIVE ; break ;
|
||||
case 1: op = RsReputations::OPINION_NEUTRAL ; break ;
|
||||
case 2: op = RsReputations::OPINION_POSITIVE ; break ;
|
||||
default:
|
||||
std::cerr << "Wrong value from opinion combobox. Bug??" << std::endl;
|
||||
|
||||
}
|
||||
rsReputations->setOwnOpinion(id,op) ;
|
||||
RsOpinion op;
|
||||
|
||||
switch(ui->ownOpinion_CB->currentIndex())
|
||||
{
|
||||
case 0: op = RsOpinion::NEGATIVE; break;
|
||||
case 1: op = RsOpinion::NEUTRAL ; break;
|
||||
case 2: op = RsOpinion::POSITIVE; break;
|
||||
default:
|
||||
std::cerr << "Wrong value from opinion combobox. Bug??" << std::endl;
|
||||
break;
|
||||
}
|
||||
rsReputations->setOwnOpinion(id,op);
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << op;
|
||||
@ -2386,17 +2402,12 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||
|
||||
switch(det.mReputation.mOwnOpinion)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ++n_negative_reputations ;
|
||||
break ;
|
||||
|
||||
case RsReputations::OPINION_POSITIVE: ++n_positive_reputations ;
|
||||
break ;
|
||||
|
||||
case RsReputations::OPINION_NEUTRAL: ++n_neutral_reputations ;
|
||||
break ;
|
||||
case RsOpinion::NEGATIVE: ++n_negative_reputations; break;
|
||||
case RsOpinion::POSITIVE: ++n_positive_reputations; break;
|
||||
case RsOpinion::NEUTRAL: ++n_neutral_reputations; break;
|
||||
}
|
||||
|
||||
++n_selected_items ;
|
||||
++n_selected_items;
|
||||
|
||||
if(rsIdentity->isARegularContact(keyId))
|
||||
++n_is_a_contact ;
|
||||
@ -2674,7 +2685,7 @@ void IdDialog::negativePerson()
|
||||
|
||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEGATIVE) ;
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id), RsOpinion::NEGATIVE);
|
||||
}
|
||||
|
||||
requestIdDetails();
|
||||
@ -2690,7 +2701,7 @@ void IdDialog::neutralPerson()
|
||||
|
||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEUTRAL) ;
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id), RsOpinion::NEUTRAL);
|
||||
}
|
||||
|
||||
requestIdDetails();
|
||||
@ -2703,9 +2714,9 @@ void IdDialog::positivePerson()
|
||||
{
|
||||
QTreeWidgetItem *item = *it ;
|
||||
|
||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||
std::string Id = item->text(RSID_COL_KEYID).toStdString();
|
||||
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_POSITIVE) ;
|
||||
rsReputations->setOwnOpinion(RsGxsId(Id), RsOpinion::POSITIVE);
|
||||
}
|
||||
|
||||
requestIdDetails();
|
||||
|
@ -300,9 +300,17 @@ void ChatLobbyDialog::initParticipantsContextMenu(QMenu *contextMnu, QList<RsGxs
|
||||
{
|
||||
distantChatAct->setEnabled(true);
|
||||
sendMessageAct->setEnabled(true);
|
||||
votePositiveAct->setEnabled(rsReputations->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_POSITIVE);
|
||||
voteNeutralAct->setEnabled((rsReputations->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_POSITIVE) || (rsReputations->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_NEGATIVE) );
|
||||
voteNegativeAct->setEnabled(rsReputations->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_NEGATIVE);
|
||||
votePositiveAct->setEnabled(
|
||||
rsReputations->overallReputationLevel(gxsid) !=
|
||||
RsReputationLevel::LOCALLY_POSITIVE );
|
||||
voteNeutralAct->setEnabled(
|
||||
( rsReputations->overallReputationLevel(gxsid) ==
|
||||
RsReputationLevel::LOCALLY_POSITIVE ) ||
|
||||
( rsReputations->overallReputationLevel(gxsid) ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE ) );
|
||||
voteNegativeAct->setEnabled(
|
||||
rsReputations->overallReputationLevel(gxsid) !=
|
||||
RsReputationLevel::LOCALLY_NEGATIVE );
|
||||
muteAct->setEnabled(true);
|
||||
muteAct->setChecked(isParticipantMuted(gxsid));
|
||||
}
|
||||
@ -319,16 +327,15 @@ void ChatLobbyDialog::voteParticipant()
|
||||
|
||||
QList<RsGxsId> idList = act->data().value<QList<RsGxsId>>();
|
||||
|
||||
RsReputations::Opinion op = RsReputations::OPINION_NEUTRAL ;
|
||||
if (act == votePositiveAct)
|
||||
op = RsReputations::OPINION_POSITIVE;
|
||||
if (act == voteNegativeAct)
|
||||
op = RsReputations::OPINION_NEGATIVE;
|
||||
RsOpinion op = RsOpinion::NEUTRAL;
|
||||
if (act == votePositiveAct) op = RsOpinion::POSITIVE;
|
||||
if (act == voteNegativeAct) op = RsOpinion::NEGATIVE;
|
||||
|
||||
for (QList<RsGxsId>::iterator item = idList.begin(); item != idList.end(); ++item)
|
||||
{
|
||||
rsReputations->setOwnOpinion(*item, op);
|
||||
std::cerr << "Giving opinion to GXS id " << *item << " to " << op << std::endl;
|
||||
std::cerr << "Giving opinion to GXS id " << *item << " to "
|
||||
<< static_cast<uint32_t>(op) << std::endl;
|
||||
}
|
||||
|
||||
updateParticipantsList();
|
||||
|
@ -84,7 +84,8 @@ void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||
if(icon_index > mMaxLevelToDisplay)
|
||||
return ;
|
||||
|
||||
QIcon icon = GxsIdDetails::getReputationIcon(RsReputations::ReputationLevel(icon_index),0xff);
|
||||
QIcon icon = GxsIdDetails::getReputationIcon(
|
||||
RsReputationLevel(icon_index), 0xff );
|
||||
|
||||
QPixmap pix = icon.pixmap(r.size());
|
||||
|
||||
@ -937,8 +938,9 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, QLi
|
||||
|
||||
QString GxsIdDetails::getName(const RsIdentityDetails &details)
|
||||
{
|
||||
if(details.mReputation.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
return tr("[Banned]") ;
|
||||
if( details.mReputation.mOverallReputationLevel ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
return tr("[Banned]");
|
||||
|
||||
QString name = QString::fromUtf8(details.mNickname.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE);
|
||||
|
||||
@ -956,7 +958,8 @@ QString GxsIdDetails::getComment(const RsIdentityDetails &details)
|
||||
QString comment;
|
||||
QString nickname ;
|
||||
|
||||
bool banned = (details.mReputation.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE);
|
||||
bool banned = ( details.mReputation.mOverallReputationLevel ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE );
|
||||
|
||||
if(details.mNickname.empty())
|
||||
nickname = tr("[Unknown]") ;
|
||||
@ -997,19 +1000,27 @@ QString nickname ;
|
||||
return comment;
|
||||
}
|
||||
|
||||
QIcon GxsIdDetails::getReputationIcon(RsReputations::ReputationLevel icon_index,uint32_t min_reputation)
|
||||
QIcon GxsIdDetails::getReputationIcon(
|
||||
RsReputationLevel icon_index, uint32_t min_reputation )
|
||||
{
|
||||
if( icon_index >= min_reputation ) return QIcon(REPUTATION_VOID) ;
|
||||
if( static_cast<uint32_t>(icon_index) >= min_reputation )
|
||||
return QIcon(REPUTATION_VOID);
|
||||
|
||||
switch(icon_index)
|
||||
{
|
||||
case RsReputations::REPUTATION_LOCALLY_NEGATIVE: return QIcon(REPUTATION_LOCALLY_NEGATIVE_ICON) ; break ;
|
||||
case RsReputations::REPUTATION_LOCALLY_POSITIVE: return QIcon(REPUTATION_LOCALLY_POSITIVE_ICON) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_POSITIVE: return QIcon(REPUTATION_REMOTELY_POSITIVE_ICON) ; break ;
|
||||
case RsReputations::REPUTATION_REMOTELY_NEGATIVE: return QIcon(REPUTATION_REMOTELY_NEGATIVE_ICON) ; break ;
|
||||
case RsReputations::REPUTATION_NEUTRAL: return QIcon(REPUTATION_NEUTRAL_ICON) ; break ;
|
||||
default:
|
||||
std::cerr << "Asked for unidentified icon index " << icon_index << std::endl;
|
||||
case RsReputationLevel::LOCALLY_NEGATIVE:
|
||||
return QIcon(REPUTATION_LOCALLY_NEGATIVE_ICON);
|
||||
case RsReputationLevel::LOCALLY_POSITIVE:
|
||||
return QIcon(REPUTATION_LOCALLY_POSITIVE_ICON);
|
||||
case RsReputationLevel::REMOTELY_POSITIVE:
|
||||
return QIcon(REPUTATION_REMOTELY_POSITIVE_ICON);
|
||||
case RsReputationLevel::REMOTELY_NEGATIVE:
|
||||
return QIcon(REPUTATION_REMOTELY_NEGATIVE_ICON);
|
||||
case RsReputationLevel::NEUTRAL:
|
||||
return QIcon(REPUTATION_NEUTRAL_ICON);
|
||||
default:
|
||||
std::cerr << "Asked for unidentified icon index "
|
||||
<< static_cast<uint32_t>(icon_index) << std::endl;
|
||||
return QIcon(); // dont draw anything
|
||||
}
|
||||
}
|
||||
@ -1018,7 +1029,8 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
|
||||
{
|
||||
QPixmap pix ;
|
||||
|
||||
if(details.mReputation.mOverallReputationLevel == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if( details.mReputation.mOverallReputationLevel ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
{
|
||||
icons.clear() ;
|
||||
icons.push_back(QIcon(IMAGE_BANNED)) ;
|
||||
|
@ -49,7 +49,8 @@ typedef void (*GxsIdDetailsCallbackFunction)(GxsIdDetailsType type, const RsIden
|
||||
class ReputationItemDelegate: public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
ReputationItemDelegate(RsReputations::ReputationLevel max_level_to_display) : mMaxLevelToDisplay(max_level_to_display) {}
|
||||
ReputationItemDelegate(RsReputationLevel max_level_to_display) :
|
||||
mMaxLevelToDisplay(static_cast<uint32_t>(max_level_to_display)) {}
|
||||
|
||||
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
|
||||
@ -96,7 +97,8 @@ public:
|
||||
static QString getNameForType(GxsIdDetailsType type, const RsIdentityDetails &details);
|
||||
|
||||
static QIcon getLoadingIcon(const RsGxsId &id);
|
||||
static QIcon getReputationIcon(RsReputations::ReputationLevel icon_index, uint32_t min_reputation);
|
||||
static QIcon getReputationIcon(
|
||||
RsReputationLevel icon_index, uint32_t min_reputation );
|
||||
|
||||
static void GenerateCombinedPixmap(QPixmap &pixmap, const QList<QIcon> &icons, int iconSize);
|
||||
|
||||
|
@ -149,30 +149,34 @@ void GxsIdRSTreeWidgetItem::setAvatar(const RsGxsImage &avatar)
|
||||
|
||||
QVariant GxsIdRSTreeWidgetItem::data(int column, int role) const
|
||||
{
|
||||
if (column == idColumn())
|
||||
{
|
||||
if (role == Qt::ToolTipRole)
|
||||
{
|
||||
QString t = RSTreeWidgetItem::data(column, role).toString();
|
||||
QImage pix;
|
||||
if (column == idColumn())
|
||||
{
|
||||
if (role == Qt::ToolTipRole)
|
||||
{
|
||||
QString t = RSTreeWidgetItem::data(column, role).toString();
|
||||
QImage pix;
|
||||
|
||||
if(mId.isNull())
|
||||
return RSTreeWidgetItem::data(column, role);
|
||||
else if(rsReputations->overallReputationLevel(mId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
pix = QImage(BANNED_IMAGE) ;
|
||||
else if (mAvatar.mSize == 0 || !pix.loadFromData(mAvatar.mData, mAvatar.mSize, "PNG"))
|
||||
pix = GxsIdDetails::makeDefaultIcon(mId);
|
||||
if(mId.isNull()) return RSTreeWidgetItem::data(column, role);
|
||||
else if( rsReputations->overallReputationLevel(mId) ==
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
pix = QImage(BANNED_IMAGE);
|
||||
else if ( mAvatar.mSize == 0 ||
|
||||
!pix.loadFromData(mAvatar.mData, mAvatar.mSize, "PNG") )
|
||||
pix = GxsIdDetails::makeDefaultIcon(mId);
|
||||
|
||||
int S = QFontMetricsF(font(column)).height();
|
||||
int S = QFontMetricsF(font(column)).height();
|
||||
|
||||
QString embeddedImage;
|
||||
if (RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S)) {
|
||||
t = "<table><tr><td>" + embeddedImage + "</td><td>" + t + "</td></table>";
|
||||
}
|
||||
QString embeddedImage;
|
||||
if ( RsHtml::makeEmbeddedImage(
|
||||
pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio,
|
||||
Qt::SmoothTransformation ),
|
||||
embeddedImage, 8*S * 8*S ) )
|
||||
t = "<table><tr><td>" + embeddedImage + "</td><td>" + t
|
||||
+ "</td></table>";
|
||||
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
return RSTreeWidgetItem::data(column, role);
|
||||
return RSTreeWidgetItem::data(column, role);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
bool mIdFound;
|
||||
bool mBannedState ;
|
||||
bool mRetryWhenFailed;
|
||||
RsReputations::ReputationLevel mReputationLevel ;
|
||||
RsReputationLevel mReputationLevel;
|
||||
uint32_t mIconTypeMask;
|
||||
RsGxsImage mAvatar;
|
||||
};
|
||||
|
@ -824,19 +824,20 @@ void RsGxsForumModel::convertMsgToPostEntry(const RsGxsForumGroup& mForumGroup,c
|
||||
void RsGxsForumModel::computeReputationLevel(uint32_t forum_sign_flags,ForumModelPostEntry& fentry)
|
||||
{
|
||||
uint32_t idflags =0;
|
||||
RsReputations::ReputationLevel reputation_level = rsReputations->overallReputationLevel(fentry.mAuthorId,&idflags) ;
|
||||
RsReputationLevel reputation_level =
|
||||
rsReputations->overallReputationLevel(fentry.mAuthorId, &idflags);
|
||||
bool redacted = false;
|
||||
|
||||
if(reputation_level == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
if(reputation_level == RsReputationLevel::LOCALLY_NEGATIVE)
|
||||
fentry.mPostFlags |= ForumModelPostEntry::FLAG_POST_IS_REDACTED;
|
||||
else
|
||||
fentry.mPostFlags &= ~ForumModelPostEntry::FLAG_POST_IS_REDACTED;
|
||||
|
||||
// We use a specific item model for forums in order to handle the post pinning.
|
||||
|
||||
if(reputation_level == RsReputations::REPUTATION_UNKNOWN)
|
||||
if(reputation_level == RsReputationLevel::UNKNOWN)
|
||||
fentry.mReputationWarningLevel = 3 ;
|
||||
else if(reputation_level == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
else if(reputation_level == RsReputationLevel::LOCALLY_NEGATIVE)
|
||||
fentry.mReputationWarningLevel = 2 ;
|
||||
else if(reputation_level < rsGxsForums->minReputationForForwardingMessages(forum_sign_flags,idflags))
|
||||
fentry.mReputationWarningLevel = 1 ;
|
||||
@ -1301,7 +1302,7 @@ void RsGxsForumModel::debug_dump()
|
||||
}
|
||||
#endif
|
||||
|
||||
void RsGxsForumModel::setAuthorOpinion(const QModelIndex& indx,RsReputations::Opinion op)
|
||||
void RsGxsForumModel::setAuthorOpinion(const QModelIndex& indx, RsOpinion op)
|
||||
{
|
||||
if(!indx.isValid())
|
||||
return ;
|
||||
@ -1312,7 +1313,8 @@ void RsGxsForumModel::setAuthorOpinion(const QModelIndex& indx,RsReputations::Op
|
||||
if(!convertRefPointerToTabEntry(ref,entry) || entry >= mPosts.size())
|
||||
return ;
|
||||
|
||||
std::cerr << "Setting own opinion for author " << mPosts[entry].mAuthorId << " to " << op << std::endl;
|
||||
std::cerr << "Setting own opinion for author " << mPosts[entry].mAuthorId
|
||||
<< " to " << static_cast<uint32_t>(op) << std::endl;
|
||||
RsGxsId author_id = mPosts[entry].mAuthorId;
|
||||
|
||||
rsReputations->setOwnOpinion(author_id,op) ;
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
|
||||
void setMsgReadStatus(const QModelIndex &i, bool read_status, bool with_children);
|
||||
void setFilter(int column, const QStringList &strings, uint32_t &count) ;
|
||||
void setAuthorOpinion(const QModelIndex& indx,RsReputations::Opinion op);
|
||||
void setAuthorOpinion(const QModelIndex& indx,RsOpinion op);
|
||||
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
@ -770,17 +770,17 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||
|
||||
QAction *flagaspositiveAct = new QAction(QIcon(IMAGE_POSITIVE_OPINION), tr("Give positive opinion"), &contextMnu);
|
||||
flagaspositiveAct->setToolTip(tr("This will block/hide messages from this person, and notify friend nodes.")) ;
|
||||
flagaspositiveAct->setData(RsReputations::OPINION_POSITIVE) ;
|
||||
flagaspositiveAct->setData(static_cast<uint32_t>(RsOpinion::POSITIVE));
|
||||
connect(flagaspositiveAct, SIGNAL(triggered()), this, SLOT(flagperson()));
|
||||
|
||||
QAction *flagasneutralAct = new QAction(QIcon(IMAGE_NEUTRAL_OPINION), tr("Give neutral opinion"), &contextMnu);
|
||||
flagasneutralAct->setToolTip(tr("Doing this, you trust your friends to decide to forward this message or not.")) ;
|
||||
flagasneutralAct->setData(RsReputations::OPINION_NEUTRAL) ;
|
||||
flagasneutralAct->setData(static_cast<uint32_t>(RsOpinion::NEUTRAL));
|
||||
connect(flagasneutralAct, SIGNAL(triggered()), this, SLOT(flagperson()));
|
||||
|
||||
QAction *flagasnegativeAct = new QAction(QIcon(IMAGE_NEGATIVE_OPINION), tr("Give negative opinion"), &contextMnu);
|
||||
flagasnegativeAct->setToolTip(tr("This will block/hide messages from this person, and notify friend nodes.")) ;
|
||||
flagasnegativeAct->setData(RsReputations::OPINION_NEGATIVE) ;
|
||||
flagasnegativeAct->setData(static_cast<uint32_t>(RsOpinion::NEGATIVE));
|
||||
connect(flagasnegativeAct, SIGNAL(triggered()), this, SLOT(flagperson()));
|
||||
|
||||
QAction *newthreadAct = new QAction(QIcon(IMAGE_MESSAGE), tr("Start New Thread"), &contextMnu);
|
||||
@ -876,19 +876,19 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||
#endif
|
||||
contextMnu.addSeparator();
|
||||
|
||||
RsReputations::Opinion op ;
|
||||
RsOpinion op;
|
||||
|
||||
if(!rsIdentity->isOwnId(current_post.mAuthorId) && rsReputations->getOwnOpinion(current_post.mAuthorId,op))
|
||||
{
|
||||
QMenu *submenu1 = contextMnu.addMenu(tr("Author's reputation")) ;
|
||||
|
||||
if(op != RsReputations::OPINION_POSITIVE)
|
||||
if(op != RsOpinion::POSITIVE)
|
||||
submenu1->addAction(flagaspositiveAct);
|
||||
|
||||
if(op != RsReputations::OPINION_NEUTRAL)
|
||||
if(op != RsOpinion::NEUTRAL)
|
||||
submenu1->addAction(flagasneutralAct);
|
||||
|
||||
if(op != RsReputations::OPINION_NEGATIVE)
|
||||
if(op != RsOpinion::NEGATIVE)
|
||||
submenu1->addAction(flagasnegativeAct);
|
||||
}
|
||||
|
||||
@ -1294,8 +1294,10 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t overall_reputation = rsReputations->overallReputationLevel(msg.mMeta.mAuthorId) ;
|
||||
bool redacted = (overall_reputation == RsReputations::REPUTATION_LOCALLY_NEGATIVE) ;
|
||||
RsReputationLevel overall_reputation =
|
||||
rsReputations->overallReputationLevel(msg.mMeta.mAuthorId);
|
||||
bool redacted =
|
||||
(overall_reputation == RsReputationLevel::LOCALLY_NEGATIVE);
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate();
|
||||
@ -1621,9 +1623,12 @@ void GxsForumThreadWidget::flagperson()
|
||||
return;
|
||||
}
|
||||
|
||||
RsReputations::Opinion opinion = static_cast<RsReputations::Opinion>(qobject_cast<QAction*>(sender())->data().toUInt());
|
||||
RsOpinion opinion =
|
||||
static_cast<RsOpinion>(
|
||||
qobject_cast<QAction*>(sender())->data().toUInt() );
|
||||
|
||||
mThreadModel->setAuthorOpinion(mThreadProxyModel->mapToSource(getCurrentIndex()),opinion);
|
||||
mThreadModel->setAuthorOpinion(
|
||||
mThreadProxyModel->mapToSource(getCurrentIndex()), opinion );
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::replytoforummessage() { async_msg_action( &GxsForumThreadWidget::replyForumMessageData ); }
|
||||
|
@ -38,12 +38,12 @@ PeoplePage::PeoplePage(QWidget * parent, Qt::WindowFlags flags)
|
||||
connect(ui.autoAddFriendIdsAsContact_CB,SIGNAL(toggled(bool)),this,SLOT(updateAutoAddFriendIdsAsContact()));
|
||||
}
|
||||
|
||||
void PeoplePage::updateAutoPositiveOpinion() { rsReputations->setNodeAutoPositiveOpinionForContacts(ui.autoPositiveOpinion_CB->isChecked()) ; }
|
||||
void PeoplePage::updateAutoPositiveOpinion() { rsReputations->setAutoPositiveOpinionForContacts(ui.autoPositiveOpinion_CB->isChecked()) ; }
|
||||
|
||||
void PeoplePage::updateThresholdForRemotelyPositiveReputation() { rsReputations->setThresholdForRemotelyPositiveReputation(ui.thresholdForPositive_SB->value()); }
|
||||
void PeoplePage::updateThresholdForRemotelyNegativeReputation() { rsReputations->setThresholdForRemotelyNegativeReputation(ui.thresholdForNegative_SB->value()); }
|
||||
|
||||
void PeoplePage::updateRememberDeletedNodes() { rsReputations->setRememberDeletedNodesThreshold(ui.preventReloadingBannedIdentitiesFor_SB->value()); }
|
||||
void PeoplePage::updateRememberDeletedNodes() { rsReputations->setRememberBannedIdThreshold(ui.preventReloadingBannedIdentitiesFor_SB->value()); }
|
||||
void PeoplePage::updateDeleteBannedNodesThreshold() { rsIdentity->setDeleteBannedNodesThreshold(ui.deleteBannedIdentitiesAfter_SB->value());}
|
||||
void PeoplePage::updateAutoAddFriendIdsAsContact() { rsIdentity->setAutoAddFriendIdsAsContact(ui.autoAddFriendIdsAsContact_CB->isChecked()) ; }
|
||||
|
||||
@ -54,7 +54,7 @@ PeoplePage::~PeoplePage()
|
||||
/** Loads the settings for this page */
|
||||
void PeoplePage::load()
|
||||
{
|
||||
bool auto_positive_contacts = rsReputations->nodeAutoPositiveOpinionForContacts() ;
|
||||
bool auto_positive_contacts = rsReputations->autoPositiveOpinionForContacts() ;
|
||||
uint32_t threshold_for_positive = rsReputations->thresholdForRemotelyPositiveReputation();
|
||||
uint32_t threshold_for_negative = rsReputations->thresholdForRemotelyNegativeReputation();
|
||||
bool auto_add_friend_ids_as_contact = rsIdentity->autoAddFriendIdsAsContact();
|
||||
@ -64,5 +64,5 @@ void PeoplePage::load()
|
||||
whileBlocking(ui.thresholdForPositive_SB )->setValue(threshold_for_positive);
|
||||
whileBlocking(ui.thresholdForNegative_SB )->setValue(threshold_for_negative);
|
||||
whileBlocking(ui.deleteBannedIdentitiesAfter_SB )->setValue(rsIdentity->deleteBannedNodesThreshold());
|
||||
whileBlocking(ui.preventReloadingBannedIdentitiesFor_SB)->setValue(rsReputations->rememberDeletedNodesThreshold());
|
||||
whileBlocking(ui.preventReloadingBannedIdentitiesFor_SB)->setValue(rsReputations->rememberBannedIdThreshold());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user