# include "HelpWindow.hxx"
# include "utilities.h"
-# include <qtextview.h>
-# include <qpushbutton.h>
-# include <qtextstream.h>
-# include <qfile.h>
+# include <QTextEdit>
+# include <QTextStream>
+# include <QFile>
+# include <QColorGroup>
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());
}
#include <IntervalWindow.hxx>
-#include <qbuttongroup.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
+#include <QWidget>
+#include <QLabel>
+#include <QPushButton>
+#include <QSpinBox>
+#include <QGridLayout>
+#include <QGroupBox>
# include "utilities.h"
#define MARGIN_SIZE 11
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 );
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);
// Module : SALOME
// $Header$
-# include <qpushbutton.h>
-# include <qlistview.h>
-# include <qtabwidget.h>
-# include <qstatusbar.h>
-# include <qtextview.h>
-# include <qtimer.h>
-# include <qinputdialog.h>
-# include <qtoolbar.h>
-# include <qdir.h>
-# include <qtooltip.h>
+# include <QAction>
+# include <QPushButton>
+# include <QTreeWidget>
+# include <QTabWidget>
+# include <QStatusBar>
+# include <QTextEdit>
+# include <QTimer>
+# include <QToolBar>
+//# include <QDir>
+# include <QToolTip>
+# include <QEvent>
+# include <QKeyEvent>
+# include <QCloseEvent>
+# include <QFileInfo>
# include "SALOME_NamingService.hxx"
# include "ServiceUnreachable.hxx"
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( "" );
}*/
QPixmap pm ( aFile );
if ( !pm.isNull() )
- setIcon( pm );
+ setWindowIcon( pm );
// pixmap for buttons
QPixmap image_refresh ( ( const char** ) refresh_data );
// 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)
PIXELS largeur = 800 ;
PIXELS hauteur = 350 ;
setGeometry( xpos, ypos, largeur, hauteur ) ;
- setCaption( name ) ;
- statusBar()->message(" ");
+ setWindowTitle( name ) ;
+ statusBar()->showMessage(" ");
}
/*!
}
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() );
}
}
{
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");
}
*/
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");
}
/*!
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;
_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")
}
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;
_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")
}
{
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" ) ) ;
}
}
{
BEGIN_OF("slotIntervalOk");
myRefreshInterval = myIntervalWindow->getValue();
- _counter->changeInterval( myRefreshInterval * 1000 );
+ _counter->start( myRefreshInterval * 1000 );
SCRUTE(myRefreshInterval);
myIntervalWindow->close();
END_OF("slotIntervalOk");
}
myHelpWindow->show();
myHelpWindow->raise();
- myHelpWindow->setActiveWindow();
+ myHelpWindow->activateWindow();
END_OF("slotHelp()") ;
}
/*!
Called when user clicks on item in <Running> list
*/
-void RegWidget::slotClientChanged( QListViewItem* item )
+void RegWidget::slotClientChanged( QTreeWidgetItem* item )
{
BEGIN_OF("slotClientChanged()") ;
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()) ;
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
/*!
Called when user clicks on item in <History> list
*/
-void RegWidget::slotHistoryChanged( QListViewItem* item )
+void RegWidget::slotHistoryChanged( QTreeWidgetItem* item )
{
BEGIN_OF("slotHistoryChanged()") ;
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];
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
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");
void InfoWindow::keyPressEvent( QKeyEvent * e )
{
QMainWindow::keyPressEvent( e );
- if ( e->key() == Key_Escape )
+ if ( e->key() == Qt::Key_Escape )
close();
}
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() )