示例#1
0
int CChannelSession::HandleEvent( int event,DWORD dwParam,void* pParam )
{
	switch (event)
	{
	case EVENT_CHANNEL_WRITE_ERRO:
		OnWriteError(event);
		OnDisconnected(event);
		break;
	case EVENT_CHANNEL_READ_ERRO:
		OnReadError(event);
		OnDisconnected(event);
		break;
	default:
		break;
	}
	return 0;
}
示例#2
0
void Twitch::Disconnect() {
	if ( session ) {
		irc_disconnect( session );
		
		status = TWITCH_DISCONNECTED;
		OnDisconnected();
	}
}
示例#3
0
void Client::Disconnect()
{
	if (!_connected)
		return;

	_connected = false;
	Clean();
	OnDisconnected();
}
bool CNetwork_Asio::Disconnect() {
  OnDisconnect();
  //  networkService_->Get_IO_Service()->post([this]() {
  std::error_code ignored;
  socket_.shutdown(asio::socket_base::shutdown_both, ignored);
  OnDisconnected();
  //  });
  return true;
}
示例#5
0
  void ClientSession::Disconnect ()
  {
    isConnected_ = false;

    socket_.Disconnect ();

    user_.RemoveFromWorld ();

    OnDisconnected (*this, yap::EmptyEventArgs ());
  }
void CNetworkLayerTestDlg::DoDisconnect()
{
TRY_CATCH

	m_SendList.AddString( "Disconnecting ..." );
	Stream.Disconnect();
	OnDisconnected(NULL);

CATCH_LOG("CNetworkLayerTestDlg::DoDisconnect")
}
示例#7
0
void LinkageWorker::OnWritable(struct client_t *client)
{
    CLOG.Verbose("LinkageWorker: OnWritable(%p)", client->linkage);
    int ret = client->linkage->OnWritable(this);
    if (ret < 0) {
        OnError(client, false, errno);
    } else if (ret == 0) {
        OnDisconnected(client);
    }
}
示例#8
0
	//--------------------------------------------------------------------------------
	void CPipeConnector::Disconnect()
	{
		_WINQ_FCONTEXT( "CPipeConnector::Disconnect" );
		bool bClosed = m_Pipe.Close();
		m_bConnected = false;
		if( !AsyncConnection() )
		{
			bClosed ? OnDisconnected() : OnDisconnectionError();
		}
	}
示例#9
0
void CHUDManager::Load()
{
	if(pUI){
		pUI->Load			( pUI->UIGame() );
		return;
	}
	pUI					= xr_new<CUI> (this);
	pUI->Load			(NULL);
	OnDisconnected		();
}
示例#10
0
void TMsgCore::OnNewConnection()  // server side
{
  QTcpSocket *socket;
  if (m_tcpServer) socket = m_tcpServer->nextPendingConnection();
  assert(socket);

  bool ret = connect(socket, SIGNAL(readyRead()), SLOT(OnReadyRead()));
  ret = ret && connect(socket, SIGNAL(disconnected()), SLOT(OnDisconnected()));
  assert(ret);
  m_sockets.insert(socket);
}
示例#11
0
  Irc::Irc(const char* host, int port)
  {
    m_host          = host;
    m_port          = port;
    m_connected     = false;
    m_message_queue = new MessageQueue(&m_socket);

    //connect signals
    connect(&m_socket, SIGNAL(connected()), this, SLOT(OnConnected()));
    connect(&m_socket, SIGNAL(disconnected()), this, SLOT(OnDisconnected()));
  }
