mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 00:07:09 -05: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,7 +1369,7 @@ RsServiceInfo::RsServiceInfo(
|
|||||||
const uint16_t min_version_major,
|
const uint16_t min_version_major,
|
||||||
const uint16_t min_version_minor)
|
const uint16_t min_version_minor)
|
||||||
:mServiceName(service_name),
|
:mServiceName(service_name),
|
||||||
mServiceType((((uint32_t) RS_PKT_VERSION_SERVICE) << 24) + (((uint32_t) service_type) << 8)),
|
mServiceType(RsServiceInfoUIn16ToFullServiceId(service_type)),
|
||||||
mVersionMajor(version_major),
|
mVersionMajor(version_major),
|
||||||
mVersionMinor(version_minor),
|
mVersionMinor(version_minor),
|
||||||
mMinVersionMajor(min_version_major),
|
mMinVersionMajor(min_version_major),
|
||||||
@ -1378,6 +1378,11 @@ RsServiceInfo::RsServiceInfo(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(uint16_t serviceType)
|
||||||
|
{
|
||||||
|
return (((uint32_t) RS_PKT_VERSION_SERVICE) << 24) + (((uint32_t) serviceType) << 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RsServiceInfo::RsServiceInfo()
|
RsServiceInfo::RsServiceInfo()
|
||||||
:mServiceName("unknown"),
|
:mServiceName("unknown"),
|
||||||
|
@ -53,6 +53,8 @@ class RsServiceInfo
|
|||||||
// minimum version can communicate with.
|
// minimum version can communicate with.
|
||||||
uint16_t mMinVersionMajor;
|
uint16_t mMinVersionMajor;
|
||||||
uint16_t mMinVersionMinor;
|
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())
|
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)
|
if(ui.service_CB->count() <= indx)
|
||||||
ui.service_CB->addItem(sname + " (0x"+QString::number(*it,16)+")",QVariant(*it)) ;
|
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())
|
if(ownServices.mServiceList.find(service_id) == ownServices.mServiceList.end())
|
||||||
rsServiceControl->getOwnServices(ownServices);
|
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)
|
static QString getVirtualPeerStatusString(uint8_t status)
|
||||||
@ -574,7 +574,7 @@ void GxsNetTunnelsDialog::updateDisplay()
|
|||||||
for(auto it(groups.begin());it!=groups.end();++it)
|
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")
|
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(getServiceNameString(it->second.service_id))
|
||||||
.arg(QString::fromStdString(it->first.toStdString()))
|
.arg(QString::fromStdString(it->first.toStdString()))
|
||||||
.arg(getGroupPolicyString(it->second.group_policy))
|
.arg(getGroupPolicyString(it->second.group_policy))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user