mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1311 from sehraf/pr_improve_service_id
Add wrapper function to convert uint16_t service IDs to internal unsi…
This commit is contained in:
commit
77d5dfe18d
@ -1369,13 +1369,18 @@ RsServiceInfo::RsServiceInfo(
|
||||
const uint16_t min_version_major,
|
||||
const uint16_t min_version_minor)
|
||||
:mServiceName(service_name),
|
||||
mServiceType((((uint32_t) RS_PKT_VERSION_SERVICE) << 24) + (((uint32_t) service_type) << 8)),
|
||||
mServiceType(RsServiceInfoUIn16ToFullServiceId(service_type)),
|
||||
mVersionMajor(version_major),
|
||||
mVersionMinor(version_minor),
|
||||
mMinVersionMajor(min_version_major),
|
||||
mMinVersionMinor(min_version_minor)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(uint16_t serviceType)
|
||||
{
|
||||
return (((uint32_t) RS_PKT_VERSION_SERVICE) << 24) + (((uint32_t) serviceType) << 8);
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,6 +53,8 @@ class RsServiceInfo
|
||||
// minimum version can communicate with.
|
||||
uint16_t mMinVersionMajor;
|
||||
uint16_t mMinVersionMinor;
|
||||
|
||||
static unsigned int RsServiceInfoUIn16ToFullServiceId(uint16_t serviceType);
|
||||
};
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@ void BandwidthStatsWidget::updateComboBoxes()
|
||||
{
|
||||
if(*it != ui.service_CB->itemData(indx).toInt())
|
||||
{
|
||||
QString sname = QString::fromUtf8(service_info_map.mServiceList[ ((*it)<<8) + 0x02000000].mServiceName.c_str()) ;
|
||||
QString sname = QString::fromUtf8(service_info_map.mServiceList[RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(*it)].mServiceName.c_str()) ;
|
||||
|
||||
if(ui.service_CB->count() <= indx)
|
||||
ui.service_CB->addItem(sname + " (0x"+QString::number(*it,16)+")",QVariant(*it)) ;
|
||||
|
@ -468,7 +468,7 @@ static QString getServiceNameString(uint16_t service_id)
|
||||
if(ownServices.mServiceList.find(service_id) == ownServices.mServiceList.end())
|
||||
rsServiceControl->getOwnServices(ownServices);
|
||||
|
||||
return QString::fromUtf8(ownServices.mServiceList[service_id].mServiceName.c_str()) ;
|
||||
return QString::fromUtf8(ownServices.mServiceList[RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(service_id)].mServiceName.c_str()) ;
|
||||
}
|
||||
|
||||
static QString getVirtualPeerStatusString(uint8_t status)
|
||||
@ -574,7 +574,7 @@ void GxsNetTunnelsDialog::updateDisplay()
|
||||
for(auto it(groups.begin());it!=groups.end();++it)
|
||||
{
|
||||
painter.drawText(ox+4*cellx,oy+celly,tr("Service: %1 (%2) - Group ID: %3,\t policy: %4, \tstatus: %5, \tlast contact: %6")
|
||||
.arg(QString::number(it->second.service_id))
|
||||
.arg("0x" + QString::number(it->second.service_id, 16))
|
||||
.arg(getServiceNameString(it->second.service_id))
|
||||
.arg(QString::fromStdString(it->first.toStdString()))
|
||||
.arg(getGroupPolicyString(it->second.group_policy))
|
||||
|
Loading…
Reference in New Issue
Block a user