third attempt to port to QT4, not working, still a lot to do...

This commit is contained in:
Volker Fischer 2008-01-15 22:54:04 +00:00
parent 221a612427
commit 8b0389c192
5 changed files with 178 additions and 190 deletions

View file

@ -105,6 +105,9 @@
#define TIME_MOV_AV_RESPONSE 30 // seconds #define TIME_MOV_AV_RESPONSE 30 // seconds
#define LEN_MOV_AV_RESPONSE ( TIME_MOV_AV_RESPONSE * 1000 / MIN_BLOCK_DURATION_MS ) #define LEN_MOV_AV_RESPONSE ( TIME_MOV_AV_RESPONSE * 1000 / MIN_BLOCK_DURATION_MS )
// GUI definition: width/heigth size of LED pixmaps
#define LED_WIDTH_HEIGHT_SIZE_PIXEL 13
#define _MAXSHORT 32767 #define _MAXSHORT 32767
#define _MAXBYTE 255 // binary: 11111111 #define _MAXBYTE 255 // binary: 11111111

View file

@ -27,40 +27,29 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent ) CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
: pServer ( pNServP ), QDialog ( parent ) : pServer ( pNServP ), QDialog ( parent ),
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
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 */ /* set text for version and application name */
TextLabelNameVersion->setText ( QString ( APP_NAME ) + TextLabelNameVersion->setText ( QString ( APP_NAME ) +
tr ( " server " ) + QString ( VERSION ) ); tr ( " server " ) + QString ( VERSION ) );
/* Create bitmaps */ /* Create bitmaps */
/* Define size of the bitmaps */
const int iXSize = 13;
const int iYSize = 13;
BitmCubeGreen.resize ( iXSize, iYSize );
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) ); BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
BitmCubeRed.resize ( iXSize, iYSize );
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) ); BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
BitmCubeYellow.resize ( iXSize, iYSize );
BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) ); BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) );
/* set up list view for connected clients (We assume that one column is // set up list view for connected clients
already there) */
ListViewClients->setColumnText ( 0, tr ( "Client IP : Port" ) );
ListViewClients->setColumnWidth ( 0, 170 ); ListViewClients->setColumnWidth ( 0, 170 );
ListViewClients->addColumn ( tr ( "Name" ) ); // ListViewClients->setColumnAlignment ( 1, Qt::AlignLeft );
ListViewClients->setColumnAlignment ( 1, Qt::AlignLeft );
ListViewClients->setColumnWidth ( 1, 150 ); ListViewClients->setColumnWidth ( 1, 150 );
ListViewClients->addColumn ( tr ( "Put" ) ); // ListViewClients->setColumnAlignment ( 2, Qt::AlignCenter );
ListViewClients->setColumnAlignment ( 2, Qt::AlignCenter ); // ListViewClients->setColumnAlignment ( 3, Qt::AlignCenter );
ListViewClients->addColumn ( tr ( "Get" ) ); // ListViewClients->setColumnAlignment ( 4, Qt::AlignRight );
ListViewClients->setColumnAlignment ( 3, Qt::AlignCenter ); // ListViewClients->setColumnAlignment ( 5, Qt::AlignRight );
ListViewClients->addColumn ( tr ( "Jitter buffer size" ) ); // ListViewClients->setColumnAlignment ( 6, Qt::AlignRight );
ListViewClients->setColumnAlignment ( 4, Qt::AlignRight );
ListViewClients->addColumn ( tr ( "Block Size In" ) );
ListViewClients->setColumnAlignment ( 5, Qt::AlignRight );
ListViewClients->addColumn ( tr ( "Block Size Out" ) );
ListViewClients->setColumnAlignment ( 6, Qt::AlignRight );
ListViewClients->clear(); ListViewClients->clear();
/* insert items in reverse order because in Windows all of them are /* insert items in reverse order because in Windows all of them are
@ -74,26 +63,27 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
#endif #endif
} }
/* Init timing jitter text label */ // Init timing jitter text label
TextLabelResponseTime->setText ( "" ); TextLabelResponseTime->setText ( "" );
/* Main menu bar -------------------------------------------------------- */ /* Main menu bar -------------------------------------------------------- */
pMenu = new QMenuBar ( this ); pMenu = new QMenuBar ( this );
pMenu->insertItem ( tr ( "&?" ), new CLlconHelpMenu ( this ) ); // pMenu->insertItem ( tr ( "&?" ), new CLlconHelpMenu ( this ) );
pMenu->setSeparator ( QMenuBar::InWindowsStyle ); pMenu->addMenu ( new CLlconHelpMenu ( this ) );
//pMenu->setSeparator ( QMenuBar::InWindowsStyle );
/* Now tell the layout about the menu */ // Now tell the layout about the menu
CLlconServerDlgBaseLayout->setMenuBar ( pMenu ); layout()->setMenuBar ( pMenu );
/* connections ---------------------------------------------------------- */ /* connections ---------------------------------------------------------- */
/* timers */ // timers
QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) ); QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) );
/* timers --------------------------------------------------------------- */ /* timers --------------------------------------------------------------- */
/* start timer for GUI controls */ // start timer for GUI controls
Timer.start ( GUI_CONTRL_UPDATE_TIME ); Timer.start ( GUI_CONTRL_UPDATE_TIME );
} }