void CNetworkLayerTestDlg::ReadFromStream()
{
TRY_CATCH

	char buf[MAX_PATH];
	bool rec = Stream.HasInData();// > 0;
	int count = 0;
	char* pbuf = buf;

	if ( rec )
	{
		strcpy_s( buf, MAX_PATH, "Receiving ->" );
		m_ReceiveList.AddString( buf );
		FillMemory( buf, MAX_PATH, 0 );
	}

	while ( Stream.HasInData() )
	{
		try
		{
			Stream.Receive( pbuf, 1 );
		}
		catch(CStreamException &e)
		{
			MLog_Exception(CExceptionBase(e,PREPARE_EXEPTION_MESSAGE(_T(__FUNCTION__))));
			OnDisconnected(NULL);
			return;
		}
		pbuf++;
		count++;
		if ( MAX_PATH - 1 == count )
		{
			m_ReceiveList.AddString( buf );
			FillMemory( buf, MAX_PATH, 0 );
			pbuf = buf;
			count = 0;
		}
	}

	if ( rec )
	{
		if ( count )
			m_ReceiveList.AddString( buf );
		FillMemory( buf, MAX_PATH, 0 );
		strcpy_s( buf, MAX_PATH, "->Received" );
		m_ReceiveList.AddString( buf );
	}

CATCH_LOG("CNetworkLayerTestDlg::ReadFromStream")
}
示例#13
0
int CContentSession::HandleEvent( int event,DWORD dwParam,void* pParam )
{	
	switch (event)
	{
	case EVENT_CONTENT_READTIMEOUT:
		OnReadError(event);
	case EVENT_CONTENT_WRITETIMEOUT:
		OnWriteError(event);
		OnDisconnected(event);
	default:
		break;
	}
	return CChannelSession::HandleEvent(event,dwParam,pParam);
}
示例#14
0
bool CNetwork_Asio::Recv(uint16_t _size /*= 6*/) {
  OnReceive();
  {
    (void)_size;

    std::error_code errorCode;
    int16_t BytesToRead = packet_size_ - packet_offset_;
    asio::async_read(socket_,
                     asio::buffer(&buffer_[packet_offset_], BytesToRead),
                     asio::transfer_exactly(
                         BytesToRead),  // We want at least 6 bytes of data
                     [this](std::error_code errorCode, std::size_t length) {
      packet_offset_ += length;
      if (!errorCode || errorCode.value() == 11) {
        if (OnReceived() == false) {
          log_.eicprintf(
              CL_RESET
              "[%d] Something bad happened in OnReceived... Shutting "
              "down...\n" CL_RESET,
              GetId());
          Shutdown();
        }
      } else {
        if (errorCode.value() == 2) {
          log_.icprintf(CL_RESET CL_WHITE "[%d] Client disconnected.\n",
                        GetId());
          OnDisconnected();
          Shutdown();
        } else {
          log_.eicprintf(
              CL_RESET CL_WHITE
              "[%d] Error occurred[CNetwork_Asio::Recv:%i]: %s\n" CL_RESET,
              GetId(), errorCode.value(), errorCode.message().c_str());

          Shutdown();
          return;
        }
      }
      recv_condition_.notify_all();
      if (active_) Recv();
    });
  }
  return true;
}
示例#15
0
bool
GameServer::DestroyClientConnection(SOCKET sock, DWORD dwErrorCode){
	if( !sock ) return false;
	bool bRet = true;
	m_lockConnections.Lock(); // Lock
	int nIndex = m_arrAcceptedSocks.FindValue((void*)sock);
	if( nIndex != -1 ){
		ClientConnection* pConn = (ClientConnection*)m_arrAcceptedSocks.GetData(nIndex);
		if( !pConn ) {
			m_arrAcceptedSocks.Delete(nIndex);		// Remove socket from list.
			m_lockConnections.Unlock();				// Unlock
			return true;
			}

		bool bTableConn = pConn->IsTableConnection();
		// Set disconnected state.
		Session* pSess = pConn->GetSession(true);
		pConn->SetConnected(false); 
		OnDisconnected(pConn, dwErrorCode);

		if( pSess ){
			// Make session connectionless.
			if( bTableConn )
				pSess->SetTableConnection(pConn->GetTableId(), pConn->GetTournamentId(), NULL, true);
			else
				pSess->SetConnection(NULL, true);	
			// Release session pointer.
			SafePointer::Release(pSess);
			}

		// Release pointer.
		SafePointer::Release(pConn);				
		// Destroy session.
		if( !bTableConn )
			Session::DestroySession(pSess);
		// Remove conection info.
		m_arrAcceptedSocks.Delete(nIndex);		
		}
	else
		bRet = false;
	m_lockConnections.Unlock();		// Unlock
	return bRet;
	}
示例#16
0
int MyServer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: updateTextBrowser((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 1: updateTextBrowserDlg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 2: addtoListWidget((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: deletefromListWidget((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 4: Service(); break;
        case 5: Accept(); break;
        case 6: DisplayError((*reinterpret_cast< QAbstractSocket::SocketError(*)>(_a[1]))); break;
        case 7: OnDisconnected(); break;
        default: ;
        }
        _id -= 8;
    }
    return _id;
}
示例#17
0
void CGateConnector::OnDataAvailable(int iSockIdx)
{

	if (!Buffers[iSockIdx]->receive(Sockets[iSockIdx]))
	{
		OnDisconnected(iSockIdx);
		delete Sockets[iSockIdx];
		Sockets[iSockIdx] = NULL;
		return;
	}

	unsigned short packetSize;

	while (true)
	{
		memcpy(&packetSize, Buffers[iSockIdx]->data() + 1, 2);
		if (packetSize <= Buffers[iSockIdx]->size())
		{
			int _before = Buffers[iSockIdx]->pos();
			unsigned char cKey = Buffers[iSockIdx]->next<unsigned char> ();
			unsigned short dwSize = Buffers[iSockIdx]->next<unsigned short> ();

			if (cKey > 0)
			{
				char * buf = Buffers[iSockIdx]->data();
				for (int i = 0; i < dwSize - 3; i++)
				{
					buf[i] ^= (cKey ^ (dwSize - i - 3));
					buf[i] -= i ^ cKey;
				}
			}

			__Reader(iSockIdx);
			int _readcount = _before - Buffers[iSockIdx]->pos();
			Buffers[iSockIdx]->seek(dwSize - _readcount);
		}
		else
			break;
	}
}
示例#18
0
void ClientConnection::Disconnect()
	{
	if (connectionTCP_)
		{
		connectionTCP_->Disconnect();
		delete connectionTCP_;
		connectionTCP_=0;
		}

	if (connectionUDP_)
		{
		connectionUDP_->Disconnect();
		delete connectionUDP_;
		connectionUDP_=0;
		}

	if (connectionHTTP_)
		{
		connectionHTTP_->Disconnect();
		delete connectionHTTP_;
		connectionHTTP_=0;
		}

	if (localCommunications_)
		{
		localClientCommunicationsBuffer_referenceCount_--;
		if (localClientCommunicationsBuffer_referenceCount_==0)
			{
			delete localClientCommunicationsBuffer_;
			localClientCommunicationsBuffer_=0;
			}

		localCommunications_=false;
		OnDisconnected();
		localCommunications_OnConnected_Done_=true;
		}

	}
示例#19
0
void NetSocket::OnCompletionSuccess(NetCompletionOP* bufObj, DWORD bytesTransfered)
{
    REFLIB_ASSERT_RETURN_IF_FAILED(bufObj, "OnCOmpletionFailure: NetCompletionOP is nullptr.");

    switch (bufObj->op)
    {
    case NetCompletionOP::OP_CONNECT:
        OnConnected();
        break;
    case NetCompletionOP::OP_READ:
        OnRecv(bufObj, bytesTransfered);
        break;
    case NetCompletionOP::OP_WRITE:
        OnSent(bufObj, bytesTransfered);
        break;
    case NetCompletionOP::OP_DISCONNECT:
        OnDisconnected();
        break;
    default:
        REFLIB_ASSERT(false, "Invalid net op");
        break;
    }
}
示例#20
0
//--------------------------------------------------------------------
CHUDManager::CHUDManager()
{ 
	pUI						= 0;
	m_pHUDTarget			= xr_new<CHUDTarget>();
	OnDisconnected			();
}
示例#21
0
/* Implementation *************************************************************/
CClientDlg::CClientDlg ( CClient*        pNCliP,
                         CSettings*      pNSetP,
                         const bool      bNewConnectOnStartup,
                         const bool      bNewShowComplRegConnList,
                         const bool      bShowAnalyzerConsole,
                         QWidget*        parent,
                         Qt::WindowFlags f ) :
    QDialog            ( parent, f ),
    pClient            ( pNCliP ),
    pSettings          ( pNSetP ),
    ClientSettingsDlg  ( pNCliP, parent, Qt::Window ),
    ChatDlg            ( parent, Qt::Window ),
    ConnectDlg         ( bNewShowComplRegConnList, parent, Qt::Dialog ),
    AnalyzerConsole    ( pNCliP, parent, Qt::Window )
{
    setupUi ( this );


    // Add help text to controls -----------------------------------------------
    // input level meter
    QString strInpLevH = tr ( "<b>Input Level Meter:</b> The input level "
        "indicators show the input level of the two stereo channels "
        "of the current selected audio input.<br>"
        "Make sure not to clip the input signal to avoid distortions of the "
        "audio signal." );

    QString strInpLevHTT = tr ( "If the " ) + APP_NAME +
        tr ( " software is connected and "
        "you play your instrument/sing in the microphone, the LED level "
        "meter should flicker. If this is not the case, you have "
        "probably selected the wrong input channel (e.g. line in instead "
        "of the microphone input) or set the input gain too low in the "
        "(Windows) audio mixer.<br>For a proper usage of the " ) + APP_NAME +
        tr ( " software, "
        "you should not hear your singing/instrument in the loudspeaker or "
        "your headphone when the " ) + APP_NAME +
        tr ( " software is not connected. This can "
        "be achieved by muting your input audio channel in the Playback "
        "mixer (<b>not</b> the Recording mixer!)." ) + TOOLTIP_COM_END_TEXT;

    QString strInpLevHAccText  = tr ( "Input level meter" );
    QString strInpLevHAccDescr = tr ( "Simulates an analog LED level meter." );

    lblInputLEDMeter->setWhatsThis           ( strInpLevH );
    lblLevelMeterLeft->setWhatsThis          ( strInpLevH );
    lblLevelMeterRight->setWhatsThis         ( strInpLevH );
    lbrInputLevelL->setWhatsThis             ( strInpLevH );
    lbrInputLevelL->setAccessibleName        ( strInpLevHAccText );
    lbrInputLevelL->setAccessibleDescription ( strInpLevHAccDescr );
    lbrInputLevelL->setToolTip               ( strInpLevHTT );
    lbrInputLevelR->setWhatsThis             ( strInpLevH );
    lbrInputLevelR->setAccessibleName        ( strInpLevHAccText );
    lbrInputLevelR->setAccessibleDescription ( strInpLevHAccDescr );
    lbrInputLevelR->setToolTip               ( strInpLevHTT );

    // connect/disconnect button
    butConnect->setWhatsThis ( tr ( "<b>Connect / Disconnect Button:"
        "</b> Push this button to connect a server. A dialog where you can "
        "select a server will open. If you are connected, pressing this "
        "button will end the session." ) );

    butConnect->setAccessibleName (
        tr ( "Connect and disconnect toggle button" ) );

    butConnect->setAccessibleDescription ( tr ( "Clicking on this "
        "button changes the caption of the button from Connect to "
        "Disconnect, i.e., it implements a toggle functionality for connecting "
        "and disconnecting the " ) + APP_NAME + tr ( " software." ) );

    // fader tag
    QString strFaderTag = tr ( "<b>Your Alias/Instrument:</b> Set your name "
        "or an alias here so that the other musicians you want to play with "
        "know who you are. Additionally you may set an instrument picture of "
        "the instrument you play. "
        "What you set here will appear at your fader on the mixer board when "
        "you are connected to a " ) + APP_NAME + tr ( " server. This tag will "
        "also show up at each client which is connected to the same server as "
        "you. If the fader tag is empty, the IP address is shown instead." );

    QString strFaderTagTT = tr ( "Set your name and/or instrument and/or "
        "pseoudonym here so that the other musicians can identify you." ) +
        TOOLTIP_COM_END_TEXT;

    lblServerTag->setWhatsThis ( strFaderTag );
    lblServerTag->setToolTip   ( strFaderTagTT );
    edtFaderTag->setWhatsThis  ( strFaderTag );
    edtFaderTag->setToolTip    ( strFaderTagTT );
    edtFaderTag->setAccessibleName ( tr ( "Fader tag edit box" ) );
    butInstPicture->setWhatsThis  ( strFaderTag );
    butInstPicture->setToolTip    ( strFaderTagTT );
    butInstPicture->setAccessibleName ( tr ( "Instrument picture button" ) );

    // local audio input fader
    QString strAudFader = tr ( "<b>Local Audio Input Fader:</b> With the "
        "audio fader, the relative levels of the left and right local audio "
        "channels can be changed. For a mono signal it acts like a panning "
        "between the two channels. If, e.g., a microphone is connected to "
        "the right input channel and an instrument is connected to the left "
        "input channel which is much louder than the microphone, move the "
        "audio fader in a direction where the label above the fader shows "
        "<i>L -x</i>, where <i>x</i> is the current attenuation indicator." );

    lblAudioPan->setWhatsThis      ( strAudFader );
    lblAudioPanValue->setWhatsThis ( strAudFader );
    sldAudioPan->setWhatsThis      ( strAudFader );

    sldAudioPan->setAccessibleName ( tr ( "Local audio input fader (left/right)" ) );

    // reverberation level
    QString strAudReverb = tr ( "<b>Reverberation Level:</b> A reverberation "
        "effect can be applied to one local mono audio channel or to both "
        "channels in stereo mode. The mone channel selection and the "
        "reverberation level can be modified. If, e.g., "
        "the microphone signal is fed into the right audio channel of the "
        "sound card and a reverberation effect shall be applied, set the "
        "channel selector to right and move the fader upwards until the "
        "desired reverberation level is reached.<br>"
        "The reverberation effect requires significant CPU so that it should "
        "only be used on fast PCs. If the reverberation level fader is set to "
        "minimum (which is the default setting), the reverberation effect is "
        "switched off and does not cause any additional CPU usage." );

    lblAudioReverb->setWhatsThis ( strAudReverb );
    sldAudioReverb->setWhatsThis ( strAudReverb );

    sldAudioReverb->setAccessibleName ( tr ( "Reverberation effect level setting" ) );

    // reverberation channel selection
    QString strRevChanSel = tr ( "<b>Reverberation Channel Selection:</b> "
        "With these radio buttons the audio input channel on which the "
        "reverberation effect is applied can be chosen. Either the left "
        "or right input channel can be selected." );

    rbtReverbSelL->setWhatsThis ( strRevChanSel );
    rbtReverbSelL->setAccessibleName ( tr ( "Left channel selection for reverberation" ) );
    rbtReverbSelR->setWhatsThis ( strRevChanSel );
    rbtReverbSelR->setAccessibleName ( tr ( "Right channel selection for reverberation" ) );

    // delay LED
    QString strLEDDelay = tr ( "<b>Delay Status LED:</b> "
        "The delay status LED indicator shows the current audio delay "
        "status. If the light is green, the delay is perfect for a jam "
        "session. If the ligth is yellow, a session is still possible but "
        "it may be harder to play. If the light is red, the delay is too "
        "large for jamming." );

    lblDelay->setWhatsThis ( strLEDDelay );
    ledDelay->setWhatsThis ( strLEDDelay );
    ledDelay->setToolTip ( tr ( "If this LED indicator turns red, "
        "you will not have much fun using the " ) + APP_NAME +
        tr ( " software." ) + TOOLTIP_COM_END_TEXT );

    ledDelay->setAccessibleName ( tr ( "Delay status LED indicator" ) );

    // buffers LED
    QString strLEDBuffers =  tr ( "<b>Buffers Status LED:</b> "
        "The buffers status LED indicator shows the current audio/streaming "
        "status. If the light is green, there are no buffer overruns/underruns "
        "and the audio stream is not interrupted. If the light is red, the "
        "audio stream is interrupted caused by one of the following problems:"
        "<ul>"
        "<li>The network jitter buffer is not large enough for the current "
        "network/audio interface jitter.</li>"
        "<li>The sound card buffer delay (buffer size) is set to a too small "
        "value.</li>"
        "<li>The upload or download stream rate is too high for the current "
        "available internet bandwidth.</li>"
        "<li>The CPU of the client or server is at 100%.</li>"
        "</ul>" );

    lblBuffers->setWhatsThis ( strLEDBuffers );
    ledBuffers->setWhatsThis ( strLEDBuffers );

    ledBuffers->setAccessibleName ( tr ( "Buffers status LED indicator" ) );

    // init GUI design
    SetGUIDesign ( pClient->GetGUIDesign() );

    // reset mixer board
    MainMixerBoard->HideAll();

    // restore fader settings
    MainMixerBoard->vecStoredFaderTags   = pClient->vecStoredFaderTags;
    MainMixerBoard->vecStoredFaderLevels = pClient->vecStoredFaderLevels;
    MainMixerBoard->vecStoredFaderIsSolo = pClient->vecStoredFaderIsSolo;

    // init fader tag line edit and instrument picture
    edtFaderTag->setText ( pClient->ChannelInfo.strName );
    butInstPicture->setIcon ( QIcon (
        CInstPictures::GetResourceReference ( pClient->ChannelInfo.iInstrument ) ) );

    // init status label
    OnTimerStatus();

    // init connection button text
    butConnect->setText ( CON_BUT_CONNECTTEXT );

    // init input level meter bars
    lbrInputLevelL->setValue ( 0 );
    lbrInputLevelR->setValue ( 0 );

    // init status LEDs
    ledBuffers->Reset();
    ledDelay->Reset();


    // init slider controls ---
    // audio in fader
    sldAudioPan->setRange ( AUD_FADER_IN_MIN, AUD_FADER_IN_MAX );
    sldAudioPan->setTickInterval ( AUD_FADER_IN_MAX / 5 );
    UpdateAudioFaderSlider();

    // audio reverberation
    sldAudioReverb->setRange ( 0, AUD_REVERB_MAX );
    const int iCurAudReverb = pClient->GetReverbLevel();
    sldAudioReverb->setValue ( iCurAudReverb );
    sldAudioReverb->setTickInterval ( AUD_REVERB_MAX / 5 );

    // init reverb channel
    UpdateRevSelection();

    // set window title (with no clients connected -> "0")
    SetMyWindowTitle ( 0 );


    // Connect on startup ------------------------------------------------------
    if ( bNewConnectOnStartup )
    {
        // per definition use the last connection (first entry in the
        // stored address list)
        const QString strSelectedAddress = pClient->vstrIPAddress[0];

        // only if address is not empty, start the client
        if ( !strSelectedAddress.isEmpty() )
        {
            // initiate connection (always show the address in the mixer board
            // (no alias))
            Connect ( strSelectedAddress, strSelectedAddress );
        }
    }


    // Mac Workaround:
    // If the connect button is the default button, on Mac it is highlighted
    // by fading in and out a blue backgroud color. This operation consumes so
    // much CPU that we get audio interruptions.
    // Better solution: increase thread priority of worker thread (since the
    // user can always highlight the button manually, too) -> TODO
#if defined ( __APPLE__ ) || defined ( __MACOSX )
    butConnect->setDefault ( false );
#endif


    // View menu  --------------------------------------------------------------
    pViewMenu = new QMenu ( "&View", this );

    pViewMenu->addAction ( tr ( "&Connection Setup..." ), this,
        SLOT ( OnOpenConnectionSetupDialog() ) );

    pViewMenu->addAction ( tr ( "C&hat..." ), this,
        SLOT ( OnOpenChatDialog() ) );

    pViewMenu->addAction ( tr ( "&Settings..." ), this,
        SLOT ( OnOpenGeneralSettings() ) );

    // optionally show analyzer console entry
    if ( bShowAnalyzerConsole )
    {
        pViewMenu->addAction ( tr ( "&Analyzer Console..." ), this,
            SLOT ( OnOpenAnalyzerConsole() ) );
    }

    pViewMenu->addSeparator();

    pViewMenu->addAction ( tr ( "E&xit" ), this,
        SLOT ( close() ), QKeySequence ( Qt::CTRL + Qt::Key_Q ) );


    // Main menu bar -----------------------------------------------------------
    pMenu = new QMenuBar ( this );

    pMenu->addMenu ( pViewMenu );
    pMenu->addMenu ( new CHelpMenu ( this ) );

    // Now tell the layout about the menu
    layout()->setMenuBar ( pMenu );


    // Instrument pictures popup menu ------------------------------------------
    pInstrPictPopupMenu = new QMenu ( this );

    // add an entry for all known instruments
    for ( int iCurInst = 0; iCurInst < CInstPictures::GetNumAvailableInst(); iCurInst++ )
    {
        // create a menu action with text and image
        QAction* pCurAction = new QAction (
            QIcon ( CInstPictures::GetResourceReference ( iCurInst ) ),
            CInstPictures::GetName ( iCurInst ),
            this );

        // add data to identify the action data when it is triggered
        pCurAction->setData ( iCurInst );

        pInstrPictPopupMenu->addAction ( pCurAction );
    }


    // Window positions --------------------------------------------------------
    // main window
    if ( !pClient->vecWindowPosMain.isEmpty() && !pClient->vecWindowPosMain.isNull() )
    {
        restoreGeometry ( pClient->vecWindowPosMain );
    }

    // settings window
    if ( !pClient->vecWindowPosSettings.isEmpty() && !pClient->vecWindowPosSettings.isNull() )
    {
        ClientSettingsDlg.restoreGeometry ( pClient->vecWindowPosSettings );
    }

    if ( pClient->bWindowWasShownSettings )
    {
        ShowGeneralSettings();
    }

    // chat window
    if ( !pClient->vecWindowPosChat.isEmpty() && !pClient->vecWindowPosChat.isNull() )
    {
        ChatDlg.restoreGeometry ( pClient->vecWindowPosChat );
    }

    if ( pClient->bWindowWasShownChat )
    {
        ShowChatWindow();
    }

    // connection setup window
    if ( !pClient->vecWindowPosConnect.isEmpty() && !pClient->vecWindowPosConnect.isNull() )
    {
        ConnectDlg.restoreGeometry ( pClient->vecWindowPosConnect );
    }

    if ( pClient->bWindowWasShownConnect )
    {
        ShowConnectionSetupDialog();
    }


    // Connections -------------------------------------------------------------
    // push buttons
    QObject::connect ( butConnect, SIGNAL ( clicked() ),
        this, SLOT ( OnConnectDisconBut() ) );

    QObject::connect ( butInstPicture, SIGNAL ( clicked() ),
        this, SLOT ( OnInstPictureBut() ) );

    // check boxes
    QObject::connect ( chbSettings, SIGNAL ( stateChanged ( int ) ),
        this, SLOT ( OnSettingsStateChanged ( int ) ) );

    QObject::connect ( chbChat, SIGNAL ( stateChanged ( int ) ),
        this, SLOT ( OnChatStateChanged ( int ) ) );

    // timers
    QObject::connect ( &TimerSigMet, SIGNAL ( timeout() ),
        this, SLOT ( OnTimerSigMet() ) );

    QObject::connect ( &TimerBuffersLED, SIGNAL ( timeout() ),
        this, SLOT ( OnTimerBuffersLED() ) );

    QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
        this, SLOT ( OnTimerStatus() ) );

    QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
        this, SLOT ( OnTimerPing() ) );

    // sliders
    QObject::connect ( sldAudioPan, SIGNAL ( valueChanged ( int ) ),
        this, SLOT ( OnAudioPanValueChanged ( int ) ) );

    QObject::connect ( sldAudioReverb, SIGNAL ( valueChanged ( int ) ),
        this, SLOT ( OnAudioReverbValueChanged ( int ) ) );

    // radio buttons
    QObject::connect ( rbtReverbSelL, SIGNAL ( clicked() ),
        this, SLOT ( OnReverbSelLClicked() ) );

    QObject::connect ( rbtReverbSelR, SIGNAL ( clicked() ),
        this, SLOT ( OnReverbSelRClicked() ) );

    // line edits
    QObject::connect ( edtFaderTag, SIGNAL ( textChanged ( const QString& ) ),
        this, SLOT ( OnFaderTagTextChanged ( const QString& ) ) );

    // menus
    QObject::connect ( pInstrPictPopupMenu, SIGNAL ( triggered ( QAction* ) ),
        this, SLOT ( OnInstPicturesMenuTriggered ( QAction* ) ) );

    // other
    QObject::connect ( pClient,
        SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
        this, SLOT ( OnConClientListMesReceived ( CVector<CChannelInfo> ) ) );

    QObject::connect ( pClient,
        SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ),
        this, SLOT ( OnConClientListMesReceived ( CVector<CChannelInfo> ) ) );

    QObject::connect ( pClient,
        SIGNAL ( Disconnected() ),
        this, SLOT ( OnDisconnected() ) );

    QObject::connect ( pClient,
        SIGNAL ( ChatTextReceived ( QString ) ),
        this, SLOT ( OnChatTextReceived ( QString ) ) );

    QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
        this, SLOT ( OnPingTimeResult ( int ) ) );

    QObject::connect ( pClient,
        SIGNAL ( CLServerListReceived ( CHostAddress, CVector<CServerInfo> ) ),
        this, SLOT ( OnCLServerListReceived ( CHostAddress, CVector<CServerInfo> ) ) );

    QObject::connect ( pClient,
        SIGNAL ( CLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ),
        this, SLOT ( OnCLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ) );

