avoid showing IP address if no name in the musician profile is given #316

This commit is contained in:
Volker Fischer 2020-06-05 14:22:44 +02:00
parent 850883f3fc
commit b1c97c2d36
6 changed files with 12 additions and 46 deletions

View File

@ -14,6 +14,8 @@
- added check in acknowledge message, coded by atsampson (#302)
- avoid showing IP address if no name in the musician profile is given #316
- bug fix: on MacOS declare an activity to ensure the process doesn't get throttled
by OS level Nap, Sleep, and Thread Priority systems, coded by AronVietti (#23)

View File

@ -439,7 +439,7 @@ void CChannelFader::SetText ( const CChannelInfo& ChanInfo )
// break text at predefined position
const int iBreakPos = MAX_LEN_FADER_TAG / 2;
QString strModText = ChanInfo.GenNameForDisplay();
QString strModText = ChanInfo.strName;
if ( strModText.length() > iBreakPos )
{

View File

@ -430,7 +430,7 @@ void CConnectDlg::SetConnClientsList ( const CHostAddress& InetAddr,
pNewChildListViewItem->setFirstColumnSpanned ( true );
// set the clients name
QString sClientText = vecChanInfo[i].GenNameForDisplay();
QString sClientText = vecChanInfo[i].strName;
// set the icon: country flag has priority over instrument
bool bCountryFlagIsUsed = false;

View File

@ -1303,13 +1303,6 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID
// get client name, if name is empty, use IP address instead
QString ChanName = vecChannels[iCurChanID].GetName();
if ( ChanName.isEmpty() )
{
// convert IP address to text and show it
ChanName = vecChannels[iCurChanID].GetAddress().
toString ( CHostAddress::SM_IP_NO_LAST_BYTE );
}
// add time and name of the client at the beginning of the message text and
// use different colors
QString sCurColor = vstrChatColors[iCurChanID % vstrChatColors.Size()];
@ -1552,18 +1545,7 @@ void CServer::WriteHTMLChannelList()
{
if ( vecChannels[i].IsConnected() )
{
QString strCurChanName = vecChannels[i].GetName();
// if text is empty, show IP address instead
if ( strCurChanName.isEmpty() )
{
// convert IP address to text and show it, remove last
// digits
strCurChanName = vecChannels[i].GetAddress().
toString ( CHostAddress::SM_IP_NO_LAST_BYTE );
}
streamFileOut << " <li>" << strCurChanName << "</li>" << endl;
streamFileOut << " <li>" << vecChannels[i].GetName() << "</li>" << endl;
}
}
}

View File

@ -125,7 +125,8 @@ void CSettings::Load()
// name
pClient->ChannelInfo.strName = FromBase64ToString (
GetIniSetting ( IniXMLDocument, "client", "name_base64" ) );
GetIniSetting ( IniXMLDocument, "client", "name_base64",
ToBase64 ( QCoreApplication::translate ( "CMusProfDlg", "No Name" ) ) ) );
// instrument
if ( GetNumericIniSet ( IniXMLDocument, "client", "instrument",

View File

@ -836,11 +836,11 @@ class CChannelCoreInfo
{
public:
CChannelCoreInfo() :
strName ( "" ),
eCountry ( QLocale::AnyCountry ),
strCity ( "" ),
iInstrument ( CInstPictures::GetNotUsedInstrument() ),
eSkillLevel ( SL_NOT_SET ) {}
strName ( "" ),
eCountry ( QLocale::AnyCountry ),
strCity ( "" ),
iInstrument ( CInstPictures::GetNotUsedInstrument() ),
eSkillLevel ( SL_NOT_SET ) {}
CChannelCoreInfo ( const QString NsName,
const QLocale::Country& NeCountry,
@ -917,25 +917,6 @@ public:
iChanID ( NiID ),
iIpAddr ( NiIP ) {}
QString GenNameForDisplay() const
{
// if text is empty, show IP address instead
if ( strName.isEmpty() )
{
// convert IP address to text and show it (use dummy port number
// since it is not used here)
const CHostAddress TempAddr =
CHostAddress ( QHostAddress ( iIpAddr ), 0 );
return TempAddr.toString ( CHostAddress::SM_IP_NO_LAST_BYTE );
}
else
{
// show name of channel
return strName;
}
}
// ID of the channel
int iChanID;