mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-24 15:05:35 -04:00
fixed display of reputation
This commit is contained in:
parent
40d6c3c973
commit
ac620d9077
3 changed files with 45 additions and 33 deletions
|
@ -226,7 +226,7 @@ IdDialog::IdDialog(QWidget *parent)
|
||||||
connect(ui->editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity()));
|
connect(ui->editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity()));
|
||||||
connect(ui->chatIdentity, SIGNAL(triggered()), this, SLOT(chatIdentity()));
|
connect(ui->chatIdentity, SIGNAL(triggered()), this, SLOT(chatIdentity()));
|
||||||
|
|
||||||
connect(ui->idTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection()));
|
connect(ui->idTreeWidget->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(updateSelection()));
|
||||||
connect(ui->idTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));
|
connect(ui->idTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));
|
||||||
|
|
||||||
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||||
|
@ -1283,6 +1283,7 @@ void IdDialog::updateSelection()
|
||||||
{
|
{
|
||||||
auto id = RsGxsGroupId(getSelectedIdentity());
|
auto id = RsGxsGroupId(getSelectedIdentity());
|
||||||
|
|
||||||
|
std::cerr << "updating selection to id " << id << std::endl;
|
||||||
if(id != mId)
|
if(id != mId)
|
||||||
{
|
{
|
||||||
mId = id;
|
mId = id;
|
||||||
|
@ -2042,8 +2043,13 @@ std::list<RsGxsId> IdDialog::getSelectedIdentities() const
|
||||||
std::list<RsGxsId> res;
|
std::list<RsGxsId> res;
|
||||||
|
|
||||||
for(auto indx:selectedIndexes)
|
for(auto indx:selectedIndexes)
|
||||||
|
{
|
||||||
|
RsGxsId id;
|
||||||
|
|
||||||
if(indx.column() == RsIdentityListModel::COLUMN_THREAD_NAME) // this removes duplicates
|
if(indx.column() == RsIdentityListModel::COLUMN_THREAD_NAME) // this removes duplicates
|
||||||
res.push_back(mIdListModel->getIdentity(indx));
|
if( !(id = mIdListModel->getIdentity(indx)).isNull() )
|
||||||
|
res.push_back(id);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -2232,7 +2238,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||||
|
|
||||||
if(n_is_not_a_contact == 0)
|
if(n_is_not_a_contact == 0)
|
||||||
contextMenu->addAction(FilesDefs::getIconFromQtResourcePath(":/icons/cancel.svg"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
|
contextMenu->addAction(FilesDefs::getIconFromQtResourcePath(":/icons/cancel.svg"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
|
||||||
|
}
|
||||||
if (n_selected_items==1)
|
if (n_selected_items==1)
|
||||||
contextMenu->addAction(QIcon(""),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ;
|
contextMenu->addAction(QIcon(""),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ;
|
||||||
|
|
||||||
|
@ -2255,8 +2261,6 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||||
contextMenu->addAction(FilesDefs::getIconFromQtResourcePath(":/icons/cancel.svg"),tr("Delete identity"),this,SLOT(removeIdentity())) ;
|
contextMenu->addAction(FilesDefs::getIconFromQtResourcePath(":/icons/cancel.svg"),tr("Delete identity"),this,SLOT(removeIdentity())) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//contextMenu = ui->idTreeWidget->createStandardContextMenu(contextMenu);
|
//contextMenu = ui->idTreeWidget->createStandardContextMenu(contextMenu);
|
||||||
|
|
||||||
contextMenu->exec(QCursor::pos());
|
contextMenu->exec(QCursor::pos());
|
||||||
|
|
|
@ -567,7 +567,6 @@ QVariant RsIdentityListModel::displayRole(const EntryIndex& e, int col) const
|
||||||
case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(det.mNickname.c_str()));
|
case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(det.mNickname.c_str()));
|
||||||
case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(det.mId.toStdString()) );
|
case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(det.mId.toStdString()) );
|
||||||
case COLUMN_THREAD_OWNER: return QVariant(QString::fromStdString(det.mPgpId.toStdString()) );
|
case COLUMN_THREAD_OWNER: return QVariant(QString::fromStdString(det.mPgpId.toStdString()) );
|
||||||
case COLUMN_THREAD_REPUTATION: return QVariant(QString::number((uint8_t)det.mReputation.mOverallReputationLevel));
|
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -579,7 +578,7 @@ QVariant RsIdentityListModel::displayRole(const EntryIndex& e, int col) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function makes sure that the internal data gets updated. They are situations where the otification system cannot
|
// This function makes sure that the internal data gets updated. They are situations where the notification system cannot
|
||||||
// send the information about changes, such as when the computer is put on sleep.
|
// send the information about changes, such as when the computer is put on sleep.
|
||||||
|
|
||||||
void RsIdentityListModel::checkInternalData(bool force)
|
void RsIdentityListModel::checkInternalData(bool force)
|
||||||
|
@ -616,12 +615,8 @@ const RsIdentityListModel::HierarchicalIdentityInformation *RsIdentityListModel:
|
||||||
|
|
||||||
QVariant RsIdentityListModel::decorationRole(const EntryIndex& entry,int col) const
|
QVariant RsIdentityListModel::decorationRole(const EntryIndex& entry,int col) const
|
||||||
{
|
{
|
||||||
if(col > 0)
|
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
switch(entry.type)
|
switch(entry.type)
|
||||||
{
|
{
|
||||||
|
|
||||||
case ENTRY_TYPE_CATEGORY:
|
case ENTRY_TYPE_CATEGORY:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
|
@ -632,12 +627,20 @@ QVariant RsIdentityListModel::decorationRole(const EntryIndex& entry,int col) co
|
||||||
if(!hn)
|
if(!hn)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
|
if(col == COLUMN_THREAD_REPUTATION)
|
||||||
|
return QVariant( static_cast<uint8_t>(rsReputations->overallReputationLevel(hn->id)) );
|
||||||
|
else if(col == COLUMN_THREAD_NAME)
|
||||||
|
{
|
||||||
QPixmap sslAvatar;
|
QPixmap sslAvatar;
|
||||||
AvatarDefs::getAvatarFromGxsId(hn->id, sslAvatar);
|
AvatarDefs::getAvatarFromGxsId(hn->id, sslAvatar);
|
||||||
|
|
||||||
return QVariant(QIcon(sslAvatar));
|
return QVariant(QIcon(sslAvatar));
|
||||||
}
|
}
|
||||||
default: return QVariant();
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,12 @@ void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||||
const QRect r = option.rect;
|
const QRect r = option.rect;
|
||||||
|
|
||||||
// get pixmap
|
// get pixmap
|
||||||
unsigned int icon_index = qvariant_cast<unsigned int>(index.data(Qt::DecorationRole));
|
auto v = index.data(Qt::DecorationRole);
|
||||||
|
|
||||||
|
if(!v.canConvert(QVariant::Int))
|
||||||
|
return;
|
||||||
|
|
||||||
|
unsigned int icon_index = qvariant_cast<unsigned int>(v);
|
||||||
|
|
||||||
if(icon_index > mMaxLevelToDisplay)
|
if(icon_index > mMaxLevelToDisplay)
|
||||||
return ;
|
return ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue