added central server setting

This commit is contained in:
Volker Fischer 2011-05-02 19:48:36 +00:00
parent 99432273c8
commit d3b9f90f45
12 changed files with 885 additions and 715 deletions

View file

@ -27,27 +27,29 @@
/* Implementation *************************************************************/
CClient::CClient ( const quint16 iPortNumber ) :
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
strName ( "" ),
Channel ( false ), /* we need a client channel -> "false" */
bDoAutoSockBufSize ( true ),
iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ),
bCeltDoHighQuality ( false ),
bUseStereo ( false ),
Socket ( &Channel, &ConnLessProtocol, iPortNumber ),
Sound ( AudioCallback, this ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ),
bReverbOnLeftChan ( false ),
iReverbLevel ( 0 ),
iSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED ),
iSndCrdFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED ),
bSndCrdConversionBufferRequired ( false ),
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
strName ( "" ),
Channel ( false ), /* we need a client channel -> "false" */
bDoAutoSockBufSize ( true ),
iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ),
bCeltDoHighQuality ( false ),
bUseStereo ( false ),
Socket ( &Channel, &ConnLessProtocol, iPortNumber ),
Sound ( AudioCallback, this ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ),
bReverbOnLeftChan ( false ),
iReverbLevel ( 0 ),
iSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED ),
iSndCrdFrameSizeFactor ( FRAME_SIZE_FACTOR_PREFERRED ),
bSndCrdConversionBufferRequired ( false ),
iSndCardMonoBlockSizeSamConvBuff ( 0 ),
bFraSiFactPrefSupported ( false ),
bFraSiFactDefSupported ( false ),
bFraSiFactSafeSupported ( false ),
bOpenChatOnNewMessage ( true ),
eGUIDesign ( GD_ORIGINAL )
bFraSiFactPrefSupported ( false ),
bFraSiFactDefSupported ( false ),
bFraSiFactSafeSupported ( false ),
bOpenChatOnNewMessage ( true ),
eGUIDesign ( GD_ORIGINAL ),
strCentralServerAddress ( "" ),
bUseDefaultCentralServerAddress ( true )
{
// init audio encoder/decoder (mono)
CeltModeMono = celt_mode_create (

View file

@ -106,6 +106,18 @@ public:
bool GetUseStereo() const { return bUseStereo; }
void SetUseStereo ( const bool bNUseStereo );
void SetServerListCentralServerAddress ( const QString& sNCentServAddr )
{ strCentralServerAddress = sNCentServAddr; }
QString GetServerListCentralServerAddress()
{ return strCentralServerAddress; }
void SetUseDefaultCentralServerAddress ( const bool bNUDCSeAddr )
{ bUseDefaultCentralServerAddress = bNUDCSeAddr; }
bool GetUseDefaultCentralServerAddress()
{ return bUseDefaultCentralServerAddress; }
int GetAudioInFader() const { return iAudioInFader; }
void SetAudioInFader ( const int iNV ) { iAudioInFader = iNV; }
@ -290,6 +302,9 @@ protected:
bool bOpenChatOnNewMessage;
EGUIDesign eGUIDesign;
QString strCentralServerAddress;
bool bUseDefaultCentralServerAddress;
CVector<int16_t> vecsAudioSndCrdMono;
CVector<double> vecdAudioStereo;
CVector<int16_t> vecsNetwork;
@ -323,7 +338,6 @@ signals:
int iPingTime,
int iNumClients );
void Disconnected();
void Stopped();
};
#endif /* !defined ( CLIENT_HOIHGE76GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */

File diff suppressed because it is too large Load diff

View file

@ -71,6 +71,7 @@ protected:
void UpdateJitterBufferFrame();
void UpdateSoundCardFrame();
void UpdateSoundChannelSelectionFrame();
void UpdateCentralServerDependency();
QString GenSndCrdBufferDelayString ( const int iFrameSize,
const QString strAddText = "" );
@ -90,6 +91,8 @@ protected:
void OnGUIDesignFancyStateChanged ( int value );
void OnUseHighQualityAudioStateChanged ( int value );
void OnUseStereoStateChanged ( int value );
void OnDefaultCentralServerStateChanged ( int value );
void OnLineEditCentralServerAddressEditingFinished();
void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button );
void OnSoundCrdSelection ( int iSndDevIdx );
void OnSndCrdLeftInChannelSelection ( int iChanIdx );

View file

@ -192,7 +192,7 @@
<item>
<widget class="QComboBox" name="cbSoundcard" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -442,6 +442,34 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="LabelCentralServerAddress" >
<property name="text" >
<string>Central Server Address:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbDefaultCentralServer" >
<property name="text" >
<string>Default</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLineEdit" name="LineEditCentralServerAddress" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
@ -450,7 +478,7 @@
<property name="sizeHint" >
<size>
<width>201</width>
<height>81</height>
<height>21</height>
</size>
</property>
</spacer>
@ -610,6 +638,25 @@
<header>multicolorled.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>cbAutoJitBuf</tabstop>
<tabstop>SliderNetBuf</tabstop>
<tabstop>cbSoundcard</tabstop>
<tabstop>cbLInChan</tabstop>
<tabstop>cbRInChan</tabstop>
<tabstop>cbLOutChan</tabstop>
<tabstop>cbROutChan</tabstop>
<tabstop>rButBufferDelayPreferred</tabstop>
<tabstop>rButBufferDelayDefault</tabstop>
<tabstop>rButBufferDelaySafe</tabstop>
<tabstop>ButtonDriverSetup</tabstop>
<tabstop>cbOpenChatOnNewMessage</tabstop>
<tabstop>cbGUIDesignFancy</tabstop>
<tabstop>cbUseHighQualityAudio</tabstop>
<tabstop>cbUseStereo</tabstop>
<tabstop>cbDefaultCentralServer</tabstop>
<tabstop>LineEditCentralServerAddress</tabstop>
</tabstops>
<resources>
<include location="resources.qrc" />
</resources>

View file

@ -28,6 +28,7 @@
/* Implementation *************************************************************/
CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
: QDialog ( parent, f ),
strCentralServerAddress ( "" ),
strSelectedAddress ( "" ),
bServerListReceived ( false ),
bStateOK ( false ),
@ -93,8 +94,12 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
this, SLOT ( OnTimerReRequestServList() ) );
}
void CConnectDlg::LoadStoredServers ( const CVector<QString>& vstrIPAddresses )
void CConnectDlg::Init ( const QString strNewCentralServerAddr,
const CVector<QString>& vstrIPAddresses )
{
// take central server address string
strCentralServerAddress = strNewCentralServerAddr;
// load stored IP addresses in combo box
LineEditServerAddr->clear();
for ( int iLEIdx = 0; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; iLEIdx++ )
@ -120,15 +125,10 @@ void CConnectDlg::showEvent ( QShowEvent* )
// clear server list view
ListViewServers->clear();
// TEST
QString strNAddr = "llcon.dyndns.org:22122";
// get the IP address of the central server (using the ParseNetworAddress
// function) when the connect dialog is opened, this seems to be the correct
// time to do it
if ( LlconNetwUtil().ParseNetworkAddress ( strNAddr,
if ( LlconNetwUtil().ParseNetworkAddress ( strCentralServerAddress,
CentralServerAddress ) )
{
// send the request for the server list

View file

@ -56,11 +56,12 @@ class CConnectDlg : public QDialog, private Ui_CConnectDlgBase
public:
CConnectDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
void Init ( const QString strNewCentralServerAddr,
const CVector<QString>& vstrIPAddresses );
void SetServerList ( const CHostAddress& InetAddr,
const CVector<CServerInfo>& vecServerInfo );
void LoadStoredServers ( const CVector<QString>& vstrNewIPAddresses );
void SetPingTimeAndNumClientsResult ( CHostAddress& InetAddr,
const int iPingTime,
const int iPingTimeLEDColor,
@ -76,6 +77,7 @@ protected:
QTimer TimerPing;
QTimer TimerReRequestServList;
QString strCentralServerAddress;
CHostAddress CentralServerAddress;
CVector<QString> vstrIPAddresses;
QString strSelectedAddress;

View file

@ -24,9 +24,18 @@
<layout class="QVBoxLayout" >
<item>
<widget class="QTreeWidget" name="ListViewServers" >
<property name="editTriggers" >
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="tabKeyNavigation" >
<bool>true</bool>
</property>
<property name="rootIsDecorated" >
<bool>false</bool>
</property>
<property name="itemsExpandable" >
<bool>false</bool>
</property>
<column>
<property name="text" >
<string>Server Name</string>

View file

@ -375,10 +375,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
SIGNAL ( Disconnected() ),
this, SLOT ( OnDisconnected() ) );
QObject::connect ( pClient,
SIGNAL ( Stopped() ),
this, SLOT ( OnStopped() ) );
QObject::connect ( pClient,
SIGNAL ( ChatTextReceived ( QString ) ),
this, SLOT ( OnChatTextReceived ( QString ) ) );
@ -510,11 +506,6 @@ void CLlconClientDlg::OnConnectDisconBut()
ConnectDisconnect ( !pClient->IsRunning() );
}
void CLlconClientDlg::OnStopped()
{
ConnectDisconnect ( false );
}
void CLlconClientDlg::OnOpenGeneralSettings()
{
// open general settings dialog
@ -734,8 +725,19 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
// start/stop client, set button text
if ( bDoStart )
{
// get the central server address string
QString strCurCentServAddr;
if ( pClient->GetUseDefaultCentralServerAddress() )
{
strCurCentServAddr = DEFAULT_SERVER_ADDRESS;
}
else
{
strCurCentServAddr = pClient->GetServerListCentralServerAddress();
}
// init the connect dialog and execute it (modal dialog)
ConnectDlg.LoadStoredServers ( pClient->vstrIPAddress );
ConnectDlg.Init ( strCurCentServAddr, pClient->vstrIPAddress );
ConnectDlg.exec();
// check if state is OK (e.g., no Cancel was pressed)

View file

@ -155,7 +155,6 @@ public slots:
{ ConnectDlg.SetServerList ( InetAddr, vecServerInfo ); }
void OnDisconnected();
void OnStopped();
void OnGUIDesignChanged()
{ SetGUIDesign ( pClient->GetGUIDesign() ); }

View file

@ -121,10 +121,6 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP,
vecpListViewItems[i]->setHidden ( true );
}
// update central server name line edit
LineEditCentralServerAddress->setText (
pServer->GetServerListCentralServerAddress() );
// update default central server address check box
if ( pServer->GetUseDefaultCentralServerAddress() )
{
@ -348,9 +344,8 @@ void CLlconServerDlg::UpdateGUIDependencies()
// if register server is not enabled, we disable all the configuration
// controls for the server list
cbDefaultCentralServer->setEnabled ( bCurSerListEnabled );
LineEditCentralServerAddress->setEnabled ( bCurSerListEnabled );
GroupBoxServerInfo->setEnabled ( bCurSerListEnabled );
cbDefaultCentralServer->setEnabled ( bCurSerListEnabled );
GroupBoxServerInfo->setEnabled ( bCurSerListEnabled );
// If the default central server address is enabled, the line edit shows
// the default server and is not editable. Make sure the line edit does not

View file

@ -188,6 +188,16 @@ void CSettings::ReadIniFile ( const QString& sFileName )
{
pClient->SetUseStereo ( bValue );
}
// central server address
pClient->SetServerListCentralServerAddress (
GetIniSetting ( IniXMLDocument, "client", "centralservaddr" ) );
// use default central server address flag
if ( GetFlagIniSet ( IniXMLDocument, "client", "defcentservaddr", bValue ) )
{
pClient->SetUseDefaultCentralServerAddress ( bValue );
}
}
else
{
@ -306,6 +316,14 @@ void CSettings::WriteIniFile ( const QString& sFileName )
// flag whether stereo mode is used
SetFlagIniSet ( IniXMLDocument, "client", "stereoaudio",
pClient->GetUseStereo() );
// central server address
PutIniSetting ( IniXMLDocument, "client", "centralservaddr",
pClient->GetServerListCentralServerAddress() );
// use default central server address flag
SetFlagIniSet ( IniXMLDocument, "client", "defcentservaddr",
pClient->GetUseDefaultCentralServerAddress() );
}
else
{