1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SALOME RegistryDisplay : GUI for Registry server implementation
23 // File : ToolsGUI_RegWidget.cxx
24 // Author : Pascale NOYRET, EDF
26 # include "ToolsGUI_RegWidget.h"
31 # include <QPushButton>
32 # include <QTreeWidget>
33 # include <QTabWidget>
34 # include <QStatusBar>
36 # include <QTextStream>
41 # include <QCloseEvent>
43 # include <QGridLayout>
47 # include <SALOME_NamingService.hxx>
48 # include <ServiceUnreachable.hxx>
49 # include <Utils_SINGLETON.hxx>
50 # include <Utils_CommException.hxx>
52 # include <utilities.h>
53 # include <OpUtil.hxx>
59 #define MARGIN_SIZE 11
60 #define SPACING_SIZE 6
61 #define MIN_SPIN_WIDTH 100
63 #define BOLD( text ) ( QString( "<b>" ) + QString( text ) + QString( "</b>" ) )
65 static const char* const time_data[] = {
90 static const char* const close_data[] = {
115 static const char* const refresh_data[] = {
140 \brief Create components list.
142 \param orb CORBA ORB reference
143 \return list of registered components
145 static Registry::Components_var MakeRegistry( CORBA::ORB_var& orb )
148 const char *registryName="Registry" ;
150 SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
151 naming.init_orb( orb ) ;
153 // Recuperation de la reference de l'objet
154 CORBA::Object_var object = 0 ;
157 SCRUTE(registryName) ;
158 object = naming.Resolve( registryName ) ;
159 if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;
161 catch( const ServiceUnreachable& ex )
164 exit( EXIT_FAILURE ) ;
166 catch( const CORBA::Exception& )
168 exit( EXIT_FAILURE ) ;
171 // Specialisation de l'objet generique
173 return Registry::Components::_narrow( object ) ;
177 \class ToolsGUI_RegWidget::InfoWindow
178 \brief Information window.
182 class ToolsGUI_RegWidget::InfoWindow : public QMainWindow
185 InfoWindow( QWidget* parent );
187 void setText( const QString& text );
190 void keyPressEvent( QKeyEvent * e );
193 QTextEdit* myTextView;
199 \param parent parent widget
201 ToolsGUI_RegWidget::InfoWindow::InfoWindow( QWidget* parent )
202 : QMainWindow( parent )
204 setAttribute( Qt::WA_DeleteOnClose );
206 myTextView = new QTextEdit( this );
207 myTextView->setReadOnly( true );
208 setCentralWidget( myTextView );
209 setMinimumSize( 450, 250 );
213 \brief Set text to the information window.
215 \param text ionfo text
217 void ToolsGUI_RegWidget::InfoWindow::setText( const QString& text )
219 myTextView->setText( text );
223 \brief Key press event handler. Closeswindow on \c Escape key pressing.
225 \param e key press event
227 void ToolsGUI_RegWidget::InfoWindow::keyPressEvent( QKeyEvent * e )
229 QMainWindow::keyPressEvent( e );
230 if ( e->key() == Qt::Key_Escape )
235 \class ToolsGUI_RegWidget::HelpWindow
240 class ToolsGUI_RegWidget::HelpWindow : public QMainWindow
243 HelpWindow( QWidget* parent );
246 void setText( const QString& text );
249 QTextEdit* myTextView;
255 \param parent parent widget
257 ToolsGUI_RegWidget::HelpWindow::HelpWindow( QWidget* parent )
258 : QMainWindow( parent )
260 setAttribute( Qt::WA_DeleteOnClose );
261 setWindowTitle( tr( "Help" ) );
263 myTextView = new QTextEdit( this );
264 myTextView->setReadOnly( true );
265 QPalette pal = myTextView->palette();
267 pal.setBrush( QPalette::Active, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) );
268 pal.setBrush( QPalette::Active, QPalette::HighlightedText, QBrush( Qt::white ) );
269 pal.setBrush( QPalette::Active, QPalette::Base, QBrush( QColor( 255,255,220 ) ) );
270 pal.setBrush( QPalette::Active, QPalette::Text, QBrush( Qt::black ) );
272 pal.setBrush( QPalette::Inactive, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) );
273 pal.setBrush( QPalette::Inactive, QPalette::HighlightedText, QBrush( Qt::white ) );
274 pal.setBrush( QPalette::Inactive, QPalette::Base, QBrush( QColor( 255,255,220 ) ) );
275 pal.setBrush( QPalette::Inactive, QPalette::Text, QBrush( Qt::black ) );
277 pal.setBrush( QPalette::Disabled, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) );
278 pal.setBrush( QPalette::Disabled, QPalette::HighlightedText, QBrush( Qt::white ) );
279 pal.setBrush( QPalette::Disabled, QPalette::Base, QBrush( QColor( 255,255,220 ) ) );
280 pal.setBrush( QPalette::Disabled, QPalette::Text, QBrush( Qt::black ) );
282 myTextView->setPalette( pal );
284 setCentralWidget( myTextView );
285 setMinimumSize( 450, 250 );
287 QFile f ( "tmp.txt" );
288 if ( f.open( QIODevice::ReadOnly ) ) {
290 while ( !t.atEnd() ) {
291 myTextView->append( t.readLine() );
301 ToolsGUI_RegWidget::HelpWindow::~HelpWindow()
306 \brief Set text to the help window.
308 \param text help text
310 void ToolsGUI_RegWidget::HelpWindow::setText( const QString& text )
312 myTextView->setText( text );
316 \class ToolsGUI_RegWidget::IntervalWindow
317 \brief Dialog box to enter time delay between registry window updates
321 class ToolsGUI_RegWidget::IntervalWindow : public QDialog
324 IntervalWindow( QWidget* parent );
328 QPushButton* Cancel();
331 void setValue( int );
335 QPushButton* myButtonOk;
336 QPushButton* myButtonCancel;
342 \param parent parent widget
344 ToolsGUI_RegWidget::IntervalWindow::IntervalWindow ( QWidget* parent )
348 setAttribute( Qt::WA_DeleteOnClose );
350 setWindowTitle( tr( "Refresh Interval" ) );
351 setSizeGripEnabled( true );
353 QGridLayout* topLayout = new QGridLayout( this );
354 topLayout->setSpacing( SPACING_SIZE );
355 topLayout->setMargin( MARGIN_SIZE );
357 QGroupBox* intervalGrp = new QGroupBox( this );
358 intervalGrp->setObjectName( "intervalGrp" );
359 QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp );
360 intervalGrpLayout->setAlignment( Qt::AlignTop );
361 intervalGrpLayout->setSpacing( SPACING_SIZE );
362 intervalGrpLayout->setMargin( MARGIN_SIZE );
364 QHBoxLayout* aBtnLayout = new QHBoxLayout;
365 aBtnLayout->setSpacing( SPACING_SIZE );
366 aBtnLayout->setMargin( 0 );
368 myButtonOk = new QPushButton( this );
369 myButtonOk->setObjectName( "buttonOk" );
370 myButtonOk->setText( tr( "BUT_OK" ) );
371 myButtonOk->setAutoDefault( TRUE );
372 myButtonOk->setDefault( TRUE );
374 myButtonCancel = new QPushButton( this );
375 myButtonCancel->setObjectName( "buttonCancel" );
376 myButtonCancel->setText( tr( "BUT_CANCEL" ) );
377 myButtonCancel->setAutoDefault( TRUE );
379 QLabel* TextLabel = new QLabel( intervalGrp );
380 TextLabel->setObjectName( "TextLabel" );
381 TextLabel->setText( tr( "Please, enter a number of seconds:" ) );
383 mySpinBox = new QSpinBox( intervalGrp );
384 mySpinBox->setMinimum( 1 );
385 mySpinBox->setMaximum( 999999999 );
386 mySpinBox->setSingleStep( 1 );
387 mySpinBox->setObjectName( "SpinBox" );
388 mySpinBox->setValue( 100 );
389 mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
390 mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
392 intervalGrpLayout->addWidget(TextLabel, 0, 0);
393 intervalGrpLayout->addWidget(mySpinBox, 0, 1);
395 aBtnLayout->addWidget( myButtonOk );
396 aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
397 aBtnLayout->addWidget( myButtonCancel );
399 topLayout->addWidget( intervalGrp, 0, 0 );
400 topLayout->addLayout( aBtnLayout, 1, 0 );
407 ToolsGUI_RegWidget::IntervalWindow::~IntervalWindow()
412 \brief Set time interval value
414 \param size interval value
416 void ToolsGUI_RegWidget::IntervalWindow::setValue( const int size )
418 mySpinBox->setValue(size);
422 \brief Get time interval value
424 \return interval value
426 int ToolsGUI_RegWidget::IntervalWindow::getValue()
428 return mySpinBox->value();
432 \brief Get \c OK button
434 \return a pointer to \c OK button
436 QPushButton* ToolsGUI_RegWidget::IntervalWindow::Ok()
442 \brief Get \c Cancel button
444 \return a pointer to \c Cancel button
446 QPushButton* ToolsGUI_RegWidget::IntervalWindow::Cancel()
448 return myButtonCancel;
452 \class ToolsGUI_RegWidget
453 \brief SALOME Registry tool window.
456 //! The only instance of Registry window
457 ToolsGUI_RegWidget* ToolsGUI_RegWidget::myRegWidgetPtr = 0;
460 \brief Create/get the only instance of the Registry window.
461 \param orb CORBA ORB reference
462 \param parent parent widget
464 ToolsGUI_RegWidget* ToolsGUI_RegWidget::GetRegWidget( CORBA::ORB_var& orb,
467 if ( !myRegWidgetPtr )
468 myRegWidgetPtr = new ToolsGUI_RegWidget( orb, parent );
469 return myRegWidgetPtr;
473 \brief This virtual function is reimplenented to disable popup menu on dock areas
474 (instead of QMainWindow::setDockMenuEnabled( false ) method used in Qt3).
475 \return always 0 to disable menu
477 QMenu* ToolsGUI_RegWidget::createPopupMenu()
485 \param orb CORBA ORB reference
486 \param parent parent widget
488 ToolsGUI_RegWidget::ToolsGUI_RegWidget( CORBA::ORB_var& orb, QWidget* parent )
489 : QMainWindow( parent, Qt::Window ),
490 _VarComponents( MakeRegistry(orb) ),
499 myIntervalWindow( 0 )
501 setAttribute( Qt::WA_DeleteOnClose );
504 setWindowIcon( parent->windowIcon() );
506 // pixmap for buttons
507 QPixmap image_refresh ( ( const char** ) refresh_data );
508 QPixmap image_interval( ( const char** ) time_data );
509 QPixmap image_close ( ( const char** ) close_data );
511 // Buttons definition
512 QToolBar* topbar = new QToolBar( tr("Toolbar"), this );
513 topbar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
514 addToolBar( Qt::TopToolBarArea, topbar );
516 _refresh = topbar->addAction(image_refresh, tr( "Refresh" ), this, SLOT( slotListeSelect() ));
517 _refresh->setToolTip( "" );
518 _refresh->setStatusTip( tr("Immediately updates list of components") );
520 /* PAL5540 - this button is needless
521 QPushButton* help = new QPushButton( tr( "Help" ), topbar );
522 connect( help, SIGNAL( clicked() ), this, SLOT( slotHelp() ) );
523 QToolTip::add( help, "", toolTipGroup(), tr("Opens Help window") );
526 _interval = topbar->addAction(image_interval, tr( "Interval" ), this, SLOT( slotSelectRefresh() ));
527 _interval->setToolTip( "" );
528 _interval->setStatusTip( tr("Changes refresh interval") );
530 topbar->addSeparator();
532 _close = topbar->addAction( image_close, tr("Close"), this, SLOT( close() ));
533 _close->setToolTip( "" );
534 _close->setStatusTip( tr("Closes Registry window") );
536 // Display area and associated slots definition
537 _tabWidget = new QTabWidget( this );
538 _clients = new QTreeWidget( _tabWidget );
540 _history = new QTreeWidget( _tabWidget );
543 _tabWidget->addTab( _clients, tr( "Running" ) );
544 _tabWidget->addTab( _history, tr( "History" ) );
545 connect( _tabWidget, SIGNAL( currentChanged( QWidget* )), this, SLOT( slotListeSelect() ) );
546 connect( _clients, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( slotClientChanged( QTreeWidgetItem* , int ) ) );
547 connect( _history, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( slotHistoryChanged( QTreeWidgetItem* , int ) ) );
548 setCentralWidget( _tabWidget );
550 // Timer definition (used to automaticaly refresh the display area)
551 _counter = new QTimer( this );
552 connect( _counter, SIGNAL( timeout() ), this, SLOT( slotListeSelect() ) );
553 myRefreshInterval = 10;
554 _counter->start( myRefreshInterval * 1000 );
558 PIXELS largeur = 800 ;
559 PIXELS hauteur = 350 ;
560 setGeometry( xpos, ypos, largeur, hauteur ) ;
561 setWindowTitle( tr( "Registry" ) ) ;
562 statusBar()->showMessage(" ");
570 ToolsGUI_RegWidget::~ToolsGUI_RegWidget()
578 \param object event receiver
579 \param event event being processed
580 \return \c true if event processing should be stopped
582 bool ToolsGUI_RegWidget::eventFilter( QObject* object, QEvent* event )
585 if ( object == myHelpWindow && event->type() == QEvent::Close ) {
588 else if ( object == myInfoWindow && event->type() == QEvent::Close ) {
591 else if ( object == myIntervalWindow && event->type() == QEvent::Close ) {
592 myIntervalWindow = 0;
594 else if ( object == _clients && event->type() == QEvent::KeyPress ) {
595 QKeyEvent* ke = (QKeyEvent*)event;
596 if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) {
597 slotClientChanged( _clients->currentItem(), 0 );
600 else if ( object == _history && event->type() == QEvent::KeyPress ) {
601 QKeyEvent* ke = (QKeyEvent*)event;
602 if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) {
603 slotHistoryChanged( _history->currentItem(), 0 );
607 return QMainWindow::eventFilter( object, event );
611 \brief Search item in the list.
612 \param name component name
614 \param machine machine name
615 \param listclient list of registry data
616 \return item index or -1 if it is not found.
618 int ToolsGUI_RegWidget::numitem( const QString& name,
620 const QString& machine,
621 const Registry::AllInfos* listclient )
623 for (CORBA::ULong i=0; i<listclient->length(); i++) {
624 const Registry::Infos & c_info=(*listclient)[i];
625 ASSERT( c_info.name!=NULL);
627 b.setNum(int(c_info.pid));
628 if ( (name.compare(QString(c_info.name)) == 0) &&
629 (machine.compare(QString(c_info.machine)) == 0) &&
630 (pid.compare(b) == 0) ) {
638 \brief Get description text, containing information about client.
639 \param c_info client info data
640 \return formatted client description
642 QString ToolsGUI_RegWidget::setlongText( const Registry::Infos& c_info )
644 ASSERT( c_info.name != NULL );
645 QString a = QString( "<hr><h2>" ) + tr( "Code" ) + QString( " : " );
646 a.append( QString( c_info.name ) );
647 a.append( "</h1><hr><br>" );
648 a.append( "<code>" ); // ASV: 28.07.06 : added <code> tags to make the text font be
649 // fixed width (looks much better on Windows)
650 a.append( tr( "Process Id" ) + QString( " : " ) );
651 a.append( BOLD( QString::number( int( c_info.pid ) ) ) );
652 a.append( QString( " " ) + tr( "on machine" ) + QString( " " ) );
653 a.append( BOLD( c_info.machine ) );
654 a.append( QString( " " ) + tr( "ip address" ) + QString( " : " ) );
655 a.append( BOLD( c_info.adip ) );
658 a.append( tr( "launched by user" ) + QString( " " ) );
659 a.append( BOLD( c_info.pwname ) );
660 a.append( QString( " ( " ) + tr( "pid" ) + QString( " : " ) );
661 a.append( BOLD( QString::number( int( c_info.uid ) ) ) );
662 a.append( QString( " )<br> " ) + tr( "in directory" ) + QString( " " ));
663 a.append( BOLD( c_info.cdir ) );
666 a.append( QString( "<br>" ) + tr( "begins" ) + QString( " " ) );
667 aTime = time_t(c_info.tc_start);
668 char * t1 = (char * )duplicate(ctime(&aTime));
669 t1 [strlen(t1) -1 ] = ' ';
670 a.append( BOLD( t1 ) );
674 if (c_info.tc_hello != 0 ) {
675 aTime = time_t(c_info.tc_hello);
676 char * t2 = (char * )duplicate(ctime(&aTime));
677 t2 [strlen(t2) -1 ] = ' ';
678 a.append( tr( "last signal" ) + QString(" : ") );
679 a.append( BOLD( t2 ) );
683 if ((c_info.tc_end - c_info.difftime) != 0) {
684 aTime = time_t(c_info.tc_end);
685 char * t3 = (char * )duplicate(ctime(&aTime));
686 t3 [strlen(t3) -1 ] = ' ';
687 a.append( tr( "ends" ) + QString( " " ) );
688 a.append( BOLD( t3 ) );
693 a.append( tr( "still running" ) + QString( "<br>" ) );
696 SCRUTE(c_info.difftime);
697 if (c_info.difftime!= 0) {
698 a.append( QString( "(" ) + tr( "Time on" ) + QString( " " ) );
699 a.append( BOLD( c_info.machine ) );
700 a.append( QString( " " ) + tr( "differs from server's time. The difference is" ) + QString( " " ));
701 a.append( BOLD( QString::number( int( c_info.difftime ) ) ) );
702 a.append( QString( " " ) + tr( "seconds" ) + QString( ")<br>" ) );
704 a.append( "</code>" ); // ASV: 28.07.06 : added <code> tags to make the text font be
705 // fixed width (looks much better on Windows)
711 \brief Close event handler.
714 void ToolsGUI_RegWidget::closeEvent( QCloseEvent* e )
717 myInfoWindow->close();
719 myHelpWindow->close();
720 if (myIntervalWindow)
721 myIntervalWindow->close();
726 \brief Setup clients list.
728 void ToolsGUI_RegWidget::SetListe()
730 _clients->installEventFilter( this );
731 _clients->setColumnCount(6);
732 _clients->setAllColumnsShowFocus( true );
734 aLabels << tr("Component") << tr("PID") << tr("User Name") << tr("Machine") << tr("begins") << tr("hello");
735 _clients->setHeaderLabels( aLabels );
736 //_clients->setColumnAlignment( 1, Qt::AlignRight );
740 \brief Setup history list.
742 void ToolsGUI_RegWidget::SetListeHistory()
744 _history->installEventFilter( this );
745 _history->setColumnCount(6);
746 _history->setAllColumnsShowFocus( true );
748 aLabels << tr("Component") << tr("PID") << tr("User Name") << tr("Machine") << tr("begins") << tr("ends");
749 _history->setHeaderLabels( aLabels );
750 //_history->setColumnAlignment( 1, Qt::AlignRight );
754 \brief Update history list
756 void ToolsGUI_RegWidget::InfoHistory()
762 _serverhistory = _VarComponents->history();
763 for (CORBA::ULong i=0; i<_serverhistory->length(); i++) {
764 const Registry::Infos & c_info=(*_serverhistory)[i];
765 ASSERT( c_info.name!=NULL);
767 a.setNum(int(c_info.pid));
768 aTime = time_t(c_info.tc_start);
769 char * t1 = (char * )duplicate(ctime(&aTime));
770 t1 [strlen(t1) -1 ] = ' ';
771 aTime = time_t(c_info.tc_end);
772 char * t2 = (char * )duplicate(ctime(&aTime));
773 t2 [strlen(t2) -1 ] = ' ';
775 anItem << QString(c_info.name) << a << QString(c_info.pwname) << QString(c_info.machine) << QString(t1) << QString(t2);
776 QTreeWidgetItem * item = new QTreeWidgetItem(_history, anItem);
784 _interval->setDisabled( TRUE ) ;
785 _refresh->setDisabled( TRUE ) ;
787 MESSAGE("Sorry, No more Registry Server") ;
788 statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ;
793 \brief Update clients list
795 void ToolsGUI_RegWidget::InfoReg()
800 _serverclients = _VarComponents->getall();
801 for (CORBA::ULong i=0; i<_serverclients->length(); i++) {
802 const Registry::Infos & c_info=(*_serverclients)[i];
803 ASSERT( c_info.name!=NULL);
805 a.setNum(int(c_info.pid));
806 aTime = time_t(c_info.tc_start);
807 char * t1 = (char * )duplicate(ctime(&aTime));
808 t1 [strlen(t1) -1 ] = ' ';
809 aTime = time_t(c_info.tc_hello);
810 char * t2 = (char * )duplicate(ctime(&aTime));
811 t2 [strlen(t2) -1 ] = ' ';
813 anItem << QString(c_info.name) << a << QString(c_info.pwname) << QString(c_info.machine) << QString(t1) << QString(t2);
814 QTreeWidgetItem * item = new QTreeWidgetItem(_clients, anItem);
822 _interval->setDisabled( TRUE ) ;
823 _refresh->setDisabled( TRUE ) ;
825 MESSAGE("Sorry, No more Registry Server") ;
826 statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ;
831 \brief Called when \c Refresh button is clicked
833 void ToolsGUI_RegWidget::slotListeSelect()
836 ASSERT(_tabWidget->currentWidget() != NULL);
837 if (_tabWidget->currentWidget () == _clients) InfoReg();
838 else if (_tabWidget->currentWidget () == _history) InfoHistory();
841 MESSAGE("Sorry, No more Registry Server") ;
842 statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ;
847 \brief Called when \c Interval button is clicked (open dialog box to
848 change refresh interval).
850 void ToolsGUI_RegWidget::slotSelectRefresh()
852 myIntervalWindow = new ToolsGUI_RegWidget::IntervalWindow(this);
853 myIntervalWindow->installEventFilter( this );
854 myIntervalWindow->setValue(myRefreshInterval);
855 myIntervalWindow->show();
856 connect( myIntervalWindow->Cancel(), SIGNAL( clicked() ), myIntervalWindow, SLOT( close() ) );
857 connect( myIntervalWindow->Ok(), SIGNAL( clicked() ), this, SLOT( slotIntervalOk() ) );
861 \brief Called when IntervalWindow's \c OK button is clicked
863 void ToolsGUI_RegWidget::slotIntervalOk()
865 myRefreshInterval = myIntervalWindow->getValue();
866 _counter->start( myRefreshInterval * 1000 );
867 SCRUTE(myRefreshInterval);
868 myIntervalWindow->close();
871 \brief Called when \c Help button is clicked
873 void ToolsGUI_RegWidget::slotHelp()
875 if ( !myHelpWindow ) {
876 myHelpWindow = new ToolsGUI_RegWidget::HelpWindow( this );
877 myHelpWindow->installEventFilter( this );
879 myHelpWindow->show();
880 myHelpWindow->raise();
881 myHelpWindow->activateWindow();
885 \brief Called when user clicks on item in \c Running list
886 \param item item clicked by the user
888 void ToolsGUI_RegWidget::slotClientChanged( QTreeWidgetItem* item, int col )
890 if ( !item || col < 0 )
893 blockSignals( true ); // for sure that item will not be deleted when refreshing
895 int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverclients);
897 SCRUTE(item->text(1).toLatin1().constData()) ;
899 ASSERT(numeroItem>=0) ;
900 ASSERT((size_t)numeroItem<_serverclients->length()) ;
901 const Registry::Infos & c_info=(*_serverclients)[numeroItem];
902 ASSERT( c_info.name!=NULL);
904 if ( !myInfoWindow ) {
905 myInfoWindow = new ToolsGUI_RegWidget::InfoWindow( this );
906 myInfoWindow->installEventFilter( this );
908 QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name );
909 myInfoWindow->setWindowTitle(a);
910 myInfoWindow->setText( ToolsGUI_RegWidget::setlongText( c_info) );
911 myInfoWindow->show();
912 myInfoWindow->raise();
913 myInfoWindow->activateWindow();
915 blockSignals( false ); // enabling signals again
919 \brief Called when user clicks on item in \c History list
920 \param item item clicked by the user
922 void ToolsGUI_RegWidget::slotHistoryChanged( QTreeWidgetItem* item, int col )
924 if ( !item || col < 0 )
927 blockSignals( true ); // for sure that item will not be deleted when refreshing
929 int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverhistory);
932 SCRUTE(item->text(1).toLatin1().constData()) ;
933 ASSERT(numeroItem>=0) ;
934 ASSERT((size_t)numeroItem<_serverhistory->length()) ;
935 const Registry::Infos & c_info=(*_serverhistory)[numeroItem];
936 ASSERT( c_info.name!=NULL);
938 if ( !myInfoWindow ) {
939 myInfoWindow = new ToolsGUI_RegWidget::InfoWindow( this );
940 myInfoWindow->installEventFilter( this );
942 QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name );
943 myInfoWindow->setWindowTitle(a);
944 myInfoWindow->setText( ToolsGUI_RegWidget::setlongText( c_info ) );
945 myInfoWindow->show();
946 myInfoWindow->raise();
947 myInfoWindow->activateWindow();
949 blockSignals( false ); // enabling signals again