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

This commit is contained in:
Volker Fischer 2008-01-15 20:07:55 +00:00
parent 6608de0bdc
commit 221a612427
8 changed files with 139 additions and 43 deletions

View file

@ -30,7 +30,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent )
: pClient ( pNCliP ), QDialog ( parent ), : pClient ( pNCliP ), QDialog ( parent ),
ClientSettingsDlg ( pNCliP, 0, Qt::WindowMinMaxButtonsHint ) ClientSettingsDlg ( pNCliP, 0, Qt::WindowMinMaxButtonsHint )
{ {
/* add help text to controls */ setupUi ( this );
// add help text to controls
QString strInpLevH = tr ( "<b>Input level meter:</b> Shows the level of the " QString strInpLevH = tr ( "<b>Input level meter:</b> Shows the level of the "
"input audio signal of the sound card. The level is in dB. Overload " "input audio signal of the sound card. The level is in dB. Overload "
"should be avoided." ); "should be avoided." );
@ -94,17 +96,19 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent )
// we want the cursor to be at IP address line edit at startup // we want the cursor to be at IP address line edit at startup
LineEditServerAddr->setFocus(); LineEditServerAddr->setFocus();
/* init status label */ // init status label
OnTimerStatus(); OnTimerStatus();
/* init connection button text */ // init connection button text
PushButtonConnect->setText ( CON_BUT_CONNECTTEXT ); PushButtonConnect->setText ( CON_BUT_CONNECTTEXT );
/* init input level meter bars */ // init input level meter bars
ProgressBarInputLevelL->setTotalSteps ( NUM_STEPS_INP_LEV_METER ); ProgressBarInputLevelL->setMinimum ( 0 );
ProgressBarInputLevelL->setProgress ( 0 ); ProgressBarInputLevelL->setMaximum ( NUM_STEPS_INP_LEV_METER );
ProgressBarInputLevelR->setTotalSteps ( NUM_STEPS_INP_LEV_METER ); ProgressBarInputLevelL->setValue ( 0 );
ProgressBarInputLevelR->setProgress ( 0 ); ProgressBarInputLevelR->setMinimum ( 0 );
ProgressBarInputLevelR->setMaximum ( NUM_STEPS_INP_LEV_METER );
ProgressBarInputLevelR->setValue ( 0 );
// init slider controls --- // init slider controls ---
@ -133,28 +137,111 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent )
} }
/* Settings menu ------------------------------------------------------- */
pSettingsMenu = new QPopupMenu ( this );
CHECK_PTR ( pSettingsMenu );
pSettingsMenu->insertItem ( tr ( "&General Settings..." ), this,
// TODO check if code works and then clean up!!!!!!!
#if 0
/* Settings menu ------------------------------------------------------- */
pSettingsMenu = new QMenu ( this );
pSettingsMenu->addMenu ( tr ( "&General Settings..." ), this,
SLOT ( OnOpenGeneralSettings() ) ); SLOT ( OnOpenGeneralSettings() ) );
pSettingsMenu->insertSeparator(); pSettingsMenu->insertSeparator();
pSettingsMenu->insertItem ( tr ( "E&xit" ), this, pSettingsMenu->addMenu ( tr ( "E&xit" ), this,
SLOT ( close() ), CTRL+Key_Q ); SLOT ( close() ), CTRL+Key_Q );
/* Main menu bar -------------------------------------------------------- */ /* Main menu bar -------------------------------------------------------- */
pMenu = new QMenuBar ( this ); pMenu = new QMenuBar ( this );
CHECK_PTR ( pMenu ); pMenu->addMenu ( tr ( "&Settings" ), pSettingsMenu );
pMenu->addMenu ( tr ( "&?"), new CLlconHelpMenu ( this ) );
pMenu->insertItem ( tr ( "&Settings" ), pSettingsMenu );
pMenu->insertItem ( tr ( "&?"), new CLlconHelpMenu ( this ) );
pMenu->setSeparator ( QMenuBar::InWindowsStyle ); pMenu->setSeparator ( QMenuBar::InWindowsStyle );
/* Now tell the layout about the menu */ /* Now tell the layout about the menu */
CLlconClientDlgBaseLayout->setMenuBar ( pMenu ); CLlconClientDlgBaseLayout->setMenuBar ( pMenu );
#endif
/* Settings menu ------------------------------------------------------- */
pSettingsMenu = new QMenu ( "&Settings", this );
pSettingsMenu->addAction ( tr ( "&General Settings..." ), this,
SLOT ( OnOpenGeneralSettings() ) );
pSettingsMenu->addSeparator();
pSettingsMenu->addAction ( tr ( "E&xit" ), this,
SLOT ( close() ), QKeySequence ( Qt::CTRL + Qt::Key_Q ) );
/* 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 -------------------------------------------------------------
@ -199,7 +286,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent )
CLlconClientDlg::~CLlconClientDlg() CLlconClientDlg::~CLlconClientDlg()
{ {
/* if connected, terminate connection */ // if connected, terminate connection
if ( pClient->IsRunning() ) if ( pClient->IsRunning() )
{ {
pClient->Stop(); pClient->Stop();
@ -228,8 +315,8 @@ void CLlconClientDlg::OnConnectDisconBut()
// stop timer for level meter bars and reset them // stop timer for level meter bars and reset them
TimerSigMet.stop(); TimerSigMet.stop();
ProgressBarInputLevelL->setProgress ( 0 ); ProgressBarInputLevelL->setValue ( 0 );
ProgressBarInputLevelR->setProgress ( 0 ); ProgressBarInputLevelR->setValue ( 0 );
// immediately update status bar // immediately update status bar
OnTimerStatus(); OnTimerStatus();
@ -256,7 +343,7 @@ void CLlconClientDlg::OnConnectDisconBut()
{ {
// Restart timer to ensure that the text is visible at // Restart timer to ensure that the text is visible at
// least the time for one complete interval // least the time for one complete interval
TimerStatus.changeInterval ( STATUSBAR_UPDATE_TIME ); TimerStatus.setInterval ( STATUSBAR_UPDATE_TIME );
// show the error in the status bar // show the error in the status bar
TextLabelStatus->setText ( tr ( "invalid address" ) ); TextLabelStatus->setText ( tr ( "invalid address" ) );
@ -271,8 +358,7 @@ void CLlconClientDlg::OnOpenGeneralSettings()
// make sure dialog is upfront and has focus // make sure dialog is upfront and has focus
ClientSettingsDlg.raise(); ClientSettingsDlg.raise();
ClientSettingsDlg.setActiveWindow(); ClientSettingsDlg.activateWindow();
} }
void CLlconClientDlg::OnFaderTagTextChanged ( const QString& strNewName ) void CLlconClientDlg::OnFaderTagTextChanged ( const QString& strNewName )
@ -286,7 +372,7 @@ void CLlconClientDlg::OnFaderTagTextChanged ( const QString& strNewName )
void CLlconClientDlg::OnTimerSigMet() void CLlconClientDlg::OnTimerSigMet()
{ {
/* get current input levels */ // get current input levels
double dCurSigLevelL = pClient->MicLevelL(); double dCurSigLevelL = pClient->MicLevelL();
double dCurSigLevelR = pClient->MicLevelR(); double dCurSigLevelR = pClient->MicLevelR();
@ -312,14 +398,14 @@ void CLlconClientDlg::OnTimerSigMet()
dCurSigLevelR = 0; dCurSigLevelR = 0;
} }
/* show current level */ // show current level
ProgressBarInputLevelL->setProgress ( (int) ceil ( dCurSigLevelL ) ); ProgressBarInputLevelL->setValue ( (int) ceil ( dCurSigLevelL ) );
ProgressBarInputLevelR->setProgress ( (int) ceil ( dCurSigLevelR ) ); ProgressBarInputLevelR->setValue ( (int) ceil ( dCurSigLevelR ) );
} }
void CLlconClientDlg::UpdateDisplay() void CLlconClientDlg::UpdateDisplay()
{ {
/* show connection status in status bar */ // show connection status in status bar
if ( pClient->IsConnected () && pClient->IsRunning () ) if ( pClient->IsConnected () && pClient->IsRunning () )
{ {
TextLabelStatus->setText ( tr ( "connected" ) ); TextLabelStatus->setText ( tr ( "connected" ) );
@ -330,7 +416,7 @@ void CLlconClientDlg::UpdateDisplay()
} }
} }
void CLlconClientDlg::customEvent ( QCustomEvent* Event ) void CLlconClientDlg::customEvent ( QEvent* Event )
{ {
if ( Event->type() == QEvent::User + 11 ) if ( Event->type() == QEvent::User + 11 )
{ {

View file

@ -77,13 +77,23 @@ protected:
QTimer TimerSigMet; QTimer TimerSigMet;
QTimer TimerStatus; QTimer TimerStatus;
virtual void customEvent ( QCustomEvent* Event ); virtual void customEvent ( QEvent* Event );
virtual void closeEvent ( QCloseEvent* Event ); virtual void closeEvent ( QCloseEvent* Event );
void UpdateDisplay(); void UpdateDisplay();
QPopupMenu* pSettingsMenu; QMenu* pSettingsMenu;
QMenuBar* pMenu; QMenuBar* pMenu;
/*
QAction* pActGeneralSettings;
QAction* pActExit;
QAction* pActAbout;
QMenu* pSettingsMenu;
QMenu* pHelpMenu;
QMenuBar* pMainMenuBar;
*/
CClientSettingsDlg ClientSettingsDlg; CClientSettingsDlg ClientSettingsDlg;
public slots: public slots:

View file

@ -80,7 +80,6 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
/* Main menu bar -------------------------------------------------------- */ /* Main menu bar -------------------------------------------------------- */
pMenu = new QMenuBar ( this ); pMenu = new QMenuBar ( this );
CHECK_PTR ( pMenu );
pMenu->insertItem ( tr ( "&?" ), new CLlconHelpMenu ( this ) ); pMenu->insertItem ( tr ( "&?" ), new CLlconHelpMenu ( this ) );
pMenu->setSeparator ( QMenuBar::InWindowsStyle ); pMenu->setSeparator ( QMenuBar::InWindowsStyle );
@ -169,7 +168,7 @@ void CLlconServerDlg::OnTimer()
} }
} }
void CLlconServerDlg::customEvent ( QCustomEvent* Event ) void CLlconServerDlg::customEvent ( QEvent* Event )
{ {
if ( Event->type() == QEvent::User + 11 ) if ( Event->type() == QEvent::User + 11 )
{ {

View file

@ -67,7 +67,7 @@ protected:
QMenuBar* pMenu; QMenuBar* pMenu;
virtual void customEvent ( QCustomEvent* Event ); virtual void customEvent ( QEvent* Event );
void UpdateSliderNetBuf(); void UpdateSliderNetBuf();
public slots: public slots:

View file

@ -193,7 +193,7 @@ bool CServer::GetTimingStdDev ( double& dCurTiStdDev )
} }
} }
void CServer::customEvent ( QCustomEvent* Event ) void CServer::customEvent ( QEvent* Event )
{ {
if ( Event->type() == QEvent::User + 11 ) if ( Event->type() == QEvent::User + 11 )
{ {

View file

@ -66,7 +66,7 @@ protected:
CVector<short> ProcessData ( CVector<CVector<double> >& vecvecdData, CVector<short> ProcessData ( CVector<CVector<double> >& vecvecdData,
CVector<double>& vecdGains ); CVector<double>& vecdGains );
virtual void customEvent ( QCustomEvent* Event ); virtual void customEvent ( QEvent* Event );
QTimer Timer; QTimer Timer;
CVector<short> vecsSendData; CVector<short> vecsSendData;

View file

@ -354,13 +354,14 @@ QString CAboutDlg::GetVersionAndNameStr ( const bool bWithHtml )
/* Help menu ---------------------------------------------------------------- */ /* Help menu ---------------------------------------------------------------- */
CLlconHelpMenu::CLlconHelpMenu ( QWidget* parent ) : QPopupMenu ( parent ) CLlconHelpMenu::CLlconHelpMenu ( QWidget* parent ) : QMenu ( "&?", parent )
{ {
// standard help menu consists of about and what's this help // standard help menu consists of about and what's this help
insertItem ( tr ( "What's &This" ), this, addAction ( tr ( "What's &This" ), this,
SLOT ( OnHelpWhatsThis () ), SHIFT+Key_F1 ); SLOT ( OnHelpWhatsThis() ), QKeySequence ( Qt::SHIFT + Qt::Key_F1 ) );
insertSeparator();
insertItem ( tr ( "&About..." ), this, SLOT ( OnHelpAbout() ) ); addSeparator();
addAction ( tr ( "&About..." ), this, SLOT ( OnHelpAbout() ) );
} }

View file

@ -36,7 +36,7 @@
/* Definitions ****************************************************************/ /* Definitions ****************************************************************/
// switch here between ASIO (Steinberg) or native Windows(TM) sound interface // switch here between ASIO (Steinberg) or native Windows(TM) sound interface
#undef USE_ASIO_SND_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 #define NUM_IN_OUT_CHANNELS 2 /* Stereo recording (but we only