View file

@ -104,7 +104,7 @@ cerr << "logging ";
exit ( 1 ); exit ( 1 );
} }
/* Application object */ // Application object
QApplication app ( argc, argv, bUseGUI ); QApplication app ( argc, argv, bUseGUI );
if ( bIsClient ) if ( bIsClient )
@ -118,10 +118,10 @@ cerr << "logging ";
Settings.Load ( strIniFileName ); Settings.Load ( strIniFileName );
// GUI object // GUI object
CLlconClientDlg ClientDlg ( &Client, 0, 0, FALSE, Qt::WStyle_MinMax ); CLlconClientDlg ClientDlg ( &Client, 0 );
// set main window // set main window
app.setMainWidget ( &ClientDlg ); app.setActiveWindow ( &ClientDlg );
pApp = &app; // Needed for post-event routine pApp = &app; // Needed for post-event routine
// show dialog // show dialog
@ -140,11 +140,10 @@ cerr << "logging ";
if ( bUseGUI ) if ( bUseGUI )
{ {
// GUI object for the server // GUI object for the server
CLlconServerDlg ServerDlg ( &Server, 0, 0, FALSE, CLlconServerDlg ServerDlg ( &Server, 0 );
Qt::WStyle_MinMax );
// set main window // set main window
app.setMainWidget ( &ServerDlg ); app.setActiveWindow ( &ServerDlg );
pApp = &app; // needed for post-event routine pApp = &app; // needed for post-event routine
// show dialog // show dialog
@ -154,7 +153,7 @@ cerr << "logging ";
else else
{ {
// only start application without using the GUI // only start application without using the GUI
qDebug ( CAboutDlg::GetVersionAndNameStr ( false ) ); qDebug() << CAboutDlg::GetVersionAndNameStr ( false );
app.exec(); app.exec();
} }
} }
@ -262,6 +261,6 @@ void PostWinMessage ( const _MESSAGE_IDENT MessID, const int iMessageParam,
new CLlconEvent ( MessID, iMessageParam, iChanNum ); new CLlconEvent ( MessID, iMessageParam, iChanNum );
// Qt will delete the event object when done // Qt will delete the event object when done
QThread::postEvent ( pApp->mainWidget(), LlconEv ); // QThread::postEvent ( pApp->mainWidget(), LlconEv );
} }
} }

View file

@ -30,20 +30,16 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CMultiColorLEDbase::CMultiColorLEDbase() CMultiColorLEDbase::CMultiColorLEDbase() :
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeGrey ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
{ {
/* Define size of the bitmaps */
const int iXSize = 13;
const int iYSize = 13;
/* Create bitmaps */ /* Create bitmaps */
BitmCubeGreen.resize ( iXSize, iYSize );
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) ); BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
BitmCubeRed.resize ( iXSize, iYSize );
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) ); BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
BitmCubeGrey.resize ( iXSize, iYSize );
BitmCubeGrey.fill ( QColor ( 192, 192, 192 ) ); BitmCubeGrey.fill ( QColor ( 192, 192, 192 ) );
BitmCubeYellow.resize ( iXSize, iYSize );
BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) ); BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) );
/* Init color flags */ /* Init color flags */
@ -141,21 +137,21 @@ void CMultiColorLEDbase::SetLight ( int iNewStatus )
switch ( iNewStatus ) switch ( iNewStatus )
{ {
case MUL_COL_LED_GREEN: case MUL_COL_LED_GREEN:
/* Green light */ // Green light
bFlagGreenLi = true; bFlagGreenLi = true;
TimerGreenLight.changeInterval ( iUpdateTime ); TimerGreenLight.setInterval ( iUpdateTime );
break; break;
case MUL_COL_LED_YELLOW: case MUL_COL_LED_YELLOW:
/* Yellow light */ // Yellow light
bFlagYellowLi = true; bFlagYellowLi = true;
TimerYellowLight.changeInterval ( iUpdateTime ); TimerYellowLight.setInterval ( iUpdateTime );
break; break;
case MUL_COL_LED_RED: case MUL_COL_LED_RED:
/* Red light */ // Red light
bFlagRedLi = true; bFlagRedLi = true;
TimerRedLight.changeInterval ( iUpdateTime ); TimerRedLight.setInterval ( iUpdateTime );
break; break;
} }

View file

@ -89,7 +89,7 @@ void CServer::Stop()
// logging // logging
QString strLogStr = CLogTimeDate::toString() + "Server stopped"; QString strLogStr = CLogTimeDate::toString() + "Server stopped";
qDebug ( strLogStr ); // on console qDebug() << strLogStr; // on console
Logging << strLogStr; // in log file Logging << strLogStr; // in log file
} }