//
// See http://www.salome-platform.org/
//
-// File : LightApp_NameDlg.cxx\r
-// Author : Vadim SANDLER\r
-// $Header$\r
-\r
-#include <LightApp_NameDlg.h>\r
-#include <SUIT_Application.h>\r
-#include <SUIT_Desktop.h>\r
-#include <SUIT_Tools.h>\r
-\r
-#include <qgroupbox.h>\r
-#include <qlabel.h>\r
-#include <qlineedit.h>\r
-#include <qpushbutton.h>\r
-#include <qlayout.h>\r
-\r
-#ifndef WIN32\r
-using namespace std;\r
-#endif\r
-\r
-/*!\r
- Constructor\r
-*/\r
-LightApp_NameDlg::LightApp_NameDlg( QWidget* parent )\r
-: QDialog( parent ? parent : NULL,//application()->desktop(), \r
-"LightApp_NameDlg",\r
-true,\r
-WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
-{\r
- setCaption( tr("TLT_RENAME") );\r
- setSizeGripEnabled( TRUE );\r
-\r
- QVBoxLayout* topLayout = new QVBoxLayout( this );\r
- topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );\r
-\r
- /***************************************************************/\r
- QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );\r
- GroupC1->setColumnLayout(0, Qt::Vertical );\r
- GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );\r
- QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );\r
- GroupC1Layout->setAlignment( Qt::AlignTop );\r
- GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );\r
- \r
- QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );\r
- TextLabel->setText( tr( "NAME_LBL" ) );\r
- GroupC1Layout->addWidget( TextLabel );\r
- \r
- myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );\r
- myLineEdit->setMinimumSize( 250, 0 );\r
- GroupC1Layout->addWidget( myLineEdit );\r
- \r
- /***************************************************************/\r
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );\r
- GroupButtons->setColumnLayout(0, Qt::Vertical );\r
- GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 ); \r
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );\r
- GroupButtonsLayout->setAlignment( Qt::AlignTop );\r
- GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );\r
- \r
- myButtonOk = new QPushButton( GroupButtons, "buttonOk" );\r
- myButtonOk->setText( tr( "BUT_OK" ) );\r
- myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );\r
- GroupButtonsLayout->addWidget( myButtonOk );\r
-\r
- GroupButtonsLayout->addStretch();\r
- \r
- myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );\r
- myButtonCancel->setText( tr( "BUT_CANCEL" ) );\r
- myButtonCancel->setAutoDefault( TRUE );\r
- GroupButtonsLayout->addWidget( myButtonCancel );\r
- /***************************************************************/\r
- \r
- topLayout->addWidget( GroupC1 );\r
- topLayout->addWidget( GroupButtons );\r
- \r
- // signals and slots connections\r
- connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );\r
- connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );\r
- \r
- /* Move widget on the botton right corner of main widget */\r
- SUIT_Tools::centerWidget( this, parent );\r
-}\r
-\r
-/*!\r
- Destructor\r
-*/\r
-LightApp_NameDlg::~LightApp_NameDlg()\r
-{\r
-}\r
-\r
-/*!\r
- Sets name\r
-*/\r
-void LightApp_NameDlg::setName( const QString& name )\r
-{\r
- myLineEdit->setText( name );\r
- myLineEdit->end(false);\r
- myLineEdit->home(true);\r
-}\r
-\r
-/*!\r
- Returns name entered by user\r
-*/\r
-QString LightApp_NameDlg::name()\r
-{\r
- return myLineEdit->text();\r
-}\r
-\r
-void LightApp_NameDlg::accept()\r
-{\r
- if ( name().stripWhiteSpace().isEmpty() )\r
- return;\r
- QDialog::accept();\r
-}\r
-\r
-/*!\r
- Creates modal <Rename> dialog and returns name entered [ static ]\r
-*/\r
-QString LightApp_NameDlg::getName( QWidget* parent, const QString& oldName )\r
-{\r
- QString n;\r
- LightApp_NameDlg* dlg = new LightApp_NameDlg( parent );\r
- if ( !oldName.isNull() )\r
- dlg->setName( oldName );\r
- if ( dlg->exec() == QDialog::Accepted ) \r
- n = dlg->name();\r
- delete dlg;\r
- return n;\r
-}\r
+// File : LightApp_NameDlg.cxx
+// Author : Vadim SANDLER
+// $Header$
+
+#include <LightApp_NameDlg.h>
+#include <SUIT_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Tools.h>
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+
+#ifndef WIN32
+using namespace std;
+#endif
+
+/*!
+ Constructor
+*/
+LightApp_NameDlg::LightApp_NameDlg( QWidget* parent )
+: QDialog( parent ? parent : NULL,//application()->desktop(),
+"LightApp_NameDlg",
+true,
+WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( tr("TLT_RENAME") );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* topLayout = new QVBoxLayout( this );
+ topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
+
+ /***************************************************************/
+ QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
+ GroupC1->setColumnLayout(0, Qt::Vertical );
+ GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );
+ QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );
+ GroupC1Layout->setAlignment( Qt::AlignTop );
+ GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );
+
+ QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );
+ TextLabel->setText( tr( "NAME_LBL" ) );
+ GroupC1Layout->addWidget( TextLabel );
+
+ myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );
+ myLineEdit->setMinimumSize( 250, 0 );
+ GroupC1Layout->addWidget( myLineEdit );
+
+ /***************************************************************/
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 );
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
+
+ myButtonOk = new QPushButton( GroupButtons, "buttonOk" );
+ myButtonOk->setText( tr( "BUT_OK" ) );
+ myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonOk );
+
+ GroupButtonsLayout->addStretch();
+
+ myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ myButtonCancel->setText( tr( "BUT_CANCEL" ) );
+ myButtonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonCancel );
+ /***************************************************************/
+
+ topLayout->addWidget( GroupC1 );
+ topLayout->addWidget( GroupButtons );
+
+ // signals and slots connections
+ connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+ /* Move widget on the botton right corner of main widget */
+ SUIT_Tools::centerWidget( this, parent );
+}
+
+/*!
+ Destructor
+*/
+LightApp_NameDlg::~LightApp_NameDlg()
+{
+}
+
+/*!
+ Sets name
+*/
+void LightApp_NameDlg::setName( const QString& name )
+{
+ myLineEdit->setText( name );
+ myLineEdit->end(false);
+ myLineEdit->home(true);
+}
+
+/*!
+ Returns name entered by user
+*/
+QString LightApp_NameDlg::name()
+{
+ return myLineEdit->text();
+}
+
+void LightApp_NameDlg::accept()
+{
+ if ( name().stripWhiteSpace().isEmpty() )
+ return;
+ QDialog::accept();
+}
+
+/*!
+ Creates modal <Rename> dialog and returns name entered [ static ]
+*/
+QString LightApp_NameDlg::getName( QWidget* parent, const QString& oldName )
+{
+ QString n;
+ LightApp_NameDlg* dlg = new LightApp_NameDlg( parent );
+ if ( !oldName.isNull() )
+ dlg->setName( oldName );
+ if ( dlg->exec() == QDialog::Accepted )
+ n = dlg->name();
+ delete dlg;
+ return n;
+}