mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-20 13:19:07 -04:00
finished backend part for identity usage statistics
This commit is contained in:
parent
a9670a569a
commit
2919058652
5 changed files with 44 additions and 13 deletions
|
@ -1879,12 +1879,12 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),det) ;
|
||||
|
||||
QString usage_txt ;
|
||||
std::map<time_t,std::string> rmap ;
|
||||
for(std::map<std::string,time_t>::const_iterator it(det.mUseCases.begin());it!=det.mUseCases.end();++it)
|
||||
std::map<time_t,RsIdentityUsage> rmap ;
|
||||
for(std::map<RsIdentityUsage,time_t>::const_iterator it(det.mUseCases.begin());it!=det.mUseCases.end();++it)
|
||||
rmap.insert(std::make_pair(it->second,it->first)) ;
|
||||
|
||||
for(std::map<time_t,std::string>::const_iterator it(rmap.begin());it!=rmap.end();++it)
|
||||
usage_txt += QString("<b>")+ getHumanReadableDuration(now - data.mLastUsageTS) + "</b> \t: " + QString::fromStdString(it->second) + "<br/>" ;
|
||||
for(std::map<time_t,RsIdentityUsage>::const_iterator it(rmap.begin());it!=rmap.end();++it)
|
||||
usage_txt += QString("<b>")+ getHumanReadableDuration(now - data.mLastUsageTS) + "</b> \t: " + createUsageString(it->second) + "<br/>" ;
|
||||
|
||||
if(usage_txt.isNull())
|
||||
usage_txt = tr("<b>[No record in current session]</b>") ;
|
||||
|
@ -1892,6 +1892,16 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||
ui->usageStatistics_TB->setText(usage_txt) ;
|
||||
}
|
||||
|
||||
QString IdDialog::createUsageString(const RsIdentityUsage& u) const
|
||||
{
|
||||
switch(u.mUsageCode)
|
||||
{
|
||||
#warning TODO! Add the different strings and translations here.
|
||||
default:
|
||||
return QString("Undone yet");
|
||||
}
|
||||
}
|
||||
|
||||
void IdDialog::modifyReputation()
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
|
|
|
@ -119,6 +119,7 @@ private slots:
|
|||
|
||||
private:
|
||||
void processSettings(bool load);
|
||||
QString createUsageString(const RsIdentityUsage& u) const;
|
||||
|
||||
void requestIdDetails();
|
||||
void insertIdDetails(uint32_t token);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue