From 6608de0bdc28e2f77283848c6620cf5b8e61171f Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 14 Jan 2008 22:14:17 +0000 Subject: [PATCH] first attempt to port to QT4, not working, still a lot to do... --- src/audiocompr.cpp | 8 +++---- src/audiomixerboard.cpp | 24 ++++++++++---------- src/audiomixerboard.h | 2 +- src/channel.cpp | 8 +++---- src/client.cpp | 2 +- src/client.h | 2 +- src/clientsettingsdlg.cpp | 3 +-- src/clientsettingsdlg.h | 10 ++++----- src/global.h | 11 ++++----- src/llconclientdlg.cpp | 47 +++++++++++++++++++-------------------- src/llconclientdlg.h | 6 ++--- src/llconserverdlg.cpp | 9 ++++---- src/llconserverdlg.h | 6 ++--- src/multicolorled.cpp | 3 +-- src/multicolorled.h | 23 ++++++++++--------- src/protocol.cpp | 8 +++---- src/protocol.h | 2 +- src/socket.cpp | 4 ++-- src/socket.h | 15 +++++-------- src/util.cpp | 5 +++-- src/util.h | 19 ++++++++-------- windows/MocQT.bat | 33 +++++++++------------------ 22 files changed, 115 insertions(+), 135 deletions(-) diff --git a/src/audiocompr.cpp b/src/audiocompr.cpp index d9ba65d1..33079000 100755 --- a/src/audiocompr.cpp +++ b/src/audiocompr.cpp @@ -149,7 +149,7 @@ CVector CImaAdpcm::Encode ( const CVector& vecsAudio ) // init diff and step int diff = vecsAudio[i] - iPrevAudio; - ASSERT ( iStepindEnc < IMA_STEP_SIZE_TAB_LEN ); + Q_ASSERT ( iStepindEnc < IMA_STEP_SIZE_TAB_LEN ); int step = ima_step_size[iStepindEnc]; short bytecode = 0; @@ -183,7 +183,7 @@ CVector CImaAdpcm::Encode ( const CVector& vecsAudio ) } // adjust step size - ASSERT ( bytecode < IMA_INDX_ADJUST_TAB_LEN ); + Q_ASSERT ( bytecode < IMA_INDX_ADJUST_TAB_LEN ); iStepindEnc += ima_indx_adjust[bytecode]; // check that values do not exceed the bounds @@ -249,7 +249,7 @@ CVector CImaAdpcm::Decode ( const CVector& vecbyAdpcm ) { const short bytecode = vecsAudio[i] & 0xF ; - ASSERT ( iStepindDec < IMA_STEP_SIZE_TAB_LEN ); + Q_ASSERT ( iStepindDec < IMA_STEP_SIZE_TAB_LEN ); short step = ima_step_size[iStepindDec]; int current = vecsAudio[i - 1]; @@ -274,7 +274,7 @@ CVector CImaAdpcm::Decode ( const CVector& vecbyAdpcm ) current += diff; - ASSERT ( bytecode < IMA_INDX_ADJUST_TAB_LEN ); + Q_ASSERT ( bytecode < IMA_INDX_ADJUST_TAB_LEN ); iStepindDec += ima_indx_adjust[bytecode]; // check that values do not exceed the bounds diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 18292453..cd212354 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -34,13 +34,13 @@ CChannelFader::CChannelFader ( QWidget* pNW, QString sName ) { // create new GUI control objects and store pointers to them - pMainGrid = new QGridLayout ( 2, 1 ); - pFader = new QSlider ( Qt::Vertical, pNW ); - pLabel = new QLabel ( "", pNW ); + pMainGrid = new QGridLayout(); + pFader = new QSlider ( Qt::Vertical, pNW ); + pLabel = new QLabel ( "", pNW ); // setup slider pFader->setPageStep ( 1 ); - pFader->setTickmarks ( QSlider::Both ); + pFader->setTickPosition ( QSlider::TicksBothSides ); pFader->setRange ( 0, AUD_MIX_FADER_MAX ); pFader->setTickInterval ( AUD_MIX_FADER_MAX / 9 ); pFader->setValue ( 0 ); // set init value @@ -57,11 +57,11 @@ CChannelFader::CChannelFader ( QWidget* pNW, pParentLayout->insertLayout ( 0, pMainGrid ); // add help text to controls - QWhatsThis::add ( pFader, "Mixer Fader: Adjusts the audio level of this " + pFader->setWhatsThis ( "Mixer Fader: Adjusts the audio level of this " "channel. All connected clients at the server will be assigned an audio " "fader at each client" ); - QWhatsThis::add ( pLabel, "Mixer Fader Label: Label (fader tag) identifying " + pLabel->setWhatsThis ( "Mixer Fader Label: Label (fader tag) identifying " "the connected client. The tag name can be set in the clients main window." ); @@ -104,17 +104,17 @@ void CChannelFader::SetText ( const std::string sText ) pLabel->setText ( sModText ); } -CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, - const char* name, - WFlags f ) : - QFrame ( parent, name, f ) +CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags f ) : QFrame ( parent, f ) { // set modified style setFrameShape ( QFrame::StyledPanel ); setFrameShadow ( QFrame::Sunken ); // add hboxlayout with horizontal spacer - pMainLayout = new QHBoxLayout ( this, 11, 0 ); + +// TODO is this ok this way? Don't we need the border 11 and space 0? + pMainLayout = new QHBoxLayout ( this );//, 11, 0 ); + pMainLayout->addItem ( new QSpacerItem ( 0, 0, QSizePolicy::Expanding ) ); // create all mixer controls and make them invisible @@ -194,7 +194,7 @@ std::string CAudioMixerBoard::GenFaderText ( CChannelShortInfo& ChanInfo ) { // convert IP address to text and show it const QHostAddress addrTest ( ChanInfo.iIpAddr ); - return addrTest.toString().latin1(); + return std::string ( addrTest.toString().toLatin1() ); } else { diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index 7b752b6d..6bd3a004 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -84,7 +84,7 @@ class CAudioMixerBoard : public QFrame Q_OBJECT public: - CAudioMixerBoard ( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); + CAudioMixerBoard ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); void HideAll(); void ApplyNewConClientList ( CVector& vecChanInfo ); diff --git a/src/channel.cpp b/src/channel.cpp index 4c372bd0..9bb6df40 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -99,7 +99,7 @@ CVector CChannelSet::CreateChannelList() // append channel ID, IP address and channel name to storing vectors vecChanInfo.Add ( CChannelShortInfo ( i, // ID - vecChannels[i].GetAddress().InetAddr.ip4Addr(), // IP address + vecChannels[i].GetAddress().InetAddr.toIPv4Address(), // IP address vecChannels[i].GetName() /* name */ ) ); } } @@ -549,7 +549,7 @@ void CChannel::OnJittBufSizeChange ( int iNewJitBufSize ) void CChannel::OnChangeChanGain ( int iChanID, double dNewGain ) { - ASSERT ( ( iChanID >= 0 ) && ( iChanID < MAX_NUM_CHANNELS ) ); + Q_ASSERT ( ( iChanID >= 0 ) && ( iChanID < MAX_NUM_CHANNELS ) ); // set value vecdGains[iChanID] = dNewGain; @@ -685,8 +685,8 @@ for ( int i = 0; i < iCurNetwInBlSiFact * MIN_BLOCK_SIZE_SAMPLES; i++ ) { { // log new connection CHostAddress address ( GetAddress() ); - qDebug ( CLogTimeDate::toString() + "Connected with IP %s", - address.InetAddr.toString().latin1() ); + qDebug() << CLogTimeDate::toString() << "Connected with IP " << + address.InetAddr.toString().toLatin1(); emit NewConnection(); } diff --git a/src/client.cpp b/src/client.cpp index 8e2e3174..51cbb650 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -97,7 +97,7 @@ bool CClient::SetServerAddr ( QString strNAddr ) // it was no vaild IP address, try to get host by name, assuming // that the string contains a valid host name string - const hostent* HostInf = gethostbyname ( strNAddr.latin1() ); + const hostent* HostInf = gethostbyname ( strNAddr.toLatin1() ); if ( HostInf ) { diff --git a/src/client.h b/src/client.h index 3f3e37d8..a773e335 100755 --- a/src/client.h +++ b/src/client.h @@ -53,7 +53,7 @@ /* Classes ********************************************************************/ -class CClient : public QObject, public QThread +class CClient : public QThread { Q_OBJECT diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index d0a1f20f..ed55a33f 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -27,8 +27,7 @@ /* Implementation *************************************************************/ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, - const char* name, bool modal, WFlags f) : pClient ( pNCliP ), - CClientSettingsDlgBase ( parent, name, modal, f ) + Qt::WindowFlags f ) : pClient ( pNCliP ), QDialog ( parent, f ) { /* Init timing jitter text label */ TextLabelStdDevTimer->setText ( "" ); diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index ec18d305..255c633c 100755 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -49,20 +49,20 @@ /* Classes ********************************************************************/ -class CClientSettingsDlg : public CClientSettingsDlgBase +class CClientSettingsDlg : public QDialog, private Ui_CClientSettingsDlgBase { Q_OBJECT public: CClientSettingsDlg ( CClient* pNCliP, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, WFlags f = 0 ); + Qt::WindowFlags f = 0 ); void SetStatus ( const int iMessType, const int iStatus ); protected: - CClient* pClient; - QTimer TimerStatus; - void UpdateDisplay(); + CClient* pClient; + QTimer TimerStatus; + void UpdateDisplay(); public slots: void OnTimerStatus() { UpdateDisplay(); } diff --git a/src/global.h b/src/global.h index 3e20d01c..bdd4f9df 100755 --- a/src/global.h +++ b/src/global.h @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -147,11 +148,11 @@ public: QString strError; }; -class CLlconEvent : public QCustomEvent +class CLlconEvent : public QEvent { public: CLlconEvent ( int iNewMeTy, int iNewSt, int iNewChN = 0 ) : - QCustomEvent ( QEvent::User + 11 ), iMessType ( iNewMeTy ), iStatus ( iNewSt ), + QEvent ( QEvent::Type ( QEvent::User + 11 ) ), iMessType ( iNewMeTy ), iStatus ( iNewSt ), iChanNum ( iNewChN ) {} int iMessType; @@ -162,9 +163,9 @@ public: /* Prototypes for global functions ********************************************/ // command line parsing, TODO do not declare functions globally but in a class -std::string UsageArguments ( char **argv ); -bool GetFlagArgument ( int, char **argv, int &i, std::string strShortOpt, std::string strLongOpt ); -bool GetStringArgument ( int argc, char **argv, int &i, std::string strShortOpt, std::string strLongOpt, std::string & strArg ); +std::string UsageArguments ( char **argv ); +bool GetFlagArgument ( int, char **argv, int &i, std::string strShortOpt, std::string strLongOpt ); +bool GetStringArgument ( int argc, char **argv, int &i, std::string strShortOpt, std::string strLongOpt, std::string & strArg ); bool GetNumericArgument ( int argc, char **argv, int &i, std::string strShortOpt, std::string strLongOpt, double rRangeStart, double rRangeStop, double & rValue); // posting a window message diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 89d54e5a..0bf57389 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -26,62 +26,61 @@ /* Implementation *************************************************************/ -CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent, - const char* name, bool modal, WFlags f ) : pClient ( pNCliP ), - CLlconClientDlgBase ( parent, name, modal, f ), - ClientSettingsDlg ( pNCliP, 0, 0, FALSE, Qt::WStyle_MinMax ) +CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent ) + : pClient ( pNCliP ), QDialog ( parent ), + ClientSettingsDlg ( pNCliP, 0, Qt::WindowMinMaxButtonsHint ) { /* add help text to controls */ QString strInpLevH = tr ( "Input level meter: Shows the level of the " "input audio signal of the sound card. The level is in dB. Overload " "should be avoided." ); - QWhatsThis::add ( TextLabelInputLevel, strInpLevH ); - QWhatsThis::add ( ProgressBarInputLevelL, strInpLevH ); - QWhatsThis::add ( ProgressBarInputLevelR, strInpLevH ); + TextLabelInputLevel->setWhatsThis ( strInpLevH ); + ProgressBarInputLevelL->setWhatsThis ( strInpLevH ); + ProgressBarInputLevelR->setWhatsThis ( strInpLevH ); - QWhatsThis::add(PushButtonConnect, tr ( "Connect / Disconnect Button:" + PushButtonConnect->setWhatsThis ( tr ( "Connect / Disconnect Button:" " Push this button to connect the server. A valid IP address has " "to be specified before. If the client is connected, pressing this " "button will disconnect the connection." ) ); - QWhatsThis::add(TextLabelStatus, tr ( "Status Bar: In the status bar " + TextLabelStatus->setWhatsThis ( tr ( "Status Bar: In the status bar " "different messages are displayed. E.g., if an error occurred or the " "status of the connection is shown." ) ); QString strServAddrH = tr ( "Server Address: In this edit control, " "the IP address of the server can be set. If an invalid address was " "chosen, an error message is shown in the status bar." ); - QWhatsThis::add ( TextLabelServerAddr, strServAddrH ); - QWhatsThis::add ( LineEditServerAddr, strServAddrH ); + TextLabelServerAddr->setWhatsThis ( strServAddrH ); + LineEditServerAddr->setWhatsThis ( strServAddrH ); QString strFaderTag = tr ( "Fader Tag: In this edit control, " "the tag string of your fader can be set. This tag will appear " "at your fader on the mixer board when connected to the server."); - QWhatsThis::add ( TextLabelServerTag, strFaderTag ); - QWhatsThis::add ( LineEditFaderTag, strFaderTag ); + TextLabelServerTag->setWhatsThis ( strFaderTag ); + LineEditFaderTag->setWhatsThis ( strFaderTag ); QString strAudFader = tr ( "Audio Fader: With the audio fader " "control the level of left and right audio input channels can " "be controlled." ); - QWhatsThis::add ( TextAudInFader, strAudFader ); - QWhatsThis::add ( SliderAudInFader, strAudFader ); + TextAudInFader->setWhatsThis ( strAudFader ); + SliderAudInFader->setWhatsThis ( strAudFader ); QString strAudReverb = tr ( "Reverberation Level: The level of " "reverberation effect can be set with this control. The channel to " "which that reverberation effect shall be applied can be chosen " "with the Reverberation Channel Selection radio buttons." ); - QWhatsThis::add ( TextLabelAudReverb, strAudReverb ); - QWhatsThis::add ( SliderAudReverb, strAudReverb ); + TextLabelAudReverb->setWhatsThis ( strAudReverb ); + SliderAudReverb->setWhatsThis ( strAudReverb ); QString strRevChanSel = tr ( "Reverberation Channel Selection: " "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." ); - QWhatsThis::add ( TextLabelReverbSelection, strRevChanSel ); - QWhatsThis::add ( RadioButtonRevSelL, strRevChanSel ); - QWhatsThis::add ( RadioButtonRevSelR, strRevChanSel ); + TextLabelReverbSelection->setWhatsThis ( strRevChanSel ); + RadioButtonRevSelL->setWhatsThis ( strRevChanSel ); + RadioButtonRevSelR->setWhatsThis ( strRevChanSel ); - QWhatsThis::add ( LEDOverallStatus, tr ( "Overall Status: " + LEDOverallStatus->setWhatsThis ( tr ( "Overall Status: " "The overall status of the software is shown. If either the " "network or sound interface has bad status, this LED will show " "red color." ) ); @@ -210,10 +209,10 @@ CLlconClientDlg::~CLlconClientDlg() void CLlconClientDlg::closeEvent ( QCloseEvent * Event ) { // store IP address - pClient->strIPAddress = LineEditServerAddr->text().latin1(); + pClient->strIPAddress = LineEditServerAddr->text().toLatin1(); // store fader tag - pClient->strName = LineEditFaderTag->text().latin1(); + pClient->strName = LineEditFaderTag->text().toLatin1(); // default implementation of this event handler routine Event->accept(); @@ -279,7 +278,7 @@ void CLlconClientDlg::OnOpenGeneralSettings() void CLlconClientDlg::OnFaderTagTextChanged ( const QString& strNewName ) { // refresh internal name parameter - pClient->strName = strNewName.latin1(); + pClient->strName = strNewName.toLatin1(); // update name at server pClient->SetRemoteName(); diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index 3baf1d59..9b1c8c8c 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -63,14 +63,12 @@ /* Classes ********************************************************************/ -class CLlconClientDlg : public CLlconClientDlgBase +class CLlconClientDlg : public QDialog, private Ui_CLlconClientDlgBase { Q_OBJECT public: - CLlconClientDlg ( CClient* pNCliP, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, WFlags f = 0 ); - + CLlconClientDlg ( CClient* pNCliP, QWidget* parent = 0 ); virtual ~CLlconClientDlg(); protected: diff --git a/src/llconserverdlg.cpp b/src/llconserverdlg.cpp index 5d1b4eb6..141aebfc 100755 --- a/src/llconserverdlg.cpp +++ b/src/llconserverdlg.cpp @@ -26,9 +26,8 @@ /* Implementation *************************************************************/ -CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent, - const char* name, bool modal, WFlags f ) : pServer ( pNServP ), - CLlconServerDlgBase ( parent, name, modal, f ) +CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent ) + : pServer ( pNServP ), QDialog ( parent ) { /* set text for version and application name */ TextLabelNameVersion->setText ( QString ( APP_NAME ) + @@ -116,11 +115,11 @@ void CLlconServerDlg::OnTimer() /* fill list with connected clients */ for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) { - if ( ! ( vecHostAddresses[i].InetAddr == QHostAddress ( (Q_UINT32) 0 ) ) ) + if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) ) { // IP, port number vecpListViewItems[i]->setText ( 0, QString().sprintf ( "%s : %d", - vecHostAddresses[i].InetAddr.toString().latin1(), + vecHostAddresses[i].InetAddr.toString().toLatin1(), vecHostAddresses[i].iPort ) /* IP, port */); // name diff --git a/src/llconserverdlg.h b/src/llconserverdlg.h index 773e589d..13506d50 100755 --- a/src/llconserverdlg.h +++ b/src/llconserverdlg.h @@ -46,14 +46,12 @@ /* Classes ********************************************************************/ -class CLlconServerDlg : public CLlconServerDlgBase +class CLlconServerDlg : public QDialog, private Ui_CLlconServerDlgBase { Q_OBJECT public: - CLlconServerDlg ( CServer* pNServP, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, WFlags f = 0 ); - + CLlconServerDlg ( CServer* pNServP, QWidget* parent = 0 ); virtual ~CLlconServerDlg() {} protected: diff --git a/src/multicolorled.cpp b/src/multicolorled.cpp index afcd37c3..c0bbbb90 100755 --- a/src/multicolorled.cpp +++ b/src/multicolorled.cpp @@ -176,8 +176,7 @@ void CMultiColorLEDbase::SetUpdateTime ( int iNUTi ) } -CMultiColorLED::CMultiColorLED ( QWidget* parent, const char* name, WFlags f ) : - QLabel ( parent, name, f ) +CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f ) : QLabel ( parent, f ) { // set modified style setFrameShape ( QFrame::Panel ); diff --git a/src/multicolorled.h b/src/multicolorled.h index dacfacbf..a90c01f5 100755 --- a/src/multicolorled.h +++ b/src/multicolorled.h @@ -36,7 +36,8 @@ #include #include #include -#include +#include +#include #include "global.h" @@ -48,7 +49,7 @@ /* Classes ********************************************************************/ -class CMultiColorLEDbase : public QObject +class CMultiColorLEDbase : public QLabel { Q_OBJECT @@ -88,10 +89,10 @@ protected slots: }; -class CMultiColorLED : public QLabel, public CMultiColorLEDbase +class CMultiColorLED : public CMultiColorLEDbase { public: - CMultiColorLED ( QWidget* parent, const char* name = 0, WFlags f = 0 ); + CMultiColorLED ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); protected: virtual void SetPixmap ( QPixmap& NewBitmap ) { setPixmap ( NewBitmap ); } @@ -104,7 +105,7 @@ public: CMultColLEDListViewItem ( const int iNewCol ) : iColumn ( iNewCol ), pListViewItem ( NULL ) {} - void SetListViewItemPointer ( QListViewItem* pNewListViewItem ) + void SetListViewItemPointer ( QTreeWidgetItem* pNewListViewItem ) { pListViewItem = pNewListViewItem; } @@ -114,20 +115,20 @@ protected: { if ( pListViewItem != NULL ) { - pListViewItem->setPixmap ( iColumn, NewBitmap ); + pListViewItem->setIcon ( iColumn, QIcon ( NewBitmap ) ); } } - QListViewItem* pListViewItem; - int iColumn; + QTreeWidgetItem* pListViewItem; + int iColumn; }; -class CServerListViewItem : public QListViewItem +class CServerListViewItem : public QTreeWidgetItem { public: - CServerListViewItem ( QListView* parent ) : LED0 ( 2 ), LED1 ( 3 ), - QListViewItem ( parent ) + CServerListViewItem ( QTreeWidget* parent ) : LED0 ( 2 ), LED1 ( 3 ), + QTreeWidgetItem ( parent ) { LED0.SetListViewItemPointer ( this ); LED1.SetListViewItemPointer ( this ); diff --git a/src/protocol.cpp b/src/protocol.cpp index a0b80132..5cb8ff4c 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -702,8 +702,8 @@ uint32_t CProtocol::GetValFromStream ( const CVector& vecIn, note: iPos is automatically incremented in this function */ // 4 bytes maximum since we return uint32 - ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) ); - ASSERT ( vecIn.Size() >= iPos + iNumOfBytes ); + Q_ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) ); + Q_ASSERT ( vecIn.Size() >= iPos + iNumOfBytes ); uint32_t iRet = 0; for ( int i = 0; i < iNumOfBytes; i++ ) @@ -781,8 +781,8 @@ void CProtocol::PutValOnStream ( CVector& vecIn, note: iPos is automatically incremented in this function */ // 4 bytes maximum since we use uint32 - ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) ); - ASSERT ( vecIn.Size() >= iPos + iNumOfBytes ); + Q_ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) ); + Q_ASSERT ( vecIn.Size() >= iPos + iNumOfBytes ); for ( int i = 0; i < iNumOfBytes; i++ ) { diff --git a/src/protocol.h b/src/protocol.h index a4a4e367..522cd1d7 100755 --- a/src/protocol.h +++ b/src/protocol.h @@ -26,7 +26,7 @@ #define PROTOCOL_H__3B123453_4344_BB2392354455IUHF1912__INCLUDED_ #include -#include +#include #include #include #include "global.h" diff --git a/src/socket.cpp b/src/socket.cpp index 3d6139c2..9337e878 100755 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -33,7 +33,7 @@ void CSocket::Init() // initialize the listening socket bool bSuccess = SocketDevice.bind ( - QHostAddress ( (Q_UINT32) 0 ), // INADDR_ANY + QHostAddress ( (quint32) 0 ), // INADDR_ANY LLCON_PORT_NUMBER ); if ( bIsClient ) @@ -44,7 +44,7 @@ void CSocket::Init() // if server and client is on same machine, decrease port number by // one by definition bSuccess = SocketDevice.bind ( - QHostAddress( (Q_UINT32) 0 ), // INADDR_ANY + QHostAddress( (quint32) 0 ), // INADDR_ANY LLCON_PORT_NUMBER - 1 ); } } diff --git a/src/socket.h b/src/socket.h index 428f6a6e..5bb0cc70 100755 --- a/src/socket.h +++ b/src/socket.h @@ -28,8 +28,7 @@ #include #include #include -#include -#include +#include #include #include "global.h" #include "channel.h" @@ -47,13 +46,11 @@ class CSocket : public QObject Q_OBJECT public: - CSocket(CChannel* pNewChannel) : pChannel(pNewChannel), - SocketDevice(QSocketDevice::Datagram /* UDP */), bIsClient(true) - {Init();} + CSocket(CChannel* pNewChannel) : pChannel(pNewChannel), bIsClient(true) + { Init(); } CSocket(CChannelSet* pNewChannelSet, QObject* pNServP) : - pChannelSet(pNewChannelSet), pServer ( pNServP ), - SocketDevice(QSocketDevice::Datagram /* UDP */), bIsClient(false) - {Init();} + pChannelSet(pNewChannelSet), pServer ( pNServP ), bIsClient(false) + { Init(); } virtual ~CSocket() {} void SendPacket ( const CVector& vecbySendBuf, @@ -62,7 +59,7 @@ public: protected: void Init(); - QSocketDevice SocketDevice; + QUdpSocket SocketDevice; CVector vecbyRecBuf; CHostAddress RecHostAddr; diff --git a/src/util.cpp b/src/util.cpp index 37267c92..4ba1476d 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -269,9 +269,10 @@ double CAudioReverb::ProcessSample ( const double input ) * GUI utilities * \******************************************************************************/ /* About dialog ------------------------------------------------------------- */ -CAboutDlg::CAboutDlg ( QWidget* parent, const char* name, bool modal, WFlags f ) - : CAboutDlgBase ( parent, name, modal, f ) +CAboutDlg::CAboutDlg ( QWidget* parent ) : QDialog ( parent ) { + setupUi ( this ); + // set the text for the about dialog html text control TextViewCredits->setText ( "

" // general description of llcon software diff --git a/src/util.h b/src/util.h index 0dfeb5b7..c10ad847 100755 --- a/src/util.h +++ b/src/util.h @@ -26,9 +26,9 @@ #define UTIL_HOIH934256GEKJH98_3_43445KJIUHF1912__INCLUDED_ #include -#include +#include #include -#include +#include #include #include #include @@ -314,20 +314,19 @@ template void CMovingAv::Add ( const TData tNewD ) * GUI utilities * \******************************************************************************/ /* About dialog ------------------------------------------------------------- */ -class CAboutDlg : public CAboutDlgBase +class CAboutDlg : public QDialog, private Ui_CAboutDlgBase { Q_OBJECT public: - CAboutDlg ( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, - WFlags f = 0 ); + CAboutDlg ( QWidget* parent = 0 ); static QString GetVersionAndNameStr ( const bool bWithHtml = true ); }; /* Help menu ---------------------------------------------------------------- */ -class CLlconHelpMenu : public QPopupMenu +class CLlconHelpMenu : public QMenu { Q_OBJECT @@ -362,8 +361,8 @@ protected: class CHostAddress { public: - CHostAddress() : InetAddr ( (Q_UINT32) 0 ), iPort ( 0 ) {} - CHostAddress ( const QHostAddress NInetAddr, const Q_UINT16 iNPort ) : + CHostAddress() : InetAddr ( (quint32) 0 ), iPort ( 0 ) {} + CHostAddress ( const QHostAddress NInetAddr, const quint16 iNPort ) : InetAddr ( NInetAddr ), iPort ( iNPort ) {} CHostAddress ( const CHostAddress& NHAddr ) : InetAddr ( NHAddr.InetAddr ), iPort ( NHAddr.iPort ) {} @@ -375,7 +374,7 @@ public: { return ( ( CompAddr.InetAddr == InetAddr ) && ( CompAddr.iPort == iPort ) ); } QHostAddress InetAddr; - Q_UINT16 iPort; + quint16 iPort; }; class CChannelShortInfo @@ -513,7 +512,7 @@ public: { if ( bDoLogging ) { - fprintf ( pFile, "%s\n", sNewStr.latin1() ); + fprintf ( pFile, "%s\n", sNewStr.toLatin1() ); fflush ( pFile ); } } diff --git a/windows/MocQT.bat b/windows/MocQT.bat index 193e3d50..ccde14cf 100755 --- a/windows/MocQT.bat +++ b/windows/MocQT.bat @@ -25,33 +25,22 @@ rem * rem\******************************************************************************/ -rem .h -------------- +rem .h -------------- %qtdir%\bin\moc.exe ..\src\util.h -o moc\moc_util.cpp %qtdir%\bin\moc.exe ..\src\multicolorled.h -o moc\moc_multicolorled.cpp -%qtdir%\bin\moc.exe ..\src\audiomixerboard.h -o moc\moc_audiomixerboard.cpp -%qtdir%\bin\moc.exe ..\src\llconclientdlg.h -o moc\moc_llconclientdlg.cpp +%qtdir%\bin\moc.exe ..\src\audiomixerboard.h -o moc\moc_audiomixerboard.cpp +%qtdir%\bin\moc.exe ..\src\llconclientdlg.h -o moc\moc_llconclientdlg.cpp %qtdir%\bin\moc.exe ..\src\clientsettingsdlg.h -o moc\moc_clientsettingsdlg.cpp %qtdir%\bin\moc.exe ..\src\llconserverdlg.h -o moc\moc_llconserverdlg.cpp -%qtdir%\bin\moc.exe ..\src\server.h -o moc\moc_server.cpp +%qtdir%\bin\moc.exe ..\src\server.h -o moc\moc_server.cpp %qtdir%\bin\moc.exe ..\src\client.h -o moc\moc_client.cpp %qtdir%\bin\moc.exe ..\src\socket.h -o moc\moc_socket.cpp -%qtdir%\bin\moc.exe ..\src\protocol.h -o moc\moc_protocol.cpp -%qtdir%\bin\moc.exe ..\src\channel.h -o moc\moc_channel.cpp +%qtdir%\bin\moc.exe ..\src\protocol.h -o moc\moc_protocol.cpp +%qtdir%\bin\moc.exe ..\src\channel.h -o moc\moc_channel.cpp -rem .ui ------------- -%qtdir%\bin\uic.exe ..\src\aboutdlgbase.ui -o moc\aboutdlgbase.h -%qtdir%\bin\uic.exe ..\src\aboutdlgbase.ui -i aboutdlgbase.h -o moc\aboutdlgbase.cpp -%qtdir%\bin\moc.exe moc\aboutdlgbase.h -o moc\moc_aboutdlgbase.cpp - -%qtdir%\bin\uic.exe ..\src\llconclientdlgbase.ui -o moc\llconclientdlgbase.h -%qtdir%\bin\uic.exe ..\src\llconclientdlgbase.ui -i llconclientdlgbase.h -o moc\llconclientdlgbase.cpp -%qtdir%\bin\moc.exe moc\llconclientdlgbase.h -o moc\moc_llconclientdlgbase.cpp - -%qtdir%\bin\uic.exe ..\src\clientsettingsdlgbase.ui -o moc\clientsettingsdlgbase.h -%qtdir%\bin\uic.exe ..\src\clientsettingsdlgbase.ui -i clientsettingsdlgbase.h -o moc\clientsettingsdlgbase.cpp -%qtdir%\bin\moc.exe moc\clientsettingsdlgbase.h -o moc\moc_clientsettingsdlgbase.cpp - -%qtdir%\bin\uic.exe ..\src\llconserverdlgbase.ui -o moc\llconserverdlgbase.h -%qtdir%\bin\uic.exe ..\src\llconserverdlgbase.ui -i llconserverdlgbase.h -o moc\llconserverdlgbase.cpp -%qtdir%\bin\moc.exe moc\llconserverdlgbase.h -o moc\moc_llconserverdlgbase.cpp +rem .ui ------------- +%qtdir%\bin\uic.exe ..\src\aboutdlgbase_qt4.ui -o moc\aboutdlgbase.h +%qtdir%\bin\uic.exe ..\src\llconclientdlgbase_qt4.ui -o moc\llconclientdlgbase.h +%qtdir%\bin\uic.exe ..\src\clientsettingsdlgbase_qt4.ui -o moc\clientsettingsdlgbase.h +%qtdir%\bin\uic.exe ..\src\llconserverdlgbase_qt4.ui -o moc\llconserverdlgbase.h