#ifdef ENABLE_CLIENT_VERSION_AND_OS_DEBUGGING
    QObject::connect ( pClient,
        SIGNAL ( CLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ),
        this, SLOT ( OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ) );
#endif

    QObject::connect ( pClient,
        SIGNAL ( UpstreamRateChanged() ),
        this, SLOT ( OnUpstreamRateChanged() ) );

    QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ),
        this, SLOT ( OnAboutToQuit() ) );

    QObject::connect ( &ClientSettingsDlg, SIGNAL ( GUIDesignChanged() ),
        this, SLOT ( OnGUIDesignChanged() ) );

    QObject::connect ( &ClientSettingsDlg, SIGNAL ( AudioChannelsChanged() ),
        this, SLOT ( OnAudioChannelsChanged() ) );

    QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ),
        this, SLOT ( OnChangeChanGain ( int, double ) ) );

    QObject::connect ( MainMixerBoard, SIGNAL ( NumClientsChanged ( int ) ),
        this, SLOT ( OnNumClientsChanged ( int ) ) );

    QObject::connect ( &ChatDlg, SIGNAL ( NewLocalInputText ( QString ) ),
        this, SLOT ( OnNewLocalInputText ( QString ) ) );

    QObject::connect ( &ConnectDlg, SIGNAL ( ReqServerListQuery ( CHostAddress ) ),
        this, SLOT ( OnReqServerListQuery ( CHostAddress ) ) );

    QObject::connect ( &ConnectDlg, SIGNAL ( CreateCLServerListPingMes ( CHostAddress ) ),
        this, SLOT ( OnCreateCLServerListPingMes ( CHostAddress ) ) );

    QObject::connect ( &ConnectDlg, SIGNAL ( CreateCLServerListReqVerAndOSMes ( CHostAddress ) ),
        this, SLOT ( OnCreateCLServerListReqVerAndOSMes ( CHostAddress ) ) );

    QObject::connect ( &ConnectDlg, SIGNAL ( accepted() ),
        this, SLOT ( OnConnectDlgAccepted() ) );


    // Timers ------------------------------------------------------------------
    // start timer for status bar
    TimerStatus.start ( LED_BAR_UPDATE_TIME_MS );
}