move country flag function in new class CLocale
This commit is contained in:
parent
339457298c
commit
1d4342bb7c
5 changed files with 23 additions and 20 deletions
|
@ -403,8 +403,7 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo )
|
|||
if ( cChanInfo.eCountry != QLocale::AnyCountry )
|
||||
{
|
||||
// try to load the country flag icon
|
||||
QPixmap CountryFlagPixmap (
|
||||
CCountyFlagIcons::GetResourceReference ( cChanInfo.eCountry ) );
|
||||
QPixmap CountryFlagPixmap ( CLocale::GetCountryFlagIconsResourceReference ( cChanInfo.eCountry ) );
|
||||
|
||||
// first check if resource reference was valid
|
||||
if ( CountryFlagPixmap.isNull() )
|
||||
|
|
|
@ -330,7 +330,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
|||
static_cast<QLocale::Country> ( iCurCntry );
|
||||
|
||||
// get resource file name
|
||||
CurFlagIcon.addFile ( CCountyFlagIcons::GetResourceReference ( eCountry ) );
|
||||
CurFlagIcon.addFile ( CLocale::GetCountryFlagIconsResourceReference ( eCountry ) );
|
||||
|
||||
// get the country name
|
||||
sCurCountryName = QLocale::countryToString ( eCountry );
|
||||
|
|
|
@ -371,7 +371,7 @@ void CConnectDlg::SetConnClientsList ( const CHostAddress& InetAddr,
|
|||
{
|
||||
// try to load the country flag icon
|
||||
QPixmap CountryFlagPixmap (
|
||||
CCountyFlagIcons::GetResourceReference ( vecChanInfo[i].eCountry ) );
|
||||
CLocale::GetCountryFlagIconsResourceReference ( vecChanInfo[i].eCountry ) );
|
||||
|
||||
// first check if resource reference was valid
|
||||
if ( !CountryFlagPixmap.isNull() )
|
||||
|
|
19
src/util.cpp
19
src/util.cpp
|
@ -612,7 +612,7 @@ CMusProfDlg::CMusProfDlg ( CClient* pNCliP,
|
|||
|
||||
// try to load icon from resource file name
|
||||
QIcon CurFlagIcon;
|
||||
CurFlagIcon.addFile ( CCountyFlagIcons::GetResourceReference ( eCountry ) );
|
||||
CurFlagIcon.addFile ( CLocale::GetCountryFlagIconsResourceReference ( eCountry ) );
|
||||
|
||||
// only add the entry if a flag is available
|
||||
if ( !CurFlagIcon.isNull() )
|
||||
|
@ -889,21 +889,26 @@ bool NetworkUtil::ParseNetworkAddress ( QString strAddress,
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
CHostAddress NetworkUtil::GetLocalAddress()
|
||||
{
|
||||
QTcpSocket socket;
|
||||
socket.connectToHost ( WELL_KNOWN_HOST, WELL_KNOWN_PORT );
|
||||
if (socket.waitForConnected( IP_LOOKUP_TIMEOUT )) {
|
||||
|
||||
if ( socket.waitForConnected ( IP_LOOKUP_TIMEOUT ) )
|
||||
{
|
||||
return CHostAddress ( socket.localAddress(), 0 );
|
||||
} else {
|
||||
qWarning()
|
||||
<< "could not determine local IPv4 address:"
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "could not determine local IPv4 address:"
|
||||
<< socket.errorString()
|
||||
<< "- using localhost";
|
||||
|
||||
return CHostAddress( QHostAddress::LocalHost, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Instrument picture data base ------------------------------------------------
|
||||
CVector<CInstPictures::CInstPictProps>& CInstPictures::GetTable()
|
||||
{
|
||||
|
@ -988,7 +993,7 @@ QString CInstPictures::GetName ( const int iInstrument )
|
|||
|
||||
|
||||
// Country flag icon data base -------------------------------------------------
|
||||
QString CCountyFlagIcons::GetResourceReference ( const QLocale::Country eCountry )
|
||||
QString CLocale::GetCountryFlagIconsResourceReference ( const QLocale::Country eCountry )
|
||||
{
|
||||
QString strReturn = "";
|
||||
|
||||
|
|
|
@ -734,12 +734,11 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
// Country flag icon data base -------------------------------------------------
|
||||
// this is a pure static class
|
||||
class CCountyFlagIcons
|
||||
// Locale management class -----------------------------------------------------
|
||||
class CLocale
|
||||
{
|
||||
public:
|
||||
static QString GetResourceReference ( const QLocale::Country eCountry );
|
||||
static QString GetCountryFlagIconsResourceReference ( const QLocale::Country eCountry );
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue