some more QT4 fixes
This commit is contained in:
parent
b4f1dcca0d
commit
23e9f8e3f4
7 changed files with 49 additions and 148 deletions
|
@ -31,29 +31,29 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
|||
{
|
||||
setupUi ( this );
|
||||
|
||||
/* Init timing jitter text label */
|
||||
// init timing jitter text label
|
||||
TextLabelStdDevTimer->setText ( "" );
|
||||
|
||||
/* init slider controls --- */
|
||||
/* sound buffer in */
|
||||
// init slider controls ---
|
||||
// sound buffer in
|
||||
SliderSndBufIn->setRange ( 2, AUD_SLIDER_LENGTH );
|
||||
const int iCurNumInBuf = pClient->GetSndInterface()->GetInNumBuf();
|
||||
SliderSndBufIn->setValue ( iCurNumInBuf );
|
||||
TextSndBufIn->setText ( "In: " + QString().setNum ( iCurNumInBuf ) );
|
||||
|
||||
/* sound buffer out */
|
||||
// sound buffer out
|
||||
SliderSndBufOut->setRange ( 2, AUD_SLIDER_LENGTH );
|
||||
const int iCurNumOutBuf = pClient->GetSndInterface()->GetOutNumBuf();
|
||||
SliderSndBufOut->setValue ( iCurNumOutBuf );
|
||||
TextSndBufOut->setText ( "Out: " + QString().setNum ( iCurNumOutBuf ) );
|
||||
|
||||
/* network buffer */
|
||||
// network buffer
|
||||
SliderNetBuf->setRange ( 0, MAX_NET_BUF_SIZE_NUM_BL );
|
||||
const int iCurNumNetBuf = pClient->GetSockBufSize();
|
||||
SliderNetBuf->setValue ( iCurNumNetBuf );
|
||||
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
|
||||
|
||||
/* network buffer size factor in */
|
||||
// network buffer size factor in
|
||||
SliderNetBufSiFactIn->setRange ( 1, MAX_NET_BLOCK_SIZE_FACTOR );
|
||||
const int iCurNetBufSiFactIn = pClient->GetNetwBufSizeFactIn();
|
||||
SliderNetBufSiFactIn->setValue ( iCurNetBufSiFactIn );
|
||||
|
@ -61,7 +61,7 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
|||
double ( iCurNetBufSiFactIn * MIN_BLOCK_DURATION_MS ), 'f', 2 ) +
|
||||
" ms" );
|
||||
|
||||
/* network buffer size factor out */
|
||||
// network buffer size factor out
|
||||
SliderNetBufSiFactOut->setRange ( 1, MAX_NET_BLOCK_SIZE_FACTOR );
|
||||
const int iCurNetBufSiFactOut = pClient->GetNetwBufSizeFactOut();
|
||||
SliderNetBufSiFactOut->setValue ( iCurNetBufSiFactOut );
|
||||
|
@ -70,12 +70,12 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
|||
" ms" );
|
||||
|
||||
|
||||
/* connections ---------------------------------------------------------- */
|
||||
/* timers */
|
||||
// Connections -------------------------------------------------------------
|
||||
// timers
|
||||
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
|
||||
this, SLOT ( OnTimerStatus() ) );
|
||||
|
||||
/* sliders */
|
||||
// sliders
|
||||
QObject::connect ( SliderSndBufIn, SIGNAL ( valueChanged ( int ) ),
|
||||
this, SLOT ( OnSliderSndBufInChange ( int ) ) );
|
||||
QObject::connect ( SliderSndBufOut, SIGNAL ( valueChanged ( int ) ),
|
||||
|
@ -90,8 +90,8 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
|||
this, SLOT ( OnSliderNetBufSiFactOut ( int ) ) );
|
||||
|
||||
|
||||
/* timers --------------------------------------------------------------- */
|
||||
/* start timer for status bar */
|
||||
// Timers ------------------------------------------------------------------
|
||||
// start timer for status bar
|
||||
TimerStatus.start ( DISPLAY_UPDATE_TIME );
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ void CClientSettingsDlg::OnSliderNetBufSiFactOut ( int value )
|
|||
|
||||
void CClientSettingsDlg::UpdateDisplay()
|
||||
{
|
||||
/* response time */
|
||||
// response time
|
||||
TextLabelStdDevTimer->setText ( QString().
|
||||
setNum ( pClient->GetTimingStdDev(), 'f', 2 ) + " ms" );
|
||||
}
|
||||
|
|
|
@ -137,35 +137,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent )
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO check if code works and then clean up!!!!!!!
|
||||
// TODO QT4
|
||||
|
||||
#if 0
|
||||
/* Settings menu ------------------------------------------------------- */
|
||||
pSettingsMenu = new QMenu ( this );
|
||||
pSettingsMenu->addMenu ( tr ( "&General Settings..." ), this,
|
||||
SLOT ( OnOpenGeneralSettings() ) );
|
||||
|
||||
pSettingsMenu->insertSeparator();
|
||||
pSettingsMenu->addMenu ( tr ( "E&xit" ), this,
|
||||
SLOT ( close() ), CTRL+Key_Q );
|
||||
|
||||
|
||||
/* Main menu bar -------------------------------------------------------- */
|
||||
pMenu = new QMenuBar ( this );
|
||||
pMenu->addMenu ( tr ( "&Settings" ), pSettingsMenu );
|
||||
pMenu->addMenu ( tr ( "&?"), new CLlconHelpMenu ( this ) );
|
||||
pMenu->setSeparator ( QMenuBar::InWindowsStyle );
|
||||
|
||||
/* Now tell the layout about the menu */
|
||||
CLlconClientDlgBaseLayout->setMenuBar ( pMenu );
|
||||
#endif
|
||||
|
||||
|
||||
/* Settings menu ------------------------------------------------------- */
|
||||
// Settings menu ----------------------------------------------------------
|
||||
pSettingsMenu = new QMenu ( "&Settings", this );
|
||||
pSettingsMenu->addAction ( tr ( "&General Settings..." ), this,
|
||||
SLOT ( OnOpenGeneralSettings() ) );
|
||||
|
@ -175,76 +147,16 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent )
|
|||
SLOT ( close() ), QKeySequence ( Qt::CTRL + Qt::Key_Q ) );
|
||||
|
||||
|
||||
/* Main menu bar -------------------------------------------------------- */
|
||||
// Main menu bar -----------------------------------------------------------
|
||||
pMenu = new QMenuBar ( this );
|
||||
//pMenu->addMenu ( tr ( "&Settings" ), pSettingsMenu );
|
||||
pMenu->addMenu ( pSettingsMenu );
|
||||
//pMenu->addMenu ( tr ( "&?" ), new CLlconHelpMenu ( this ) );
|
||||
pMenu->addMenu ( new CLlconHelpMenu ( this ) );
|
||||
// pMenu->setSeparator ( QMenuBar::InWindowsStyle );
|
||||
|
||||
// Now tell the layout about the menu
|
||||
layout()->setMenuBar ( pMenu );
|
||||
|
||||
|
||||
|
||||
|
||||
/* Menu actions --------------------------------------------------------- */
|
||||
/*
|
||||
pActGeneralSettings = new QAction ( tr ( "&General Settings..."), this );
|
||||
connect( pActGeneralSettings, SIGNAL ( triggered() ),
|
||||
this, SLOT ( OnOpenGeneralSettings() ) );
|
||||
|
||||
pActExit = new QAction ( tr ( "&Quit" ), this );
|
||||
pActExit->setShortcut ( tr ( "Ctrl+Q" ) );
|
||||
connect ( pActExit, SIGNAL ( triggered() ), this, SLOT ( close() ) );
|
||||
|
||||
|
||||
pActAbout = new QAction ( tr ( "&About" ), this );
|
||||
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
|
||||
|
||||
|
||||
pActAbout
|
||||
pHelpMenu
|
||||
*/
|
||||
|
||||
/* Main menu bar -------------------------------------------------------- */
|
||||
/*
|
||||
pMainMenuBar
|
||||
|
||||
pMainMenuBar = new QMenuBar ( this );
|
||||
pMainMenuBar->addMenu ( tr ( "&Settings" ), pSettingsMenu );
|
||||
|
||||
pMenu->addMenu ( tr ( "&?"), new CLlconHelpMenu ( this ) );
|
||||
pMenu->setSeparator ( QMenuBar::InWindowsStyle );
|
||||
|
||||
pSettingsMenu = menuBar()->addMenu ( tr ( "&Settings" ) );
|
||||
pSettingsMenu->addAction(pActGeneralSettings);
|
||||
pSettingsMenu->addSeparator();
|
||||
pSettingsMenu->addAction(pActExit);
|
||||
|
||||
|
||||
pMenu->addMenu ( tr ( "&?"), new CLlconHelpMenu ( this ) );
|
||||
pMenu->setSeparator ( QMenuBar::InWindowsStyle );
|
||||
|
||||
// Now tell the layout about the menu
|
||||
CLlconClientDlgBaseLayout->setMenuBar ( pMainMenuBar );
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// connections -------------------------------------------------------------
|
||||
// Connections -------------------------------------------------------------
|
||||
// push-buttons
|
||||
QObject::connect ( PushButtonConnect, SIGNAL ( clicked() ),
|
||||
this, SLOT ( OnConnectDisconBut() ) );
|
||||
|
@ -279,7 +191,7 @@ pMainMenuBar
|
|||
this, SLOT ( OnChangeChanGain ( int, double ) ) );
|
||||
|
||||
|
||||
// timers ------------------------------------------------------------------
|
||||
// Timers ------------------------------------------------------------------
|
||||
// start timer for status bar
|
||||
TimerStatus.start ( STATUSBAR_UPDATE_TIME );
|
||||
}
|
||||
|
|
|
@ -32,11 +32,13 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
|
|||
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
|
||||
{
|
||||
/* set text for version and application name */
|
||||
setupUi ( this );
|
||||
|
||||
// set text for version and application name
|
||||
TextLabelNameVersion->setText ( QString ( APP_NAME ) +
|
||||
tr ( " server " ) + QString ( VERSION ) );
|
||||
|
||||
/* Create bitmaps */
|
||||
// create bitmaps
|
||||
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
|
||||
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
|
||||
BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) );
|
||||
|
@ -68,25 +70,20 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
|
|||
TextLabelResponseTime->setText ( "" );
|
||||
|
||||
|
||||
/* Main menu bar -------------------------------------------------------- */
|
||||
|
||||
// TODO QT4
|
||||
|
||||
// Main menu bar -----------------------------------------------------------
|
||||
pMenu = new QMenuBar ( this );
|
||||
// pMenu->insertItem ( tr ( "&?" ), new CLlconHelpMenu ( this ) );
|
||||
pMenu->addMenu ( new CLlconHelpMenu ( this ) );
|
||||
//pMenu->setSeparator ( QMenuBar::InWindowsStyle );
|
||||
|
||||
// Now tell the layout about the menu
|
||||
layout()->setMenuBar ( pMenu );
|
||||
|
||||
|
||||
/* connections ---------------------------------------------------------- */
|
||||
// Connections -------------------------------------------------------------
|
||||
// timers
|
||||
QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) );
|
||||
|
||||
|
||||
/* timers --------------------------------------------------------------- */
|
||||
// Timers ------------------------------------------------------------------
|
||||
// start timer for GUI controls
|
||||
Timer.start ( GUI_CONTRL_UPDATE_TIME );
|
||||
}
|
||||
|
@ -105,7 +102,7 @@ void CLlconServerDlg::OnTimer()
|
|||
pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufSize,
|
||||
veciNetwOutBlSiFact, veciNetwInBlSiFact );
|
||||
|
||||
/* fill list with connected clients */
|
||||
// fill list with connected clients
|
||||
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
|
||||
{
|
||||
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
|
||||
|
|
16
src/main.cpp
16
src/main.cpp
|
@ -31,8 +31,9 @@
|
|||
|
||||
|
||||
/* Implementation *************************************************************/
|
||||
/* This pointer is only used for the post-event routine */
|
||||
QApplication* pApp = NULL;
|
||||
// these pointers are only used for the post-event routine
|
||||
QApplication* pApp = NULL;
|
||||
QDialog* pMainWindow = NULL;
|
||||
|
||||
|
||||
int main ( int argc, char** argv )
|
||||
|
@ -125,7 +126,7 @@ cerr << "logging ";
|
|||
CLlconClientDlg ClientDlg ( &Client, 0 );
|
||||
|
||||
// set main window
|
||||
app.setActiveWindow ( &ClientDlg );
|
||||
pMainWindow = &ClientDlg;
|
||||
pApp = &app; // Needed for post-event routine
|
||||
|
||||
// show dialog
|
||||
|
@ -147,7 +148,7 @@ cerr << "logging ";
|
|||
CLlconServerDlg ServerDlg ( &Server, 0 );
|
||||
|
||||
// set main window
|
||||
app.setActiveWindow ( &ServerDlg );
|
||||
pMainWindow = &ServerDlg;
|
||||
pApp = &app; // needed for post-event routine
|
||||
|
||||
// show dialog
|
||||
|
@ -264,12 +265,7 @@ void PostWinMessage ( const _MESSAGE_IDENT MessID, const int iMessageParam,
|
|||
CLlconEvent* LlconEv =
|
||||
new CLlconEvent ( MessID, iMessageParam, iChanNum );
|
||||
|
||||
|
||||
// TODO QT4
|
||||
// Qt will delete the event object when done
|
||||
// QThread::postEvent ( pApp->mainWidget(), LlconEv );
|
||||
|
||||
|
||||
|
||||
QCoreApplication::postEvent ( pMainWindow, LlconEv );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,9 +83,15 @@ void CSocket::SendPacket ( const CVector<unsigned char>& vecbySendBuf,
|
|||
|
||||
void CSocket::OnDataReceived()
|
||||
{
|
||||
// read block from network interface
|
||||
QHostAddress SenderAddress;
|
||||
quint16 SenderPort;
|
||||
|
||||
// read block from network interface and query address of sender
|
||||
const int iNumBytesRead = SocketDevice.readDatagram ( (char*) &vecbyRecBuf[0],
|
||||
MAX_SIZE_BYTES_NETW_BUF );
|
||||
MAX_SIZE_BYTES_NETW_BUF, &SenderAddress, &SenderPort );
|
||||
|
||||
// convert address of client
|
||||
CHostAddress RecHostAddr ( SenderAddress, SenderPort );
|
||||
|
||||
// check if an error occurred
|
||||
if ( iNumBytesRead < 0 )
|
||||
|
@ -93,10 +99,6 @@ void CSocket::OnDataReceived()
|
|||
return;
|
||||
}
|
||||
|
||||
// get host address of client
|
||||
CHostAddress RecHostAddr ( SocketDevice.peerAddress(),
|
||||
SocketDevice.peerPort() );
|
||||
|
||||
if ( bIsClient )
|
||||
{
|
||||
// client
|
||||
|
@ -130,14 +132,8 @@ void CSocket::OnDataReceived()
|
|||
// this was an audio packet, start server
|
||||
// tell the server object to wake up if it
|
||||
// is in sleep mode (Qt will delete the event object when done)
|
||||
|
||||
|
||||
// TODO QT4
|
||||
// QThread::postEvent ( pServer,
|
||||
// new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 ) );
|
||||
|
||||
|
||||
|
||||
QCoreApplication::postEvent ( pServer,
|
||||
new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -914,7 +914,7 @@ void CSound::InitRecording ( int iNewBufferSize, bool bNewBlocking )
|
|||
psSoundcardBuffer[i] = new short[iBufferSizeIn];
|
||||
|
||||
|
||||
/* Send all buffers to driver for filling the queue ----------------- */
|
||||
// Send all buffers to driver for filling the queue --------------------
|
||||
// prepare buffers before sending them to the sound interface
|
||||
PrepareInBuffer ( i );
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ bool CSound::Write ( CVector<short>& psData )
|
|||
}
|
||||
else
|
||||
{
|
||||
/* All buffers are filled, dump new block ----------------------- */
|
||||
// All buffers are filled, dump new block --------------------------
|
||||
// It would be better to kill half of the buffer blocks to set the start
|
||||
// back to the middle: TODO
|
||||
return TRUE; // an error occurred
|
||||
|
@ -1088,25 +1088,25 @@ void CSound::GetDoneBuffer ( int& iCntPrepBuf, int& iIndexDoneBuf )
|
|||
|
||||
void CSound::AddOutBuffer ( int iBufNum )
|
||||
{
|
||||
// Unprepare old wave-header
|
||||
// unprepare old wave-header
|
||||
waveOutUnprepareHeader (
|
||||
m_WaveOut, &m_WaveOutHeader[iBufNum], sizeof ( WAVEHDR ) );
|
||||
|
||||
// Prepare buffers for sending to sound interface
|
||||
// prepare buffers for sending to sound interface
|
||||
PrepareOutBuffer ( iBufNum );
|
||||
|
||||
// Send buffer to driver for filling with new data
|
||||
// send buffer to driver for filling with new data
|
||||
waveOutWrite ( m_WaveOut, &m_WaveOutHeader[iBufNum], sizeof ( WAVEHDR ) );
|
||||
}
|
||||
|
||||
void CSound::PrepareOutBuffer ( int iBufNum )
|
||||
{
|
||||
// Set Header data
|
||||
// set Header data
|
||||
m_WaveOutHeader[iBufNum].lpData = (LPSTR) &psPlaybackBuffer[iBufNum][0];
|
||||
m_WaveOutHeader[iBufNum].dwBufferLength = iBufferSizeOut * BYTES_PER_SAMPLE;
|
||||
m_WaveOutHeader[iBufNum].dwFlags = 0;
|
||||
|
||||
// Prepare wave-header
|
||||
// prepare wave-header
|
||||
waveOutPrepareHeader ( m_WaveOut, &m_WaveOutHeader[iBufNum], sizeof ( WAVEHDR ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
/* Definitions ****************************************************************/
|
||||
// switch here between ASIO (Steinberg) or native Windows(TM) sound interface
|
||||
#undef USE_ASIO_SND_INTERFACE
|
||||
//#define USE_ASIO_SND_INTERFACE
|
||||
#define USE_ASIO_SND_INTERFACE
|
||||
|
||||
|
||||
#define NUM_IN_OUT_CHANNELS 2 /* Stereo recording (but we only
|
||||
|
|
Loading…
Reference in a new issue