From: mkr Date: Thu, 7 Jun 2007 09:10:31 +0000 (+0000) Subject: Porting to Qt4. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=61b67c3ecc407d4e7ba24e6fe1df002711be8795;p=modules%2Fgui.git Porting to Qt4. --- diff --git a/src/Makefile.am b/src/Makefile.am index 91611e009..abd3ee61a 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -98,5 +98,5 @@ if GUI_ENABLE_CORBA # SUBDIRS += RegistryDisplay TOOLSGUI \ # Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT # VSR: already migrated to Qt4 packages - SUBDIRS += + SUBDIRS += RegistryDisplay endif diff --git a/src/RegistryDisplay/HelpWindow.cxx b/src/RegistryDisplay/HelpWindow.cxx index a94773105..b407afea2 100755 --- a/src/RegistryDisplay/HelpWindow.cxx +++ b/src/RegistryDisplay/HelpWindow.cxx @@ -29,10 +29,10 @@ # include "HelpWindow.hxx" # include "utilities.h" -# include -# include -# include -# include +# include +# include +# include +# include using namespace std; @@ -40,42 +40,45 @@ using namespace std; Constructor */ HelpWindow::HelpWindow(QWidget* parent, const char* name ) - : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose ) + : QMainWindow( parent, Qt::Window ) { BEGIN_OF("Constructeur HelpWindow"); - - setCaption( tr( "Help" ) ); - myTextView = new QTextView( this, "myTextView" ); + setObjectName( name ); + setAttribute( Qt::WA_DeleteOnClose ); + + setWindowTitle( tr( "Help" ) ); + + myTextView = new QTextEdit( this ); + myTextView->setObjectName( "myTextView" ); + myTextView->setReadOnly( true ); QPalette pal = myTextView->palette(); - QColorGroup cg = pal.active(); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, Qt::white ); - cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) ); - cg.setColor( QColorGroup::Text, Qt::black ); - pal.setActive ( cg ); - cg = pal.inactive(); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, Qt::white ); - cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) ); - cg.setColor( QColorGroup::Text, Qt::black ); - pal.setInactive( cg ); - cg = pal.disabled(); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, Qt::white ); - cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) ); - cg.setColor( QColorGroup::Text, Qt::black ); - pal.setDisabled( cg ); + + pal.setBrush( QPalette::Active, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) ); + pal.setBrush( QPalette::Active, QPalette::HighlightedText, QBrush( Qt::white ) ); + pal.setBrush( QPalette::Active, QPalette::Base, QBrush( QColor( 255,255,220 ) ) ); + pal.setBrush( QPalette::Active, QPalette::Text, QBrush( Qt::black ) ); + + pal.setBrush( QPalette::Inactive, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) ); + pal.setBrush( QPalette::Inactive, QPalette::HighlightedText, QBrush( Qt::white ) ); + pal.setBrush( QPalette::Inactive, QPalette::Base, QBrush( QColor( 255,255,220 ) ) ); + pal.setBrush( QPalette::Inactive, QPalette::Text, QBrush( Qt::black ) ); + + pal.setBrush( QPalette::Disabled, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) ); + pal.setBrush( QPalette::Disabled, QPalette::HighlightedText, QBrush( Qt::white ) ); + pal.setBrush( QPalette::Disabled, QPalette::Base, QBrush( QColor( 255,255,220 ) ) ); + pal.setBrush( QPalette::Disabled, QPalette::Text, QBrush( Qt::black ) ); + myTextView->setPalette( pal ); setCentralWidget( myTextView ); setMinimumSize( 450, 250 ); QFile f ( "tmp.txt" ); - if ( f.open( IO_ReadOnly ) ) + if ( f.open( QIODevice::ReadOnly ) ) { QTextStream t( &f ); - while ( !t.eof() ) + while ( !t.atEnd() ) { myTextView->append(t.readLine()); } diff --git a/src/RegistryDisplay/HelpWindow.hxx b/src/RegistryDisplay/HelpWindow.hxx index 31f6405de..b63e90cea 100755 --- a/src/RegistryDisplay/HelpWindow.hxx +++ b/src/RegistryDisplay/HelpWindow.hxx @@ -29,10 +29,9 @@ #ifndef __HELPWINDOW_H__ #define __HELPWINDOW_H__ -#include -#include +#include -class QTextView; +class QTextEdit; class HelpWindow : public QMainWindow { @@ -43,10 +42,10 @@ public: ~HelpWindow(); void setText( const QString& text ); - QTextView* textView() const { return myTextView; } + QTextEdit* textView() const { return myTextView; } private: - QTextView* myTextView; + QTextEdit* myTextView; }; #endif diff --git a/src/RegistryDisplay/IntervalWindow.cxx b/src/RegistryDisplay/IntervalWindow.cxx index 780a876b4..83e5a6dc0 100755 --- a/src/RegistryDisplay/IntervalWindow.cxx +++ b/src/RegistryDisplay/IntervalWindow.cxx @@ -24,10 +24,12 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include # include "utilities.h" #define MARGIN_SIZE 11 @@ -38,21 +40,24 @@ Constructor */ IntervalWindow::IntervalWindow ( QWidget* parent ) - : QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) + : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) { BEGIN_OF("IntervalWindow constructor") - setCaption( tr( "Refresh Interval" ) ); + + setObjectName( "IntervalWindow" ); + setModal( true ); + setAttribute( Qt::WA_DeleteOnClose ); + + setWindowTitle( tr( "Refresh Interval" ) ); setSizeGripEnabled( true ); QGridLayout* topLayout = new QGridLayout( this ); topLayout->setSpacing( SPACING_SIZE ); topLayout->setMargin( MARGIN_SIZE ); - QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" ); - intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical - intervalGrp->layout()->setSpacing( 0 ); - intervalGrp->layout()->setMargin( 0 ); - QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() ); + QGroupBox* intervalGrp = new QGroupBox( this ); + intervalGrp->setObjectName( "intervalGrp" ); + QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp ); intervalGrpLayout->setAlignment( Qt::AlignTop ); intervalGrpLayout->setSpacing( SPACING_SIZE ); intervalGrpLayout->setMargin( MARGIN_SIZE ); @@ -61,19 +66,26 @@ IntervalWindow::IntervalWindow ( QWidget* parent ) aBtnLayout->setSpacing( SPACING_SIZE ); aBtnLayout->setMargin( 0 ); - myButtonOk = new QPushButton( this, "buttonOk" ); + myButtonOk = new QPushButton( this ); + myButtonOk->setObjectName( "buttonOk" ); myButtonOk->setText( tr( "BUT_OK" ) ); myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE ); - myButtonCancel = new QPushButton( this, "buttonCancel" ); + myButtonCancel = new QPushButton( this ); + myButtonCancel->setObjectName( "buttonCancel" ); myButtonCancel->setText( tr( "BUT_CANCEL" ) ); myButtonCancel->setAutoDefault( TRUE ); - QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" ); + QLabel* TextLabel = new QLabel( intervalGrp ); + TextLabel->setObjectName( "TextLabel" ); TextLabel->setText( tr( "Please, enter a number of seconds:" ) ); - mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" ); + mySpinBox = new QSpinBox( intervalGrp ); + mySpinBox->setMinimum( 1 ); + mySpinBox->setMaximum( 999999999 ); + mySpinBox->setSingleStep( 1 ); + mySpinBox->setObjectName( "SpinBox" ); mySpinBox->setValue( 100 ); mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH); diff --git a/src/RegistryDisplay/IntervalWindow.hxx b/src/RegistryDisplay/IntervalWindow.hxx index 7e746ed51..f1d78e803 100755 --- a/src/RegistryDisplay/IntervalWindow.hxx +++ b/src/RegistryDisplay/IntervalWindow.hxx @@ -25,10 +25,11 @@ #ifndef IntervalWindow_HeaderFile #define IntervalWindow_HeaderFile -# include -# include -# include -# include +# include + +class QWidget; +class QPushButton; +class QSpinBox; #ifndef WIN32 using namespace std; diff --git a/src/RegistryDisplay/RegWidget.cxx b/src/RegistryDisplay/RegWidget.cxx index bd6da2cda..51cde7087 100755 --- a/src/RegistryDisplay/RegWidget.cxx +++ b/src/RegistryDisplay/RegWidget.cxx @@ -26,16 +26,20 @@ // Module : SALOME // $Header$ -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include +# include +# include +# include +# include +# include +# include +# include +# include +//# include +# include +# include +# include +# include +# include # include "SALOME_NamingService.hxx" # include "ServiceUnreachable.hxx" @@ -178,16 +182,29 @@ RegWidget* RegWidget::GetRegWidget( CORBA::ORB_var &orb , QWidget *parent, const return myRegWidgetPtr; } +/*! + Reimplement this virtual function to disable popup menu on dock areas + (instead of QMainWindow::setDockMenuEnabled( false ) method calling in Qt3) +*/ +QMenu* createPopupMenu() +{ + QMenu* aPopup = 0; + return aPopup; +} + /*! Constructor */ RegWidget::RegWidget(CORBA::ORB_var &orb, QWidget *parent, const char *name ) - : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose ), + : QMainWindow( parent, Qt::Window ), _VarComponents( MakeRegistry(orb) ), _clients(0), _history(0), _parent( parent ), _tabWidget(0), _refresh(0), _interval(0), myInfoWindow(0), myHelpWindow(0), myIntervalWindow(0) { + setObjectName( name ); + setAttribute( Qt::WA_DeleteOnClose ); + QString aFile = findFile("default.png"); /* char* dir = getenv( "CSF_ResourcesDefaults" ); QString path( "" ); @@ -197,7 +214,7 @@ RegWidget::RegWidget(CORBA::ORB_var &orb, QWidget *parent, const char *name ) }*/ QPixmap pm ( aFile ); if ( !pm.isNull() ) - setIcon( pm ); + setWindowIcon( pm ); // pixmap for buttons QPixmap image_refresh ( ( const char** ) refresh_data ); @@ -206,46 +223,41 @@ RegWidget::RegWidget(CORBA::ORB_var &orb, QWidget *parent, const char *name ) // Buttons definition QToolBar* topbar = new QToolBar( tr("Toolbar"), this ); - setDockEnabled( topbar, DockTornOff, false ); - setDockMenuEnabled( false ); - - _refresh = new QPushButton( tr( "Refresh" ), topbar ); - _refresh->setIconSet( image_refresh ); - _refresh->setFocusPolicy( NoFocus ); - connect( _refresh, SIGNAL( clicked() ), this, SLOT( slotListeSelect() ) ); - QToolTip::add( _refresh, "", toolTipGroup(), tr("Immediately updates list of components") ); - + topbar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); + addToolBar( Qt::TopToolBarArea, topbar ); + + _refresh = topbar->addAction(image_refresh, tr( "Refresh" ), this, SLOT( slotListeSelect() )); + _refresh->setToolTip( "" ); + _refresh->setStatusTip( tr("Immediately updates list of components") ); + /* PAL5540 - this button is needless QPushButton* help = new QPushButton( tr( "Help" ), topbar ); connect( help, SIGNAL( clicked() ), this, SLOT( slotHelp() ) ); QToolTip::add( help, "", toolTipGroup(), tr("Opens Help window") ); */ - _interval = new QPushButton( tr( "Interval" ), topbar ); - _interval->setIconSet( image_interval ); - _interval->setFocusPolicy( NoFocus ); - connect( _interval, SIGNAL( clicked() ), this, SLOT( slotSelectRefresh() ) ); - QToolTip::add( _interval, "", toolTipGroup(), tr("Changes refresh interval") ); + _interval = topbar->addAction(image_interval, tr( "Interval" ), this, SLOT( slotSelectRefresh() )); + _interval->setToolTip( "" ); + _interval->setStatusTip( tr("Changes refresh interval") ); topbar->addSeparator(); - _close = new QPushButton( tr("Close"), topbar ); - _close->setIconSet( image_close ); - _close->setFocusPolicy( NoFocus ); - connect( _close, SIGNAL( clicked() ), this, SLOT( close() ) ); - QToolTip::add( _close, "", toolTipGroup(), tr("Closes Registry window") ); + + _close = topbar->addAction( image_close, tr("Close"), this, SLOT( close() )); + _close->setToolTip( "" ); + _close->setStatusTip( tr("Closes Registry window") ); // Display area and associated slots definition _tabWidget = new QTabWidget( this ); - _clients = new QListView( _tabWidget ); + _clients = new QTreeWidget( _tabWidget ); SetListe(); - _history = new QListView( _tabWidget ); + _history = new QTreeWidget( _tabWidget ); SetListeHistory(); _tabWidget->addTab( _clients, tr( "Running" ) ); _tabWidget->addTab( _history, tr( "History" ) ); connect( _tabWidget, SIGNAL( currentChanged( QWidget* )), this, SLOT( slotListeSelect() ) ); - connect( _clients, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( slotClientChanged( QListViewItem* ) ) ); - connect( _history, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( slotHistoryChanged( QListViewItem* ) ) ); + connect( _clients, SIGNAL( clicked( QTreeWidgetItem* ) ), this, SLOT( slotClientChanged( QTreeWidgetItem* ) ) ); + connect( _history, SIGNAL( clicked( QTreeWidgetItem* ) ), this, SLOT( slotHistoryChanged( QTreeWidgetItem* ) ) ); setCentralWidget( _tabWidget ); // Timer definition (used to automaticaly refresh the display area) @@ -259,8 +271,8 @@ RegWidget::RegWidget(CORBA::ORB_var &orb, QWidget *parent, const char *name ) PIXELS largeur = 800 ; PIXELS hauteur = 350 ; setGeometry( xpos, ypos, largeur, hauteur ) ; - setCaption( name ) ; - statusBar()->message(" "); + setWindowTitle( name ) ; + statusBar()->showMessage(" "); } /*! @@ -290,13 +302,13 @@ bool RegWidget::eventFilter( QObject* object, QEvent* event ) } else if ( object == _clients && event->type() == QEvent::KeyPress ) { QKeyEvent* ke = (QKeyEvent*)event; - if ( ke->key() == Key_Enter || ke->key() == Key_Return ) { + if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) { slotClientChanged( _clients->currentItem() ); } } else if ( object == _history && event->type() == QEvent::KeyPress ) { QKeyEvent* ke = (QKeyEvent*)event; - if ( ke->key() == Key_Enter || ke->key() == Key_Return ) { + if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) { slotHistoryChanged( _history->currentItem() ); } } @@ -424,14 +436,12 @@ void RegWidget::SetListe() { BEGIN_OF("SetListe"); _clients->installEventFilter( this ); + _clients->setColumnCount(6); _clients->setAllColumnsShowFocus( true ); - _clients->addColumn( tr( "Component" ), -1); - _clients->addColumn( tr( "PID" ), -1 ); - _clients->addColumn( tr( "User Name" ), -1 ); - _clients->addColumn( tr( "Machine" ), -1 ); - _clients->addColumn( tr( "begins" ), -1 ); - _clients->addColumn( tr( "hello" ) , -1 ); - _clients->setColumnAlignment( 1, Qt::AlignRight ); + QStringList aLabels; + aLabels << tr("Component") << tr("PID") << tr("User Name") << tr("Machine") << tr("begins") << tr("hello"); + _clients->setHeaderLabels( aLabels ); + //_clients->setColumnAlignment( 1, Qt::AlignRight ); END_OF("SetListe"); } @@ -440,17 +450,15 @@ void RegWidget::SetListe() */ void RegWidget::SetListeHistory() { - BEGIN_OF("SetListeHistory") + BEGIN_OF("SetListeHistory"); _history->installEventFilter( this ); + _history->setColumnCount(6); _history->setAllColumnsShowFocus( true ); - _history->addColumn( tr( "Component" ), -1); - _history->addColumn( tr( "PID" ), -1 ); - _history->addColumn( tr( "User Name" ), -1 ); - _history->addColumn( tr( "Machine" ), -1 ); - _history->addColumn( tr( "begins" ), -1 ); - _history->addColumn( tr( "ends" ), -1 ); - _history->setColumnAlignment( 1, Qt::AlignRight ); - END_OF("SetListeHistory") + QStringList aLabels; + aLabels << tr("Component") << tr("PID") << tr("User Name") << tr("Machine") << tr("begins") << tr("ends"); + _history->setHeaderLabels( aLabels ); + //_history->setColumnAlignment( 1, Qt::AlignRight ); + END_OF("SetListeHistory"); } /*! @@ -477,9 +485,9 @@ void RegWidget::InfoHistory() aTime = time_t(c_info.tc_end); char * t2 = (char * )duplicate(ctime(&aTime)); t2 [strlen(t2) -1 ] = ' '; - QListViewItem * item = new QListViewItem(_history, QString(c_info.name),\ - a, QString(c_info.pwname), QString(c_info.machine), \ - QString(t1), QString(t2)); + QStringList anItem; + anItem << QString(c_info.name) << a << QString(c_info.pwname) << QString(c_info.machine) << QString(t1) << QString(t2); + QTreeWidgetItem * item = new QTreeWidgetItem(_history, anItem); item=0 ; delete [] t1; delete [] t2; @@ -492,7 +500,7 @@ void RegWidget::InfoHistory() _refresh->setDisabled( TRUE ) ; _counter->stop(); MESSAGE("Sorry, No more Registry Server") ; - statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ; + statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ; } END_OF("InfoHistory") } @@ -520,9 +528,9 @@ void RegWidget::InfoReg() aTime = time_t(c_info.tc_hello); char * t2 = (char * )duplicate(ctime(&aTime)); t2 [strlen(t2) -1 ] = ' '; - QListViewItem * item = new QListViewItem(_clients, QString(c_info.name),\ - a, QString(c_info.pwname), QString(c_info.machine), \ - QString(t1), QString(t2)); + QStringList anItem; + anItem << QString(c_info.name) << a << QString(c_info.pwname) << QString(c_info.machine) << QString(t1) << QString(t2); + QTreeWidgetItem * item = new QTreeWidgetItem(_clients, anItem); item=0 ; delete [] t1; delete [] t2; @@ -535,7 +543,7 @@ void RegWidget::InfoReg() _refresh->setDisabled( TRUE ) ; _counter->stop(); MESSAGE("Sorry, No more Registry Server") ; - statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ; + statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ; } END_OF("InfoReg") } @@ -547,14 +555,14 @@ void RegWidget::slotListeSelect() { try { - ASSERT(_tabWidget->currentPage() != NULL); - if (_tabWidget->currentPage () == _clients) InfoReg(); - else if (_tabWidget->currentPage () == _history) InfoHistory(); + ASSERT(_tabWidget->currentWidget() != NULL); + if (_tabWidget->currentWidget () == _clients) InfoReg(); + else if (_tabWidget->currentWidget () == _history) InfoHistory(); } catch( ... ) { MESSAGE("Sorry, No more Registry Server") ; - statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ; + statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ; } } @@ -580,7 +588,7 @@ void RegWidget::slotIntervalOk() { BEGIN_OF("slotIntervalOk"); myRefreshInterval = myIntervalWindow->getValue(); - _counter->changeInterval( myRefreshInterval * 1000 ); + _counter->start( myRefreshInterval * 1000 ); SCRUTE(myRefreshInterval); myIntervalWindow->close(); END_OF("slotIntervalOk"); @@ -598,7 +606,7 @@ void RegWidget::slotHelp() } myHelpWindow->show(); myHelpWindow->raise(); - myHelpWindow->setActiveWindow(); + myHelpWindow->activateWindow(); END_OF("slotHelp()") ; } @@ -606,7 +614,7 @@ void RegWidget::slotHelp() /*! Called when user clicks on item in list */ -void RegWidget::slotClientChanged( QListViewItem* item ) +void RegWidget::slotClientChanged( QTreeWidgetItem* item ) { BEGIN_OF("slotClientChanged()") ; @@ -617,7 +625,7 @@ void RegWidget::slotClientChanged( QListViewItem* item ) int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverclients); SCRUTE(numeroItem) ; - SCRUTE(item->text(1)) ; + SCRUTE(item->text(1).toLatin1().constData()) ; ASSERT(numeroItem>=0) ; ASSERT((size_t)numeroItem<_serverclients->length()) ; @@ -629,11 +637,11 @@ void RegWidget::slotClientChanged( QListViewItem* item ) myInfoWindow->installEventFilter( this ); } QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name ); - myInfoWindow->setCaption(a); + myInfoWindow->setWindowTitle(a); myInfoWindow->setText( RegWidget::setlongText( c_info) ); myInfoWindow->show(); myInfoWindow->raise(); - myInfoWindow->setActiveWindow(); + myInfoWindow->activateWindow(); blockSignals( false ); // enabling signals again @@ -644,7 +652,7 @@ void RegWidget::slotClientChanged( QListViewItem* item ) /*! Called when user clicks on item in list */ -void RegWidget::slotHistoryChanged( QListViewItem* item ) +void RegWidget::slotHistoryChanged( QTreeWidgetItem* item ) { BEGIN_OF("slotHistoryChanged()") ; @@ -657,7 +665,7 @@ void RegWidget::slotHistoryChanged( QListViewItem* item ) int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverhistory); SCRUTE(numeroItem) ; - SCRUTE(item->text(1)) ; + SCRUTE(item->text(1).toLatin1().constData()) ; ASSERT(numeroItem>=0) ; ASSERT((size_t)numeroItem<_serverhistory->length()) ; const Registry::Infos & c_info=(*_serverhistory)[numeroItem]; @@ -668,11 +676,11 @@ void RegWidget::slotHistoryChanged( QListViewItem* item ) myInfoWindow->installEventFilter( this ); } QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name ); - myInfoWindow->setCaption(a); + myInfoWindow->setWindowTitle(a); myInfoWindow->setText( RegWidget::setlongText( c_info ) ); myInfoWindow->show(); myInfoWindow->raise(); - myInfoWindow->setActiveWindow(); + myInfoWindow->activateWindow(); blockSignals( false ); // enabling signals again @@ -684,10 +692,16 @@ void RegWidget::slotHistoryChanged( QListViewItem* item ) Constructor */ InfoWindow::InfoWindow( QWidget* parent, const char* name ) - : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose ) + : QMainWindow( parent, Qt::Window ) { BEGIN_OF("InfoWindow"); - myTextView = new QTextView( this, "myTextView" ); + + setObjectName( name ); + setAttribute( Qt::WA_DeleteOnClose ); + + myTextView = new QTextEdit( this ); + myTextView->setObjectName( "myTextView" ); + myTextView->setReadOnly( true ); setCentralWidget( myTextView ); setMinimumSize( 450, 250 ); END_OF("InfoWindow"); @@ -707,7 +721,7 @@ void InfoWindow::setText( const QString& text ) void InfoWindow::keyPressEvent( QKeyEvent * e ) { QMainWindow::keyPressEvent( e ); - if ( e->key() == Key_Escape ) + if ( e->key() == Qt::Key_Escape ) close(); } @@ -795,7 +809,7 @@ QString findFile( QString filename ) if ( cenv ) { dir.sprintf( "%s", cenv ); if ( !dir.isEmpty() ) { - QStringList dirList = QStringList::split( SEPARATOR, dir, false ); // skip empty entries + QStringList dirList = dir.split( SEPARATOR, QString::SkipEmptyParts ); // skip empty entries for ( int i = 0; i < dirList.count(); i++ ) { QFileInfo fileInfo( addSlash( dirList[ i ] ) + filename ); if ( fileInfo.isFile() && fileInfo.exists() ) diff --git a/src/RegistryDisplay/RegWidget.h b/src/RegistryDisplay/RegWidget.h index c3f2015c7..0f4256bb5 100755 --- a/src/RegistryDisplay/RegWidget.h +++ b/src/RegistryDisplay/RegWidget.h @@ -28,24 +28,23 @@ # ifndef __REGWIDGET_H__ # define __REGWIDGET_H__ -# include -# include + +# include #include #include CORBA_CLIENT_HEADER(SALOME_Registry) -#include - class QTabWidget; -class QListView; -class QListViewItem; +class QTreeWidget; +class QTreeWidgetItem; class QWidget; class QTimer; class QCloseEvent; -class QTextView; -class QPushButton; +class QTextEdit; +class QAction; class HelpWindow; class InfoWindow; +class IntervalWindow; class RegWidget : public QMainWindow { @@ -63,11 +62,13 @@ public: static RegWidget* GetRegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 ); + virtual QMenu* createPopupMenu(); + public slots: void slotHelp(); void slotListeSelect(); - void slotClientChanged( QListViewItem* ); - void slotHistoryChanged( QListViewItem* ); + void slotClientChanged( QTreeWidgetItem* ); + void slotHistoryChanged( QTreeWidgetItem* ); void slotSelectRefresh(); void slotIntervalOk(); protected: @@ -76,13 +77,13 @@ protected: void closeEvent( QCloseEvent *e); protected : - QListView* _clients; - QListView* _history; + QTreeWidget* _clients; + QTreeWidget* _history; QWidget* _parent; QTabWidget* _tabWidget; - QPushButton* _refresh; - QPushButton* _interval; - QPushButton* _close; + QAction* _refresh; + QAction* _interval; + QAction* _close; QTimer* _counter; Registry::AllInfos* _serverhistory; Registry::AllInfos* _serverclients; @@ -101,13 +102,13 @@ public: InfoWindow( QWidget* parent = 0, const char* name = 0); void setText( const QString& text ); - QTextView* textView() const { return myTextView; } + QTextEdit* textView() const { return myTextView; } protected: void keyPressEvent( QKeyEvent * e ); private: - QTextView* myTextView; + QTextEdit* myTextView; }; diff --git a/src/RegistryDisplay/RegWidgetFactory.cxx b/src/RegistryDisplay/RegWidgetFactory.cxx index 7f285e686..19405ecd4 100755 --- a/src/RegistryDisplay/RegWidgetFactory.cxx +++ b/src/RegistryDisplay/RegWidgetFactory.cxx @@ -41,7 +41,7 @@ void OnGUIEvent( CORBA::ORB_var &orb, QWidget *parent, const char *name ) //ASSERT ( !ptrRegWidget ); ptrRegWidget->show(); ptrRegWidget->raise(); - ptrRegWidget->setActiveWindow(); + ptrRegWidget->activateWindow(); return; } diff --git a/src/RegistryDisplay/RegistryDisplay.pro b/src/RegistryDisplay/RegistryDisplay.pro new file mode 100644 index 000000000..c48bf626d --- /dev/null +++ b/src/RegistryDisplay/RegistryDisplay.pro @@ -0,0 +1,34 @@ +TEMPLATE = lib +TARGET = RegistryDisplay +DESTDIR = ../../lib +MOC_DIR = ../../moc +OBJECTS_DIR = ../../obj/$$TARGET + +KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome + +CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS + +KERNEL_LDFLAGS = $$(KERNEL_ROOT_DIR)/lib/salome + +INCLUDEPATH += ../../salome_adm/unix ../../idl $${KERNEL_CXXFLAGS} $${CORBA_INCLUDES} +LIBS += -L$${KERNEL_LDFLAGS} -lSalomeNS -lOpUtil -lSalomeIDLKernel + +CONFIG -= debug release debug_and_release +CONFIG += qt thread debug dll shared + +win32:DEFINES += WIN32 +DEFINES += OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG + +HEADERS = HelpWindow.hxx +HEADERS += IntervalWindow.hxx +HEADERS += RegWidget.h + +SOURCES = HelpWindow.cxx +SOURCES += RegWidget.cxx +SOURCES += RegWidgetFactory.cxx +SOURCES += IntervalWindow.cxx + +includes.files = $$HEADERS +includes.path = ../../include + +INSTALLS += includes diff --git a/src/src.pro b/src/src.pro index 74a97dac5..2c3e66c3d 100644 --- a/src/src.pro +++ b/src/src.pro @@ -21,3 +21,4 @@ SUBDIRS += OCCViewer SUBDIRS += SOCC SUBDIRS += Event SUBDIRS += ResExporter +SUBDIRS += RegistryDisplay