first working version of the connect dialog
This commit is contained in:
parent
b6ba0cc93b
commit
7392762f6c
4 changed files with 261 additions and 312 deletions
|
@ -28,7 +28,9 @@
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||||
: QDialog ( parent, f ),
|
: QDialog ( parent, f ),
|
||||||
bServerListReceived ( false )
|
strSelectedAddress ( "" ),
|
||||||
|
bServerListReceived ( false ),
|
||||||
|
bCancelPressed ( false )
|
||||||
{
|
{
|
||||||
setupUi ( this );
|
setupUi ( this );
|
||||||
|
|
||||||
|
@ -38,8 +40,7 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||||
QString strServAddrH = tr ( "<b>Server Address:</b> The IP address or URL "
|
QString strServAddrH = tr ( "<b>Server Address:</b> The IP address or URL "
|
||||||
"of the server running the llcon server software must be set here. "
|
"of the server running the llcon server software must be set here. "
|
||||||
"A list of the most recent used server URLs is available for "
|
"A list of the most recent used server URLs is available for "
|
||||||
"selection. If an invalid address was chosen, an error message is "
|
"selection." );
|
||||||
"shown in the status bar." );
|
|
||||||
|
|
||||||
TextLabelServerAddr->setWhatsThis ( strServAddrH );
|
TextLabelServerAddr->setWhatsThis ( strServAddrH );
|
||||||
LineEditServerAddr->setWhatsThis ( strServAddrH );
|
LineEditServerAddr->setWhatsThis ( strServAddrH );
|
||||||
|
@ -51,7 +52,7 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||||
|
|
||||||
// init server address combo box (max MAX_NUM_SERVER_ADDR_ITEMS entries)
|
// init server address combo box (max MAX_NUM_SERVER_ADDR_ITEMS entries)
|
||||||
LineEditServerAddr->setMaxCount ( MAX_NUM_SERVER_ADDR_ITEMS );
|
LineEditServerAddr->setMaxCount ( MAX_NUM_SERVER_ADDR_ITEMS );
|
||||||
LineEditServerAddr->setInsertPolicy ( QComboBox::InsertAtTop );
|
LineEditServerAddr->setInsertPolicy ( QComboBox::NoInsert );
|
||||||
|
|
||||||
// set up list view for connected clients
|
// set up list view for connected clients
|
||||||
ListViewServers->setColumnWidth ( 0, 170 );
|
ListViewServers->setColumnWidth ( 0, 170 );
|
||||||
|
@ -67,13 +68,8 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||||
QObject::connect ( CancelButton, SIGNAL ( clicked() ),
|
QObject::connect ( CancelButton, SIGNAL ( clicked() ),
|
||||||
this, SLOT ( OnCancelButtonClicked() ) );
|
this, SLOT ( OnCancelButtonClicked() ) );
|
||||||
|
|
||||||
// line edits
|
QObject::connect ( ConnectButton, SIGNAL ( clicked() ),
|
||||||
QObject::connect ( LineEditServerAddr, SIGNAL ( editTextChanged ( const QString ) ),
|
this, SLOT ( close() ) );
|
||||||
this, SLOT ( OnLineEditServerAddrTextChanged ( const QString ) ) );
|
|
||||||
|
|
||||||
QObject::connect ( LineEditServerAddr, SIGNAL ( activated ( int ) ),
|
|
||||||
this, SLOT ( OnLineEditServerAddrActivated ( int ) ) );
|
|
||||||
|
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
||||||
|
@ -83,14 +79,14 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||||
this, SLOT ( OnTimerReRequestServList() ) );
|
this, SLOT ( OnTimerReRequestServList() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnectDlg::LoadStoredServers ( const CVector<QString>& vstrIPAddress )
|
void CConnectDlg::LoadStoredServers ( const CVector<QString>& vstrIPAddresses )
|
||||||
{
|
{
|
||||||
// load stored IP addresses in combo box
|
// load stored IP addresses in combo box
|
||||||
for ( int iLEIdx = 0; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; iLEIdx++ )
|
for ( int iLEIdx = 0; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; iLEIdx++ )
|
||||||
{
|
{
|
||||||
if ( !vstrIPAddress[iLEIdx].isEmpty() )
|
if ( !vstrIPAddresses[iLEIdx].isEmpty() )
|
||||||
{
|
{
|
||||||
LineEditServerAddr->addItem ( vstrIPAddress[iLEIdx] );
|
LineEditServerAddr->addItem ( vstrIPAddresses[iLEIdx] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +98,9 @@ void CConnectDlg::showEvent ( QShowEvent* )
|
||||||
bServerListReceived = false;
|
bServerListReceived = false;
|
||||||
bCancelPressed = false;
|
bCancelPressed = false;
|
||||||
|
|
||||||
|
// clear current address
|
||||||
|
strSelectedAddress = "";
|
||||||
|
|
||||||
|
|
||||||
// TEST
|
// TEST
|
||||||
QString strNAddr = "llcon.dyndns.org:22122";
|
QString strNAddr = "llcon.dyndns.org:22122";
|
||||||
|
@ -124,20 +123,25 @@ QString strNAddr = "llcon.dyndns.org:22122";
|
||||||
|
|
||||||
void CConnectDlg::hideEvent ( QHideEvent* )
|
void CConnectDlg::hideEvent ( QHideEvent* )
|
||||||
{
|
{
|
||||||
|
// get the IP address to be used according to the following definitions:
|
||||||
|
// - if the list has focus and a line is selected, use this line
|
||||||
|
// - if the list has no focus, use the current combo box text
|
||||||
|
QList<QTreeWidgetItem*> CurSelListItemList =
|
||||||
|
ListViewServers->selectedItems();
|
||||||
|
|
||||||
|
if ( CurSelListItemList.count() > 0 )
|
||||||
|
{
|
||||||
|
strSelectedAddress =
|
||||||
|
CurSelListItemList[0]->data ( 0, Qt::UserRole ).toString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strSelectedAddress = LineEditServerAddr->currentText();
|
||||||
|
}
|
||||||
|
|
||||||
// if window is closed, stop timers
|
// if window is closed, stop timers
|
||||||
TimerPing.stop();
|
TimerPing.stop();
|
||||||
TimerReRequestServList.stop();
|
TimerReRequestServList.stop();
|
||||||
|
|
||||||
// TODO
|
|
||||||
/*
|
|
||||||
// store IP addresses
|
|
||||||
for ( int iLEIdx = 0; iLEIdx < LineEditServerAddr->count(); iLEIdx++ )
|
|
||||||
{
|
|
||||||
pClient->vstrIPAddress[iLEIdx] =
|
|
||||||
LineEditServerAddr->itemText ( iLEIdx );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnectDlg::OnTimerReRequestServList()
|
void CConnectDlg::OnTimerReRequestServList()
|
||||||
|
@ -228,17 +232,6 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
|
||||||
TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS );
|
TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnectDlg::OnLineEditServerAddrTextChanged ( const QString )
|
|
||||||
{
|
|
||||||
// if the maximum number of items in the combo box is reached,
|
|
||||||
// delete the last item so that the new item can be added (first
|
|
||||||
// in - first out)
|
|
||||||
if ( LineEditServerAddr->count() == MAX_NUM_SERVER_ADDR_ITEMS )
|
|
||||||
{
|
|
||||||
LineEditServerAddr->removeItem ( MAX_NUM_SERVER_ADDR_ITEMS - 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConnectDlg::OnCancelButtonClicked()
|
void CConnectDlg::OnCancelButtonClicked()
|
||||||
{
|
{
|
||||||
// set cancel flag
|
// set cancel flag
|
||||||
|
@ -248,15 +241,6 @@ void CConnectDlg::OnCancelButtonClicked()
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnectDlg::OnLineEditServerAddrActivated ( int index )
|
|
||||||
{
|
|
||||||
// move activated list item to the top
|
|
||||||
const QString strCurIPAddress = LineEditServerAddr->itemText ( index );
|
|
||||||
LineEditServerAddr->removeItem ( index );
|
|
||||||
LineEditServerAddr->insertItem ( 0, strCurIPAddress );
|
|
||||||
LineEditServerAddr->setCurrentIndex ( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConnectDlg::OnTimerPing()
|
void CConnectDlg::OnTimerPing()
|
||||||
{
|
{
|
||||||
// send ping messages to the servers in the list
|
// send ping messages to the servers in the list
|
||||||
|
|
|
@ -59,26 +59,29 @@ public:
|
||||||
void SetServerList ( const CHostAddress& InetAddr,
|
void SetServerList ( const CHostAddress& InetAddr,
|
||||||
const CVector<CServerInfo>& vecServerInfo );
|
const CVector<CServerInfo>& vecServerInfo );
|
||||||
|
|
||||||
void LoadStoredServers ( const CVector<QString>& vstrIPAddress );
|
void LoadStoredServers ( const CVector<QString>& vstrNewIPAddresses );
|
||||||
|
|
||||||
void SetPingTimeResult ( CHostAddress& InetAddr,
|
void SetPingTimeResult ( CHostAddress& InetAddr,
|
||||||
const int iPingTime,
|
const int iPingTime,
|
||||||
const int iPingTimeLEDColor );
|
const int iPingTimeLEDColor );
|
||||||
|
|
||||||
|
bool GetCancelPressed() const { return bCancelPressed; }
|
||||||
|
QString GetSelectedAddress() const { return strSelectedAddress; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent ( QShowEvent* );
|
virtual void showEvent ( QShowEvent* );
|
||||||
virtual void hideEvent ( QHideEvent* );
|
virtual void hideEvent ( QHideEvent* );
|
||||||
|
|
||||||
QTimer TimerPing;
|
QTimer TimerPing;
|
||||||
QTimer TimerReRequestServList;
|
QTimer TimerReRequestServList;
|
||||||
CHostAddress CentralServerAddress;
|
CHostAddress CentralServerAddress;
|
||||||
bool bServerListReceived;
|
CVector<QString> vstrIPAddresses;
|
||||||
bool bCancelPressed;
|
QString strSelectedAddress;
|
||||||
|
bool bServerListReceived;
|
||||||
|
bool bCancelPressed;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnCancelButtonClicked();
|
void OnCancelButtonClicked();
|
||||||
void OnLineEditServerAddrTextChanged ( const QString );
|
|
||||||
void OnLineEditServerAddrActivated ( int index );
|
|
||||||
void OnTimerPing();
|
void OnTimerPing();
|
||||||
void OnTimerReRequestServList();
|
void OnTimerReRequestServList();
|
||||||
|
|
||||||
|
|
|
@ -105,20 +105,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
"Disconnect, i.e., it implements a toggle functionality for connecting "
|
"Disconnect, i.e., it implements a toggle functionality for connecting "
|
||||||
"and disconnecting the llcon software." ) );
|
"and disconnecting the llcon software." ) );
|
||||||
|
|
||||||
// server address
|
|
||||||
QString strServAddrH = tr ( "<b>Server Address:</b> The IP address or URL "
|
|
||||||
"of the server running the llcon server software must be set here. "
|
|
||||||
"A list of the most recent used server URLs is available for "
|
|
||||||
"selection. If an invalid address was chosen, an error message is "
|
|
||||||
"shown in the status bar." );
|
|
||||||
|
|
||||||
TextLabelServerAddr->setWhatsThis ( strServAddrH );
|
|
||||||
LineEditServerAddr->setWhatsThis ( strServAddrH );
|
|
||||||
|
|
||||||
LineEditServerAddr->setAccessibleName ( tr ( "Server address edit box" ) );
|
|
||||||
LineEditServerAddr->setAccessibleDescription ( tr ( "Holds the current server "
|
|
||||||
"URL. It also stores old URLs in the combo box list." ) );
|
|
||||||
|
|
||||||
// fader tag
|
// fader tag
|
||||||
QString strFaderTag = tr ( "<b>Fader Tag:</b> The fader tag of the local "
|
QString strFaderTag = tr ( "<b>Fader Tag:</b> The fader tag of the local "
|
||||||
"client is set in the fader tag edit box. This tag will appear "
|
"client is set in the fader tag edit box. This tag will appear "
|
||||||
|
@ -253,22 +239,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
// init fader tag line edit
|
// init fader tag line edit
|
||||||
LineEditFaderTag->setText ( pClient->strName );
|
LineEditFaderTag->setText ( pClient->strName );
|
||||||
|
|
||||||
// init server address combo box (max MAX_NUM_SERVER_ADDR_ITEMS entries)
|
|
||||||
LineEditServerAddr->setMaxCount ( MAX_NUM_SERVER_ADDR_ITEMS );
|
|
||||||
LineEditServerAddr->setInsertPolicy ( QComboBox::InsertAtTop );
|
|
||||||
|
|
||||||
// load data from ini file
|
|
||||||
for ( int iLEIdx = 0; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; iLEIdx++ )
|
|
||||||
{
|
|
||||||
if ( !pClient->vstrIPAddress[iLEIdx].isEmpty() )
|
|
||||||
{
|
|
||||||
LineEditServerAddr->addItem ( pClient->vstrIPAddress[iLEIdx] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// we want the cursor to be at IP address line edit at startup
|
|
||||||
LineEditServerAddr->setFocus();
|
|
||||||
|
|
||||||
// init status label
|
// init status label
|
||||||
OnTimerStatus();
|
OnTimerStatus();
|
||||||
|
|
||||||
|
@ -395,12 +365,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
QObject::connect ( LineEditFaderTag, SIGNAL ( textChanged ( const QString& ) ),
|
QObject::connect ( LineEditFaderTag, SIGNAL ( textChanged ( const QString& ) ),
|
||||||
this, SLOT ( OnFaderTagTextChanged ( const QString& ) ) );
|
this, SLOT ( OnFaderTagTextChanged ( const QString& ) ) );
|
||||||
|
|
||||||
QObject::connect ( LineEditServerAddr, SIGNAL ( editTextChanged ( const QString ) ),
|
|
||||||
this, SLOT ( OnLineEditServerAddrTextChanged ( const QString ) ) );
|
|
||||||
|
|
||||||
QObject::connect ( LineEditServerAddr, SIGNAL ( activated ( int ) ),
|
|
||||||
this, SLOT ( OnLineEditServerAddrActivated ( int ) ) );
|
|
||||||
|
|
||||||
// other
|
// other
|
||||||
QObject::connect ( pClient,
|
QObject::connect ( pClient,
|
||||||
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
|
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
|
||||||
|
@ -453,13 +417,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
// Timers ------------------------------------------------------------------
|
// Timers ------------------------------------------------------------------
|
||||||
// start timer for status bar
|
// start timer for status bar
|
||||||
TimerStatus.start ( LED_BAR_UPDATE_TIME_MS );
|
TimerStatus.start ( LED_BAR_UPDATE_TIME_MS );
|
||||||
|
|
||||||
|
|
||||||
// TEST
|
|
||||||
ConnectDlg.LoadStoredServers ( pClient->vstrIPAddress );
|
|
||||||
ConnectDlg.setModal ( true );
|
|
||||||
ConnectDlg.show();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLlconClientDlg::closeEvent ( QCloseEvent* Event )
|
void CLlconClientDlg::closeEvent ( QCloseEvent* Event )
|
||||||
|
@ -475,13 +432,6 @@ void CLlconClientDlg::closeEvent ( QCloseEvent* Event )
|
||||||
pClient->Stop();
|
pClient->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// store IP addresses
|
|
||||||
for ( int iLEIdx = 0; iLEIdx < LineEditServerAddr->count(); iLEIdx++ )
|
|
||||||
{
|
|
||||||
pClient->vstrIPAddress[iLEIdx] =
|
|
||||||
LineEditServerAddr->itemText ( iLEIdx );
|
|
||||||
}
|
|
||||||
|
|
||||||
// store fader tag
|
// store fader tag
|
||||||
pClient->strName = LineEditFaderTag->text();
|
pClient->strName = LineEditFaderTag->text();
|
||||||
|
|
||||||
|
@ -551,26 +501,6 @@ void CLlconClientDlg::OnSliderAudInFader ( int value )
|
||||||
UpdateAudioFaderSlider();
|
UpdateAudioFaderSlider();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLlconClientDlg::OnLineEditServerAddrTextChanged ( const QString )
|
|
||||||
{
|
|
||||||
// if the maximum number of items in the combo box is reached,
|
|
||||||
// delete the last item so that the new item can be added (first
|
|
||||||
// in - first out)
|
|
||||||
if ( LineEditServerAddr->count() == MAX_NUM_SERVER_ADDR_ITEMS )
|
|
||||||
{
|
|
||||||
LineEditServerAddr->removeItem ( MAX_NUM_SERVER_ADDR_ITEMS - 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLlconClientDlg::OnLineEditServerAddrActivated ( int index )
|
|
||||||
{
|
|
||||||
// move activated list item to the top
|
|
||||||
const QString strCurIPAddress = LineEditServerAddr->itemText ( index );
|
|
||||||
LineEditServerAddr->removeItem ( index );
|
|
||||||
LineEditServerAddr->insertItem ( 0, strCurIPAddress );
|
|
||||||
LineEditServerAddr->setCurrentIndex ( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLlconClientDlg::OnConnectDisconBut()
|
void CLlconClientDlg::OnConnectDisconBut()
|
||||||
{
|
{
|
||||||
// the connect/disconnect button implements a toggle functionality
|
// the connect/disconnect button implements a toggle functionality
|
||||||
|
@ -800,39 +730,73 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
|
||||||
// start/stop client, set button text
|
// start/stop client, set button text
|
||||||
if ( bDoStart )
|
if ( bDoStart )
|
||||||
{
|
{
|
||||||
// set address and check if address is valid
|
// init the connect dialog and execute it (modal dialog)
|
||||||
if ( pClient->SetServerAddr ( LineEditServerAddr->currentText() ) )
|
ConnectDlg.LoadStoredServers ( pClient->vstrIPAddress );
|
||||||
|
ConnectDlg.exec();
|
||||||
|
|
||||||
|
// check if cancel was pressed
|
||||||
|
if ( !ConnectDlg.GetCancelPressed() )
|
||||||
{
|
{
|
||||||
bool bStartOk = true;
|
const QString strSelectedAddress = ConnectDlg.GetSelectedAddress();
|
||||||
|
|
||||||
// try to start client, if error occurred, do not go in
|
if ( !strSelectedAddress.isEmpty() )
|
||||||
// running state but show error message
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
pClient->Start();
|
CVector<QString> vstrTempList ( 0 );
|
||||||
|
|
||||||
|
// store the new address in the current server storage list at
|
||||||
|
// the top, make sure we do not have more than allowed stored
|
||||||
|
// servers
|
||||||
|
vstrTempList.Add ( strSelectedAddress );
|
||||||
|
for ( int iIdx = 0; ( iIdx < pClient->vstrIPAddress.Size() ) &&
|
||||||
|
( iIdx < ( MAX_NUM_SERVER_ADDR_ITEMS - 1 ) ); iIdx++ )
|
||||||
|
{
|
||||||
|
// only add old server address if it is not the same as the
|
||||||
|
// selected one
|
||||||
|
if ( pClient->vstrIPAddress[iIdx].compare ( strSelectedAddress ) )
|
||||||
|
{
|
||||||
|
vstrTempList.Add ( pClient->vstrIPAddress[iIdx] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy new generated list to client
|
||||||
|
pClient->vstrIPAddress = vstrTempList;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch ( CGenErr generr )
|
// set address and check if address is valid
|
||||||
|
if ( pClient->SetServerAddr ( strSelectedAddress ) )
|
||||||
{
|
{
|
||||||
QMessageBox::critical (
|
bool bStartOk = true;
|
||||||
this, APP_NAME, generr.GetErrorText(), "Close", 0 );
|
|
||||||
|
|
||||||
bStartOk = false;
|
// try to start client, if error occurred, do not go in
|
||||||
|
// running state but show error message
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pClient->Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
catch ( CGenErr generr )
|
||||||
|
{
|
||||||
|
QMessageBox::critical (
|
||||||
|
this, APP_NAME, generr.GetErrorText(), "Close", 0 );
|
||||||
|
|
||||||
|
bStartOk = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( bStartOk )
|
||||||
|
{
|
||||||
|
PushButtonConnect->setText ( CON_BUT_DISCONNECTTEXT );
|
||||||
|
|
||||||
|
// start timer for level meter bar and ping time measurement
|
||||||
|
TimerSigMet.start ( LEVELMETER_UPDATE_TIME_MS );
|
||||||
|
TimerPing.start ( PING_UPDATE_TIME_MS );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// show the error as red light
|
||||||
|
LEDConnection->SetLight ( MUL_COL_LED_RED );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bStartOk )
|
|
||||||
{
|
|
||||||
PushButtonConnect->setText ( CON_BUT_DISCONNECTTEXT );
|
|
||||||
|
|
||||||
// start timer for level meter bar and ping time measurement
|
|
||||||
TimerSigMet.start ( LEVELMETER_UPDATE_TIME_MS );
|
|
||||||
TimerPing.start ( PING_UPDATE_TIME_MS );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// show the error as red light
|
|
||||||
LEDConnection->SetLight ( MUL_COL_LED_RED );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,165 +1,163 @@
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Copyright (c) 2004-2011
|
* Copyright (c) 2004-2011
|
||||||
*
|
*
|
||||||
* Author(s):
|
* Author(s):
|
||||||
* Volker Fischer
|
* Volker Fischer
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
* the terms of the GNU General Public License as published by the Free Software
|
* the terms of the GNU General Public License as published by the Free Software
|
||||||
* Foundation; either version 2 of the License, or (at your option) any later
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
* version.
|
* version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qprogressbar.h>
|
#include <qprogressbar.h>
|
||||||
#include <qwhatsthis.h>
|
#include <qwhatsthis.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
#include <qslider.h>
|
#include <qslider.h>
|
||||||
#include <qradiobutton.h>
|
#include <qradiobutton.h>
|
||||||
#include <qmenubar.h>
|
#include <qmenubar.h>
|
||||||
#include <qlayout.h>
|
#include <qlayout.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "multicolorled.h"
|
#include "multicolorled.h"
|
||||||
#include "audiomixerboard.h"
|
#include "audiomixerboard.h"
|
||||||
#include "clientsettingsdlg.h"
|
#include "clientsettingsdlg.h"
|
||||||
#include "chatdlg.h"
|
#include "chatdlg.h"
|
||||||
#include "connectdlg.h"
|
#include "connectdlg.h"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include "../windows/moc/llconclientdlgbase.h"
|
# include "../windows/moc/llconclientdlgbase.h"
|
||||||
#else
|
#else
|
||||||
# ifdef _IS_QMAKE_CONFIG
|
# ifdef _IS_QMAKE_CONFIG
|
||||||
# include "ui_llconclientdlgbase.h"
|
# include "ui_llconclientdlgbase.h"
|
||||||
# else
|
# else
|
||||||
# include "moc/llconclientdlgbase.h"
|
# include "moc/llconclientdlgbase.h"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Definitions ****************************************************************/
|
/* Definitions ****************************************************************/
|
||||||
// text strings for connection button for connect and disconnect
|
// text strings for connection button for connect and disconnect
|
||||||
#define CON_BUT_CONNECTTEXT "C&onnect"
|
#define CON_BUT_CONNECTTEXT "C&onnect"
|
||||||
#define CON_BUT_DISCONNECTTEXT "D&isconnect"
|
#define CON_BUT_DISCONNECTTEXT "D&isconnect"
|
||||||
|
|
||||||
// update time for GUI controls
|
// update time for GUI controls
|
||||||
#define LEVELMETER_UPDATE_TIME_MS 100 // ms
|
#define LEVELMETER_UPDATE_TIME_MS 100 // ms
|
||||||
#define LED_BAR_UPDATE_TIME_MS 1000 // ms
|
#define LED_BAR_UPDATE_TIME_MS 1000 // ms
|
||||||
|
|
||||||
// range for signal level meter
|
// range for signal level meter
|
||||||
#define LOW_BOUND_SIG_METER ( -50.0 ) // dB
|
#define LOW_BOUND_SIG_METER ( -50.0 ) // dB
|
||||||
#define UPPER_BOUND_SIG_METER ( 0.0 ) // dB
|
#define UPPER_BOUND_SIG_METER ( 0.0 ) // dB
|
||||||
|
|
||||||
// number of ping times > upper bound until error message is shown
|
// number of ping times > upper bound until error message is shown
|
||||||
#define NUM_HIGH_PINGS_UNTIL_ERROR 5
|
#define NUM_HIGH_PINGS_UNTIL_ERROR 5
|
||||||
|
|
||||||
|
|
||||||
/* Classes ********************************************************************/
|
/* Classes ********************************************************************/
|
||||||
class CLlconClientDlg : public QDialog, private Ui_CLlconClientDlgBase
|
class CLlconClientDlg : public QDialog, private Ui_CLlconClientDlgBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLlconClientDlg ( CClient* pNCliP,
|
CLlconClientDlg ( CClient* pNCliP,
|
||||||
const bool bNewConnectOnStartup,
|
const bool bNewConnectOnStartup,
|
||||||
const bool bNewDisalbeLEDs,
|
const bool bNewDisalbeLEDs,
|
||||||
QWidget* parent = 0,
|
QWidget* parent = 0,
|
||||||
Qt::WindowFlags f = 0 );
|
Qt::WindowFlags f = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
||||||
void SetMyWindowTitle ( const int iNumClients );
|
void SetMyWindowTitle ( const int iNumClients );
|
||||||
void ShowChatWindow();
|
void ShowChatWindow();
|
||||||
void UpdateAudioFaderSlider();
|
void UpdateAudioFaderSlider();
|
||||||
void UpdateRevSelection();
|
void UpdateRevSelection();
|
||||||
void ConnectDisconnect ( const bool bDoStart );
|
void ConnectDisconnect ( const bool bDoStart );
|
||||||
|
|
||||||
CClient* pClient;
|
CClient* pClient;
|
||||||
bool bConnected;
|
bool bConnected;
|
||||||
bool bUnreadChatMessage;
|
bool bUnreadChatMessage;
|
||||||
QTimer TimerSigMet;
|
QTimer TimerSigMet;
|
||||||
QTimer TimerStatus;
|
QTimer TimerStatus;
|
||||||
QTimer TimerPing;
|
QTimer TimerPing;
|
||||||
|
|
||||||
virtual void customEvent ( QEvent* Event );
|
virtual void customEvent ( QEvent* Event );
|
||||||
virtual void closeEvent ( QCloseEvent* Event );
|
virtual void closeEvent ( QCloseEvent* Event );
|
||||||
void UpdateDisplay();
|
void UpdateDisplay();
|
||||||
|
|
||||||
QMenu* pViewMenu;
|
QMenu* pViewMenu;
|
||||||
QMenuBar* pMenu;
|
QMenuBar* pMenu;
|
||||||
|
|
||||||
CClientSettingsDlg ClientSettingsDlg;
|
CClientSettingsDlg ClientSettingsDlg;
|
||||||
CChatDlg ChatDlg;
|
CChatDlg ChatDlg;
|
||||||
CConnectDlg ConnectDlg;
|
CConnectDlg ConnectDlg;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnConnectDisconBut();
|
void OnConnectDisconBut();
|
||||||
void OnTimerSigMet();
|
void OnTimerSigMet();
|
||||||
|
|
||||||
void OnTimerStatus()
|
void OnTimerStatus()
|
||||||
{ UpdateDisplay(); }
|
{ UpdateDisplay(); }
|
||||||
|
|
||||||
void OnTimerPing();
|
void OnTimerPing();
|
||||||
void OnPingTimeResult ( int iPingTime );
|
void OnPingTimeResult ( int iPingTime );
|
||||||
void OnCLPingTimeResult ( CHostAddress InetAddr, int iPingTime );
|
void OnCLPingTimeResult ( CHostAddress InetAddr, int iPingTime );
|
||||||
void OnOpenGeneralSettings();
|
void OnOpenGeneralSettings();
|
||||||
|
|
||||||
void OnOpenChatDialog()
|
void OnOpenChatDialog()
|
||||||
{ ShowChatWindow(); }
|
{ ShowChatWindow(); }
|
||||||
|
|
||||||
void OnSliderAudInFader ( int value );
|
void OnSliderAudInFader ( int value );
|
||||||
|
|
||||||
void OnSliderAudReverb ( int value )
|
void OnSliderAudReverb ( int value )
|
||||||
{ pClient->SetReverbLevel ( value ); }
|
{ pClient->SetReverbLevel ( value ); }
|
||||||
|
|
||||||
void OnRevSelL()
|
void OnRevSelL()
|
||||||
{ pClient->SetReverbOnLeftChan ( true ); }
|
{ pClient->SetReverbOnLeftChan ( true ); }
|
||||||
|
|
||||||
void OnRevSelR()
|
void OnRevSelR()
|
||||||
{ pClient->SetReverbOnLeftChan ( false ); }
|
{ pClient->SetReverbOnLeftChan ( false ); }
|
||||||
|
|
||||||
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||||
void OnFaderTagTextChanged ( const QString& strNewName );
|
void OnFaderTagTextChanged ( const QString& strNewName );
|
||||||
void OnChatTextReceived ( QString strChatText );
|
void OnChatTextReceived ( QString strChatText );
|
||||||
|
|
||||||
void OnChangeChanGain ( int iId, double dGain )
|
void OnChangeChanGain ( int iId, double dGain )
|
||||||
{ pClient->SetRemoteChanGain ( iId, dGain ); }
|
{ pClient->SetRemoteChanGain ( iId, dGain ); }
|
||||||
|
|
||||||
void OnNewLocalInputText ( QString strChatText )
|
void OnNewLocalInputText ( QString strChatText )
|
||||||
{ pClient->CreateChatTextMes ( strChatText ); }
|
{ pClient->CreateChatTextMes ( strChatText ); }
|
||||||
|
|
||||||
void OnReqServerListQuery ( CHostAddress InetAddr )
|
void OnReqServerListQuery ( CHostAddress InetAddr )
|
||||||
{ pClient->CreateCLReqServerListMes ( InetAddr ); }
|
{ pClient->CreateCLReqServerListMes ( InetAddr ); }
|
||||||
|
|
||||||
void OnCreateCLPingMes ( CHostAddress InetAddr )
|
void OnCreateCLPingMes ( CHostAddress InetAddr )
|
||||||
{ pClient->CreateCLPingMes ( InetAddr ); }
|
{ pClient->CreateCLPingMes ( InetAddr ); }
|
||||||
|
|
||||||
void OnCLServerListReceived ( CHostAddress InetAddr,
|
void OnCLServerListReceived ( CHostAddress InetAddr,
|
||||||
CVector<CServerInfo> vecServerInfo )
|
CVector<CServerInfo> vecServerInfo )
|
||||||
{ ConnectDlg.SetServerList ( InetAddr, vecServerInfo ); }
|
{ ConnectDlg.SetServerList ( InetAddr, vecServerInfo ); }
|
||||||
|
|
||||||
void OnLineEditServerAddrTextChanged ( const QString );
|
void OnDisconnected();
|
||||||
void OnLineEditServerAddrActivated ( int index );
|
void OnStopped();
|
||||||
void OnDisconnected();
|
|
||||||
void OnStopped();
|
void OnGUIDesignChanged()
|
||||||
|
{ SetGUIDesign ( pClient->GetGUIDesign() ); }
|
||||||
void OnGUIDesignChanged()
|
|
||||||
{ SetGUIDesign ( pClient->GetGUIDesign() ); }
|
void OnStereoCheckBoxChanged() { UpdateRevSelection(); }
|
||||||
|
void OnNumClientsChanged ( int iNewNumClients );
|
||||||
void OnStereoCheckBoxChanged() { UpdateRevSelection(); }
|
};
|
||||||
void OnNumClientsChanged ( int iNewNumClients );
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in a new issue