added support for Central Server (North America) (Ticket #50), small bug fix for the Mac audio interface

This commit is contained in:
Volker Fischer 2020-04-11 14:27:50 +02:00
parent 1d4342bb7c
commit 82f5ad18f4
19 changed files with 175 additions and 138 deletions

View file

@ -466,7 +466,7 @@ QString CSound::CheckDeviceCapabilities ( const int iDriverIdx )
// store the input and out number of channels for this device
iNumInChan = CountChannels ( audioInputDevice[iDriverIdx], true );
iNumOutChan = CountChannels ( audioInputDevice[iDriverIdx], false );
iNumOutChan = CountChannels ( audioOutputDevice[iDriverIdx], false );
// clip the number of input/output channels to our allowed maximum
if ( iNumInChan > MAX_NUM_IN_OUT_CHANNELS )

View file

@ -69,7 +69,7 @@ CClient::CClient ( const quint16 iPortNumber,
bDisplayChannelLevels ( true ),
bJitterBufferOK ( true ),
strCentralServerAddress ( "" ),
bUseDefaultCentralServerAddress ( true ),
eCentralServerAddressType ( AT_DEFAULT ),
iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL )
{
int iOpusError;

View file

@ -137,17 +137,11 @@ public:
EAudChanConf GetAudioChannels() const { return eAudioChannelConf; }
void SetAudioChannels ( const EAudChanConf eNAudChanConf );
void SetServerListCentralServerAddress ( const QString& sNCentServAddr )
{ strCentralServerAddress = sNCentServAddr; }
void SetServerListCentralServerAddress ( const QString& sNCentServAddr ) { strCentralServerAddress = sNCentServAddr; }
QString GetServerListCentralServerAddress() { return strCentralServerAddress; }
QString GetServerListCentralServerAddress()
{ return strCentralServerAddress; }
void SetUseDefaultCentralServerAddress ( const bool bNUDCSeAddr )
{ bUseDefaultCentralServerAddress = bNUDCSeAddr; }
bool GetUseDefaultCentralServerAddress()
{ return bUseDefaultCentralServerAddress; }
void SetCentralServerAddressType ( const ECSAddType eNCSAT ) { eCentralServerAddressType = eNCSAT; }
ECSAddType GetCentralServerAddressType() { return eCentralServerAddressType; }
int GetAudioInFader() const { return iAudioInFader; }
void SetAudioInFader ( const int iNV ) { iAudioInFader = iNV; }
@ -370,7 +364,7 @@ protected:
bool bJitterBufferOK;
QString strCentralServerAddress;
bool bUseDefaultCentralServerAddress;
ECSAddType eCentralServerAddressType;
CVector<int16_t> vecsAudioSndCrdMono;

View file

@ -816,8 +816,8 @@ void CClientDlg::ShowConnectionSetupDialog()
{
// get the central server address string
const QString strCurCentServAddr =
SELECT_SERVER_ADDRESS ( pClient->GetUseDefaultCentralServerAddress(),
pClient->GetServerListCentralServerAddress() );
NetworkUtil::GetCentralServerAddress ( pClient->GetCentralServerAddressType(),
pClient->GetServerListCentralServerAddress() );
// init the connect dialog
ConnectDlg.Init ( strCurCentServAddr, pClient->vstrIPAddress );

View file

@ -244,19 +244,16 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
// central server address
QString strCentrServAddr = tr ( "<b>Central Server Address:</b> The "
"central server address is the IP address or URL of the central server "
"at which the server list of the connection dialog is managed. If the "
"Default check box is checked, the default central server address is "
"shown read-only." );
"at which the server list of the connection dialog is managed. With the "
"central server address type either the local region can be selected of "
"the default central servers or a manual address can be specified." );
lblCentralServerAddress->setWhatsThis ( strCentrServAddr );
chbDefaultCentralServer->setWhatsThis ( strCentrServAddr );
cbxCentServAddrType->setWhatsThis ( strCentrServAddr );
edtCentralServerAddress->setWhatsThis ( strCentrServAddr );
chbDefaultCentralServer->setAccessibleName (
tr ( "Default central server check box" ) );
edtCentralServerAddress->setAccessibleName (
tr ( "Central server address line edit" ) );
cbxCentServAddrType->setAccessibleName ( tr ( "Default central server type combo box" ) );
edtCentralServerAddress->setAccessibleName ( tr ( "Central server address line edit" ) );
// current connection status parameter
QString strConnStats = tr ( "<b>Current Connection Status "
@ -346,15 +343,12 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
cbxAudioQuality->addItem ( "High" ); // AQ_HIGH
cbxAudioQuality->setCurrentIndex ( static_cast<int> ( pClient->GetAudioQuality() ) );
// update default central server address check box
if ( pClient->GetUseDefaultCentralServerAddress() )
{
chbDefaultCentralServer->setCheckState ( Qt::Checked );
}
else
{
chbDefaultCentralServer->setCheckState ( Qt::Unchecked );
}
// central server address type combo box
cbxCentServAddrType->clear();
cbxCentServAddrType->addItem ( "Manual" ); // AT_MANUAL
cbxCentServAddrType->addItem ( "Default" ); // AT_DEFAULT
cbxCentServAddrType->addItem ( "Default (North America)" ); // AT_NORTH_AMERICA
cbxCentServAddrType->setCurrentIndex ( static_cast<int> ( pClient->GetCentralServerAddressType() ) );
UpdateCentralServerDependency();
// update new client fader level edit box
@ -401,9 +395,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
QObject::connect ( chbAutoJitBuf, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnAutoJitBufStateChanged ( int ) ) );
QObject::connect ( chbDefaultCentralServer, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnDefaultCentralServerStateChanged ( int ) ) );
// line edits
QObject::connect ( edtCentralServerAddress, SIGNAL ( editingFinished() ),
this, SLOT ( OnCentralServerAddressEditingFinished() ) );
@ -433,6 +424,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
QObject::connect ( cbxAudioQuality, SIGNAL ( activated ( int ) ),
this, SLOT ( OnAudioQualityActivated ( int ) ) );
QObject::connect ( cbxCentServAddrType, SIGNAL ( activated ( int ) ),
this, SLOT ( OnCentServAddrTypeActivated ( int ) ) );
// buttons
QObject::connect ( butDriverSetup, SIGNAL ( clicked() ),
this, SLOT ( OnDriverSetupClicked() ) );
@ -591,8 +585,7 @@ void CClientSettingsDlg::UpdateSoundChannelSelectionFrame()
void CClientSettingsDlg::UpdateCentralServerDependency()
{
const bool bCurUseDefCentServAddr =
pClient->GetUseDefaultCentralServerAddress();
const bool bCurUseDefCentServAddr = ( pClient->GetCentralServerAddressType() != AT_MANUAL );
// make sure the line edit does not fire signals when we update the text
edtCentralServerAddress->blockSignals ( true );
@ -696,6 +689,15 @@ void CClientSettingsDlg::OnAudioQualityActivated ( int iQualityIdx )
UpdateDisplay(); // upload rate will be changed
}
void CClientSettingsDlg::OnCentServAddrTypeActivated ( int iTypeIdx )
{
// apply new setting to the client
pClient->SetCentralServerAddressType ( static_cast<ECSAddType> ( iTypeIdx ) );
// update GUI dependencies
UpdateCentralServerDependency();
}
void CClientSettingsDlg::OnAutoJitBufStateChanged ( int value )
{
pClient->SetDoAutoSockBufSize ( value == Qt::Checked );
@ -722,15 +724,6 @@ void CClientSettingsDlg::OnDisplayChannelLevelsStateChanged ( int value )
emit DisplayChannelLevelsChanged();
}
void CClientSettingsDlg::OnDefaultCentralServerStateChanged ( int value )
{
// apply new setting to the client
pClient->SetUseDefaultCentralServerAddress ( value == Qt::Checked );
// update GUI dependencies
UpdateCentralServerDependency();
}
void CClientSettingsDlg::OnCentralServerAddressEditingFinished()
{
// store new setting in the client

View file

@ -91,7 +91,6 @@ protected:
void OnAutoJitBufStateChanged ( int value );
void OnGUIDesignFancyStateChanged ( int value );
void OnDisplayChannelLevelsStateChanged ( int value );
void OnDefaultCentralServerStateChanged ( int value );
void OnCentralServerAddressEditingFinished();
void OnNewClientLevelEditingFinished();
void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button );
@ -102,6 +101,7 @@ protected:
void OnROutChanActivated ( int iChanIdx );
void OnAudioChannelsActivated ( int iChanIdx );
void OnAudioQualityActivated ( int iQualityIdx );
void OnCentServAddrTypeActivated ( int iTypeIdx );
void OnDriverSetupClicked();
signals:

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>567</width>
<height>351</height>
<height>371</height>
</rect>
</property>
<property name="windowTitle">
@ -557,11 +557,7 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="chbDefaultCentralServer">
<property name="text">
<string>Default</string>
</property>
</widget>
<widget class="QComboBox" name="cbxCentServAddrType"/>
</item>
</layout>
</item>
@ -731,7 +727,7 @@
<tabstop>edtNewClientLevel</tabstop>
<tabstop>chbGUIDesignFancy</tabstop>
<tabstop>chbDisplayChannelLevels</tabstop>
<tabstop>chbDefaultCentralServer</tabstop>
<tabstop>cbxCentServAddrType</tabstop>
<tabstop>edtCentralServerAddress</tabstop>
</tabstops>
<resources>

View file

@ -105,7 +105,6 @@ LED bar: lbr
// default server address
#define DEFAULT_SERVER_ADDRESS "jamulus.fischvolk.de"
#define DEFAULT_SERVER_NAME "Central Server"
#define SELECT_SERVER_ADDRESS(a, b) ((a) ? (DEFAULT_SERVER_ADDRESS) : (b))
// download URL
#define LLCON_DOWNLOAD_URL "http://sourceforge.net/projects/llcon/files"

View file

@ -545,11 +545,6 @@ int main ( int argc, char** argv )
eLicenceType );
if ( bUseGUI )
{
// special case for the GUI mode: as the default we want to use
// the default central server address (if not given in the
// settings file)
Server.SetUseDefaultCentralServerAddress ( true );
// special case for the GUI mode: we want the licenct type to be
// creative commons per default (if not given in the settings file)
Server.SetLicenceType ( LT_CREATIVECOMMONS );

View file

@ -219,7 +219,8 @@ If enabled, the channel input level for each connected client will be displayed
![Central server address](centralserveraddress.png)
The central server address is the IP address or URL of the central server at which the server list of the connection
dialog is managed. If the Default check box is checked, the default central server address is shown read-only.
dialog is managed. With the central server address type either the local region can be selected of the default
central servers or a manual address can be specified.
### Current connection status parameter

View file

@ -168,11 +168,11 @@ public:
QString GetServerListCentralServerAddress()
{ return ServerListManager.GetCentralServerAddress(); }
void SetUseDefaultCentralServerAddress ( const bool bNUDCSeAddr )
{ ServerListManager.SetUseDefaultCentralServerAddress ( bNUDCSeAddr ); }
void SetCentralServerAddressType ( const ECSAddType eNCSAT )
{ ServerListManager.SetCentralServerAddressType ( eNCSAT ); }
bool GetUseDefaultCentralServerAddress()
{ return ServerListManager.GetUseDefaultCentralServerAddress(); }
ECSAddType GetCentralServerAddressType()
{ return ServerListManager.GetCentralServerAddressType(); }
void SetServerName ( const QString& strNewName )
{ ServerListManager.SetServerName ( strNewName ); }

View file

@ -73,18 +73,16 @@ CServerDlg::CServerDlg ( CServer* pNServP,
// central server address
QString strCentrServAddr = tr ( "<b>Central Server Address:</b> The "
"Central server address is the IP address or URL of the central server "
"at which this server is registered. If the Default check box is "
"checked, the default central server address is shown read-only." );
"at which this server is registered. With the central server address "
"type either the local region can be selected of the default central "
"servers or a manual address can be specified." );
lblCentralServerAddress->setWhatsThis ( strCentrServAddr );
chbDefaultCentralServer->setWhatsThis ( strCentrServAddr );
cbxCentServAddrType->setWhatsThis ( strCentrServAddr );
edtCentralServerAddress->setWhatsThis ( strCentrServAddr );
chbDefaultCentralServer->setAccessibleName (
tr ( "Default central server check box" ) );
edtCentralServerAddress->setAccessibleName (
tr ( "Central server address line edit" ) );
cbxCentServAddrType->setAccessibleName ( tr ( "Default central server type combo box" ) );
edtCentralServerAddress->setAccessibleName ( tr ( "Central server address line edit" ) );
// server name
QString strServName = tr ( "<b>Server Name:</b> The server name identifies "
@ -183,15 +181,12 @@ lvwClients->setMinimumHeight ( 140 );
vecpListViewItems[i]->setHidden ( true );
}
// update default central server address check box
if ( pServer->GetUseDefaultCentralServerAddress() )
{
chbDefaultCentralServer->setCheckState ( Qt::Checked );
}
else
{
chbDefaultCentralServer->setCheckState ( Qt::Unchecked );
}
// central server address type combo box
cbxCentServAddrType->clear();
cbxCentServAddrType->addItem ( "Manual" ); // AT_MANUAL
cbxCentServAddrType->addItem ( "Default" ); // AT_DEFAULT
cbxCentServAddrType->addItem ( "Default (North America)" ); // AT_NORTH_AMERICA
cbxCentServAddrType->setCurrentIndex ( static_cast<int> ( pServer->GetCentralServerAddressType() ) );
// update server name line edit
edtServerName->setText ( pServer->GetServerName() );
@ -293,9 +288,6 @@ lvwClients->setMinimumHeight ( 140 );
QObject::connect ( chbRegisterServer, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnRegisterServerStateChanged ( int ) ) );
QObject::connect ( chbDefaultCentralServer, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnDefaultCentralServerStateChanged ( int ) ) );
QObject::connect ( chbStartOnOSStart, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnStartOnOSStartStateChanged ( int ) ) );
@ -316,6 +308,9 @@ lvwClients->setMinimumHeight ( 140 );
QObject::connect ( cbxLocationCountry, SIGNAL ( activated ( int ) ),
this, SLOT ( OnLocationCountryActivated ( int ) ) );
QObject::connect ( cbxCentServAddrType, SIGNAL ( activated ( int ) ),
this, SLOT ( OnCentServAddrTypeActivated ( int ) ) );
// timers
QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) );
@ -372,16 +367,6 @@ void CServerDlg::OnUseCCLicenceStateChanged ( int value )
}
}
void CServerDlg::OnDefaultCentralServerStateChanged ( int value )
{
// apply new setting to the server and update it
pServer->SetUseDefaultCentralServerAddress ( value == Qt::Checked );
pServer->UpdateServerList();
// update GUI dependencies
UpdateGUIDependencies();
}
void CServerDlg::OnRegisterServerStateChanged ( int value )
{
const bool bRegState = ( value == Qt::Checked );
@ -451,6 +436,16 @@ void CServerDlg::OnLocationCountryActivated ( int iCntryListItem )
pServer->UpdateServerList();
}
void CServerDlg::OnCentServAddrTypeActivated ( int iTypeIdx )
{
// apply new setting to the server and update it
pServer->SetCentralServerAddressType ( static_cast<ECSAddType> ( iTypeIdx ) );
pServer->UpdateServerList();
// update GUI dependencies
UpdateGUIDependencies();
}
void CServerDlg::OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason )
{
// on double click on the icon, show window in fore ground
@ -515,13 +510,12 @@ void CServerDlg::UpdateGUIDependencies()
// get the states which define the GUI dependencies from the server
const bool bCurSerListEnabled = pServer->GetServerListEnabled();
const bool bCurUseDefCentServAddr =
pServer->GetUseDefaultCentralServerAddress();
const bool bCurUseDefCentServAddr = ( pServer->GetCentralServerAddressType() != AT_MANUAL );
// if register server is not enabled, we disable all the configuration
// controls for the server list
chbDefaultCentralServer->setEnabled ( bCurSerListEnabled );
grbServerInfo->setEnabled ( bCurSerListEnabled );
cbxCentServAddrType->setEnabled ( bCurSerListEnabled );
grbServerInfo->setEnabled ( bCurSerListEnabled );
// make sure the line edit does not fire signals when we update the text
edtCentralServerAddress->blockSignals ( true );

View file

@ -84,13 +84,13 @@ public slots:
void OnAboutToQuit() { pSettings->Save(); }
void OnRegisterServerStateChanged ( int value );
void OnDefaultCentralServerStateChanged ( int value );
void OnStartOnOSStartStateChanged ( int value );
void OnUseCCLicenceStateChanged ( int value );
void OnCentralServerAddressEditingFinished();
void OnServerNameTextChanged ( const QString& strNewName );
void OnLocationCityTextChanged ( const QString& strNewCity );
void OnLocationCountryActivated ( int iCntryListItem );
void OnCentServAddrTypeActivated ( int iTypeIdx );
void OnTimer();
void OnServerStarted() { UpdateSystemTrayIcon ( true ); }
void OnServerStopped() { UpdateSystemTrayIcon ( false ); }

View file

@ -82,11 +82,7 @@
<widget class="QLineEdit" name="edtCentralServerAddress"/>
</item>
<item>
<widget class="QCheckBox" name="chbDefaultCentralServer">
<property name="text">
<string>Default</string>
</property>
</widget>
<widget class="QComboBox" name="cbxCentServAddrType"/>
</item>
</layout>
</item>
@ -190,7 +186,7 @@
<tabstop>chbUseCCLicence</tabstop>
<tabstop>chbRegisterServer</tabstop>
<tabstop>edtCentralServerAddress</tabstop>
<tabstop>chbDefaultCentralServer</tabstop>
<tabstop>cbxCentServAddrType</tabstop>
<tabstop>edtServerName</tabstop>
<tabstop>edtLocationCity</tabstop>
<tabstop>cbxLocationCountry</tabstop>

View file

@ -31,11 +31,11 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
const int iNumChannels,
const bool bNCentServPingServerInList,
CProtocol* pNConLProt )
: iPortNumber ( iNPortNum ),
iNumPredefinedServers ( 0 ),
bUseDefaultCentralServerAddress ( false ), // must be false for the "no GUI" case
bCentServPingServerInList ( bNCentServPingServerInList ),
pConnLessProtocol ( pNConLProt )
: iPortNumber ( iNPortNum ),
iNumPredefinedServers ( 0 ),
eCentralServerAddressType ( AT_MANUAL ), // must be AT_MANUAL for the "no GUI" case
bCentServPingServerInList ( bNCentServPingServerInList ),
pConnLessProtocol ( pNConLProt )
{
// set the central server address
SetCentralServerAddress ( sNCentServAddr );
@ -199,7 +199,7 @@ void CServerListManager::SetCentralServerAddress ( const QString sNCentServAddr
(
( !strCentralServerAddress.toLower().compare ( "localhost" ) ||
!strCentralServerAddress.compare ( "127.0.0.1" ) ) &&
( !bUseDefaultCentralServerAddress )
( eCentralServerAddressType == AT_MANUAL )
);
bEnabled = true;
@ -480,8 +480,8 @@ void CServerListManager::SlaveServerRegisterServer ( const bool bIsRegister )
// get the correct central server address
const QString strCurCentrServAddr =
SELECT_SERVER_ADDRESS ( bUseDefaultCentralServerAddress,
strCentralServerAddress );
NetworkUtil::GetCentralServerAddress ( eCentralServerAddressType,
strCentralServerAddress );
// For the slave server, the slave server properties are stored in the
// very first item in the server list (which is actually no server list

View file

@ -142,11 +142,8 @@ public:
void SetCentralServerAddress ( const QString sNCentServAddr );
QString GetCentralServerAddress() { return strCentralServerAddress; }
void SetUseDefaultCentralServerAddress ( const bool bNUDCSeAddr )
{ bUseDefaultCentralServerAddress = bNUDCSeAddr; }
bool GetUseDefaultCentralServerAddress()
{ return bUseDefaultCentralServerAddress; }
void SetCentralServerAddressType ( const ECSAddType eNCSAT ) { eCentralServerAddressType = eNCSAT; }
ECSAddType GetCentralServerAddressType() { return eCentralServerAddressType; }
bool GetIsCentralServer() const { return bIsCentralServer; }
@ -195,7 +192,7 @@ protected:
int iNumPredefinedServers;
bool bEnabled;
bool bIsCentralServer;
bool bUseDefaultCentralServerAddress;
ECSAddType eCentralServerAddressType;
bool bCentServPingServerInList;
CHostAddress SlaveCurCentServerHostAddress;

View file

@ -274,11 +274,27 @@ void CSettings::Load()
pClient->SetServerListCentralServerAddress (
GetIniSetting ( IniXMLDocument, "client", "centralservaddr" ) );
// use default central server address flag
if ( GetFlagIniSet ( IniXMLDocument, "client", "defcentservaddr", bValue ) )
// central server address type
if ( GetNumericIniSet ( IniXMLDocument, "client", "centservaddrtype",
0, 2 /* AT_NORTH_AMERICA */, iValue ) )
{
pClient->SetUseDefaultCentralServerAddress ( bValue );
pClient->SetCentralServerAddressType ( static_cast<ECSAddType> ( iValue ) );
}
else
{
// if no address type is given, choose one from the operating system locale
pClient->SetCentralServerAddressType ( CLocale::GetCentralServerAddressType ( QLocale::system().country() ) );
}
// TODO compatibility to old version
if ( GetFlagIniSet ( IniXMLDocument, "client", "defcentservaddr", bValue ) )
{
// only the case that manual was set in old ini must be considered
if ( !bValue )
{
pClient->SetCentralServerAddressType ( AT_MANUAL );
}
}
// window position of the main window
pClient->vecWindowPosMain = FromBase64ToByteArray (
@ -328,12 +344,28 @@ void CSettings::Load()
{
// server:
// use default central server address flag (note that it is important
// central server address type (note that it is important
// to set this setting prior to the "central server address")
if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) )
if ( GetNumericIniSet ( IniXMLDocument, "server", "centservaddrtype",
0, 2 /* AT_NORTH_AMERICA */, iValue ) )
{
pServer->SetUseDefaultCentralServerAddress ( bValue );
pServer->SetCentralServerAddressType ( static_cast<ECSAddType> ( iValue ) );
}
else
{
// if no address type is given, choose one from the operating system locale
pServer->SetCentralServerAddressType ( CLocale::GetCentralServerAddressType ( QLocale::system().country() ) );
}
// TODO compatibility to old version
if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) )
{
// only the case that manual was set in old ini must be considered
if ( !bValue )
{
pServer->SetCentralServerAddressType ( AT_MANUAL );
}
}
// central server address (to be set after the "use default central
// server address)
@ -519,9 +551,9 @@ void CSettings::Save()
PutIniSetting ( IniXMLDocument, "client", "centralservaddr",
pClient->GetServerListCentralServerAddress() );
// use default central server address flag
SetFlagIniSet ( IniXMLDocument, "client", "defcentservaddr",
pClient->GetUseDefaultCentralServerAddress() );
// central server address type
SetNumericIniSet ( IniXMLDocument, "client", "centservaddrtype",
static_cast<int> ( pClient->GetCentralServerAddressType() ) );
// window position of the main window
PutIniSetting ( IniXMLDocument, "client", "winposmain_base64",
@ -567,9 +599,9 @@ void CSettings::Save()
PutIniSetting ( IniXMLDocument, "server", "centralservaddr",
pServer->GetServerListCentralServerAddress() );
// use default central server address flag
SetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr",
pServer->GetUseDefaultCentralServerAddress() );
// central server address type
SetNumericIniSet ( IniXMLDocument, "server", "centservaddrtype",
static_cast<int> ( pServer->GetCentralServerAddressType() ) );
// server list enabled flag
SetFlagIniSet ( IniXMLDocument, "server", "servlistenabled",

View file

@ -908,6 +908,17 @@ CHostAddress NetworkUtil::GetLocalAddress()
}
}
QString NetworkUtil::GetCentralServerAddress ( const ECSAddType eCentralServerAddressType,
const QString& strCentralServerAddress )
{
switch ( eCentralServerAddressType )
{
case AT_MANUAL: return strCentralServerAddress;
case AT_NORTH_AMERICA: return QString ( "%1:%2" ).arg ( DEFAULT_SERVER_ADDRESS ).arg ( LLCON_PORT_NUMBER_NORTHAMERICA );
default: return DEFAULT_SERVER_ADDRESS; // AT_DEFAULT
}
}
// Instrument picture data base ------------------------------------------------
CVector<CInstPictures::CInstPictProps>& CInstPictures::GetTable()
@ -992,7 +1003,7 @@ QString CInstPictures::GetName ( const int iInstrument )
}
// Country flag icon data base -------------------------------------------------
// Locale management class -----------------------------------------------------
QString CLocale::GetCountryFlagIconsResourceReference ( const QLocale::Country eCountry )
{
QString strReturn = "";
@ -1248,6 +1259,23 @@ QString CLocale::GetCountryFlagIconsResourceReference ( const QLocale::Country e
return strReturn;
}
ECSAddType CLocale::GetCentralServerAddressType ( const QLocale::Country eCountry )
{
// TODO this is the initial implementation and should be extended in the future,
// maybe there is/will be some function in Qt to get the continent
switch ( eCountry )
{
case QLocale::UnitedStates:
case QLocale::Canada:
case QLocale::Mexico:
case QLocale::Greenland:
return AT_NORTH_AMERICA;
default:
return AT_DEFAULT;
}
}
// Console writer factory ------------------------------------------------------
QTextStream* ConsoleWriterFactory::get()

View file

@ -518,9 +518,9 @@ enum EAudChanConf
enum EAudComprType
{
// used for protocol -> enum values must be fixed!
CT_NONE = 0,
CT_CELT = 1,
CT_OPUS = 2,
CT_NONE = 0,
CT_CELT = 1,
CT_OPUS = 2,
CT_OPUS64 = 3 // using OPUS with 64 samples frame size
};
@ -563,6 +563,15 @@ enum ELicenceType
};
// Central server address type -------------------------------------------------
enum ECSAddType
{
AT_MANUAL = 0,
AT_DEFAULT = 1, // Europe and others
AT_NORTH_AMERICA = 2
};
// Skill level enum ------------------------------------------------------------
enum ESkillLevel
{
@ -738,7 +747,8 @@ protected:
class CLocale
{
public:
static QString GetCountryFlagIconsResourceReference ( const QLocale::Country eCountry );
static QString GetCountryFlagIconsResourceReference ( const QLocale::Country eCountry );
static ECSAddType GetCentralServerAddressType ( const QLocale::Country eCountry );
};
@ -980,6 +990,8 @@ public:
CHostAddress& HostAddress );
static CHostAddress GetLocalAddress();
static QString GetCentralServerAddress ( const ECSAddType eCentralServerAddressType,
const QString& strCentralServerAddress );
};