diff --git a/src/analyzerconsole.cpp b/src/analyzerconsole.cpp index d297c089..82229b10 100644 --- a/src/analyzerconsole.cpp +++ b/src/analyzerconsole.cpp @@ -65,13 +65,20 @@ CAnalyzerConsole::CAnalyzerConsole ( CClient* pNCliP, // timers QObject::connect ( &TimerErrRateUpdate, SIGNAL ( timeout() ), this, SLOT ( OnTimerErrRateUpdate() ) ); +} - - // Timers ------------------------------------------------------------------ +void CAnalyzerConsole::showEvent ( QShowEvent* ) +{ // start timer for error rate graph TimerErrRateUpdate.start ( ERR_RATE_GRAPH_UPDATE_TIME_MS ); } +void CAnalyzerConsole::hideEvent ( QHideEvent* ) +{ + // if window is closed, stop timer + TimerErrRateUpdate.stop(); +} + void CAnalyzerConsole::OnTimerErrRateUpdate() { // generate current graph image diff --git a/src/analyzerconsole.h b/src/analyzerconsole.h index 4ca72e65..99b2e470 100644 --- a/src/analyzerconsole.h +++ b/src/analyzerconsole.h @@ -52,6 +52,9 @@ public: protected: + virtual void showEvent ( QShowEvent* ); + virtual void hideEvent ( QHideEvent* ); + void DrawFrame(); void DrawErrorRateTrace(); int CalcYPosInGraph ( const double dAxisMin, diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 6053cae7..38201a83 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -31,6 +31,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, const bool bNewConnectOnStartup, const bool bNewDisalbeLEDs, const bool bNewShowComplRegConnList, + const bool bShowAnalyzerConsole, QWidget* parent, Qt::WindowFlags f ) : QDialog ( parent, f ), @@ -39,7 +40,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, bUnreadChatMessage ( false ), ClientSettingsDlg ( pNCliP, parent, Qt::Window ), ChatDlg ( parent, Qt::Window ), - ConnectDlg ( bNewShowComplRegConnList, parent, Qt::Dialog ) + ConnectDlg ( bNewShowComplRegConnList, parent, Qt::Dialog ), + AnalyzerConsole ( pNCliP, parent, Qt::Window ) { setupUi ( this ); @@ -320,6 +322,13 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, pViewMenu->addAction ( tr ( "&General Settings..." ), this, SLOT ( OnOpenGeneralSettings() ) ); + // optionally show analyzer console entry + if ( bShowAnalyzerConsole ) + { + pViewMenu->addAction ( tr ( "&Analyzer Console..." ), this, + SLOT ( OnOpenAnalyzerConsole() ) ); + } + pViewMenu->addSeparator(); pViewMenu->addAction ( tr ( "E&xit" ), this, @@ -458,15 +467,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, // Timers ------------------------------------------------------------------ // start timer for status bar TimerStatus.start ( LED_BAR_UPDATE_TIME_MS ); - - -// TODO finish work on analyzer console and put this in a hidden View menu entry -/* -// TEST -CAnalyzerConsole* pAnalyzerConsole = new CAnalyzerConsole ( pClient, this ); -pAnalyzerConsole->show(); -*/ - } void CLlconClientDlg::closeEvent ( QCloseEvent* Event ) @@ -475,6 +475,7 @@ void CLlconClientDlg::closeEvent ( QCloseEvent* Event ) ClientSettingsDlg.close(); ConnectDlg.close(); ChatDlg.close(); + AnalyzerConsole.close(); // if connected, terminate connection if ( pClient->IsRunning() ) @@ -680,6 +681,16 @@ void CLlconClientDlg::ShowChatWindow() UpdateDisplay(); } +void CLlconClientDlg::ShowAnalyzerConsole() +{ + // open analyzer console dialog + AnalyzerConsole.show(); + + // make sure dialog is upfront and has focus + AnalyzerConsole.raise(); + AnalyzerConsole.activateWindow(); +} + void CLlconClientDlg::OnSettingsStateChanged ( int value ) { if ( value == Qt::Checked ) diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index f8f27ebd..22c648de 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -73,6 +73,7 @@ public: const bool bNewConnectOnStartup, const bool bNewDisalbeLEDs, const bool bNewShowComplRegConnList, + const bool bShowAnalyzerConsole, QWidget* parent = 0, Qt::WindowFlags f = 0 ); @@ -81,6 +82,7 @@ protected: void SetMyWindowTitle ( const int iNumClients ); void ShowGeneralSettings(); void ShowChatWindow(); + void ShowAnalyzerConsole(); void UpdateAudioFaderSlider(); void UpdateRevSelection(); void ConnectDisconnect ( const bool bDoStart, @@ -106,6 +108,7 @@ protected: CClientSettingsDlg ClientSettingsDlg; CChatDlg ChatDlg; CConnectDlg ConnectDlg; + CAnalyzerConsole AnalyzerConsole; public slots: void OnAboutToQuit() { pSettings->Save(); } @@ -124,6 +127,7 @@ public slots: void OnOpenGeneralSettings() { ShowGeneralSettings(); } void OnOpenChatDialog() { ShowChatWindow(); } + void OnOpenAnalyzerConsole() { ShowAnalyzerConsole(); } void OnInstPicturesMenuTriggered ( QAction* SelAction ); diff --git a/src/main.cpp b/src/main.cpp index f9344082..d6321327 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,6 +59,7 @@ int main ( int argc, char** argv ) bool bConnectOnStartup = false; bool bDisalbeLEDs = false; bool bShowComplRegConnList = false; + bool bShowAnalyzerConsole = false; bool bCentServPingServerInList = false; int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER; @@ -172,6 +173,20 @@ int main ( int argc, char** argv ) } + // Show analyzer console ----------------------------------------------- + // Undocumented debugging command line argument: Show the analyzer + // console to debug network buffer properties. + if ( GetFlagArgument ( argv, + i, + "--showanalyzerconsole", // no short form + "--showanalyzerconsole" ) ) + { + bShowAnalyzerConsole = true; + tsConsole << "- show analyzer console" << endl; + continue; + } + + // Use logging --------------------------------------------------------- if ( GetStringArgument ( tsConsole, argc, @@ -393,6 +408,7 @@ int main ( int argc, char** argv ) bConnectOnStartup, bDisalbeLEDs, bShowComplRegConnList, + bShowAnalyzerConsole, 0, Qt::Window );