//
// See http://www.salome-platform.org/
//
-// File : LightApp_ModuleDlg.cxx\r
-// Author : Michael Zorin (mzn)\r
-// Module : LightApp\r
-\r
-#include <LightApp_ModuleDlg.h>\r
-\r
-#include <qframe.h>\r
-#include <qlabel.h>\r
-#include <qpushbutton.h>\r
-#include <qlayout.h>\r
-#include <qpixmap.h>\r
-\r
-#ifndef WIN32\r
-using namespace std;\r
-#endif\r
-\r
-/*!Default icon*/\r
-static const char* const default_icon[] = { \r
-"48 48 17 1",\r
-". c None",\r
-"# c #161e4c",\r
-"b c #1d3638",\r
-"e c #2f585b",\r
-"i c #345b5e",\r
-"c c #386266",\r
-"g c #3f7477",\r
-"d c #4d8589",\r
-"m c #519099",\r
-"o c #6abbc1",\r
-"a c #70c9d3",\r
-"f c #79ddea",\r
-"n c #7adff2",\r
-"k c #7ce2f4",\r
-"j c #993550",\r
-"h c #d84b71",\r
-"l c #ef537d",\r
-"................................................",\r
-"................................................",\r
-"................................................",\r
-"................................................",\r
-"................................................",\r
-"................########.########.########......",\r
-"...............#aaaaaa###aaaaaa###aaaaaa##......",\r
-"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......",\r
-".............########b########b########cc#......",\r
-".............#dddddd#b#dddddd#b#dddddd#cc#......",\r
-"...........########d########d########d#cc#......",\r
-"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......",\r
-".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......",\r
-"........########b########e########cc#d#c#.......",\r
-"........#dddddd#b#dddddd#e#ffffff#cc#d####......",\r
-"......########d########d########f#cc###g##......",\r
-".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......",\r
-"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......",\r
-"...########b########i########jj#f#c#gg#cc#......",\r
-"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......",\r
-"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......",\r
-"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......",\r
-"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......",\r
-"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......",\r
-"...#kkkkkk###kkkkkk###llllll####d#cc###g##......",\r
-"...########g########g########o##d#cc#gg#c#......",\r
-"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......",\r
-"...########b########b########cc#d#c#gg#cc#......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........",\r
-"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........",\r
-"...########g########g########g##g#cc#...........",\r
-"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........",\r
-"...########b########b########cc#g#c#............",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................",\r
-"...#kkkkkk###kkkkkk###kkkkkk##..................",\r
-"...########.########.########...................",\r
-"................................................",\r
-"................................................",\r
-"................................................",\r
-"................................................"};\r
-\r
-//==============================================================================================================================\r
-/*!\r
- * LightApp_ModuleDlg::LightApp_ModuleDlg \n\r
- *\r
- * Constructor.\r
- */\r
-//==============================================================================================================================\r
-LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon )\r
- : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
-{\r
- QPixmap defaultIcon( ( const char** ) default_icon );\r
- setCaption( tr( "CAPTION" ) );\r
- setSizeGripEnabled( TRUE );\r
- \r
- QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this ); \r
- ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 );\r
-\r
- // Module's name and icon\r
- myComponentFrame = new QFrame( this, "myComponentFrame" );\r
- myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) );\r
- myComponentFrame->setMinimumHeight( 100 );\r
- myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );\r
- \r
- QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame ); \r
- myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 );\r
-\r
- // --> icon\r
- myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" );\r
- myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );\r
- myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon );\r
- myComponentIcon->setScaledContents( false );\r
- myComponentIcon->setAlignment( AlignCenter );\r
- // --> name\r
- myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" );\r
- QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt ); \r
- myComponentLab->setAlignment( AlignCenter );\r
-\r
- myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 );\r
- myComponentFrameLayout->addWidget( myComponentLab, 0, 1 );\r
-\r
- // Info\r
- QVBoxLayout* infoLayout = new QVBoxLayout();\r
- infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 );\r
- \r
- // --> top line\r
- QFrame* myLine1 = new QFrame( this, "myLine1" );\r
- myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain );\r
- // --> info label \r
- myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" );\r
- myInfoLabel->setAlignment( AlignCenter );\r
- // --> bottom line\r
- QFrame* myLine2 = new QFrame( this, "myLine2" );\r
- myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain );\r
- \r
- infoLayout->addStretch();\r
- infoLayout->addWidget( myLine1 );\r
- infoLayout->addWidget( myInfoLabel );\r
- infoLayout->addWidget( myLine2 );\r
- infoLayout->addStretch();\r
- \r
- // Buttons\r
- QHBoxLayout* btnLayout = new QHBoxLayout(); \r
- btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );\r
- \r
- // --> New\r
- myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" );\r
- myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true );\r
- // --> Open\r
- myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" );\r
- myOpenBtn->setAutoDefault( true );\r
- // --> Load\r
- myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" );\r
- myLoadBtn->setAutoDefault( true );\r
- // --> Cancel\r
- myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" );\r
- myCancelBtn->setAutoDefault( true );\r
- \r
- btnLayout->addWidget( myNewBtn );\r
- btnLayout->addWidget( myOpenBtn );\r
- btnLayout->addWidget( myLoadBtn );\r
- btnLayout->addStretch();\r
- btnLayout->addSpacing( 70 );\r
- btnLayout->addStretch();\r
- btnLayout->addWidget( myCancelBtn );\r
-\r
- ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 );\r
- ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 );\r
- ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 );\r
-\r
- // signals and slots connections\r
- connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );\r
- connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );\r
- connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );\r
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );\r
-}\r
-\r
-//==============================================================================================================================\r
-/*!\r
- * LightApp_ModuleDlg::onButtonClicked\r
- *\r
- * Buttons slot\r
- */\r
-//==============================================================================================================================\r
-void LightApp_ModuleDlg::onButtonClicked()\r
-{\r
- QPushButton* btn = ( QPushButton* )sender();\r
- if ( btn == myNewBtn )\r
- done( 1 );\r
- if ( btn == myOpenBtn )\r
- done( 2 );\r
- if ( btn == myLoadBtn )\r
- done( 3 );\r
-}\r
+// File : LightApp_ModuleDlg.cxx
+// Author : Michael Zorin (mzn)
+// Module : LightApp
+
+#include <LightApp_ModuleDlg.h>
+
+#include <qframe.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+#ifndef WIN32
+using namespace std;
+#endif
+
+/*!Default icon*/
+static const char* const default_icon[] = {
+"48 48 17 1",
+". c None",
+"# c #161e4c",
+"b c #1d3638",
+"e c #2f585b",
+"i c #345b5e",
+"c c #386266",
+"g c #3f7477",
+"d c #4d8589",
+"m c #519099",
+"o c #6abbc1",
+"a c #70c9d3",
+"f c #79ddea",
+"n c #7adff2",
+"k c #7ce2f4",
+"j c #993550",
+"h c #d84b71",
+"l c #ef537d",
+"................................................",
+"................................................",
+"................................................",
+"................................................",
+"................................................",
+"................########.########.########......",
+"...............#aaaaaa###aaaaaa###aaaaaa##......",
+"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......",
+".............########b########b########cc#......",
+".............#dddddd#b#dddddd#b#dddddd#cc#......",
+"...........########d########d########d#cc#......",
+"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......",
+".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......",
+"........########b########e########cc#d#c#.......",
+"........#dddddd#b#dddddd#e#ffffff#cc#d####......",
+"......########d########d########f#cc###g##......",
+".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......",
+"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......",
+"...########b########i########jj#f#c#gg#cc#......",
+"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......",
+"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......",
+"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......",
+"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......",
+"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......",
+"...#kkkkkk###kkkkkk###llllll####d#cc###g##......",
+"...########g########g########o##d#cc#gg#c#......",
+"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......",
+"...########b########b########cc#d#c#gg#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........",
+"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........",
+"...########g########g########g##g#cc#...........",
+"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........",
+"...########b########b########cc#g#c#............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................",
+"...#kkkkkk###kkkkkk###kkkkkk##..................",
+"...########.########.########...................",
+"................................................",
+"................................................",
+"................................................",
+"................................................"};
+
+//==============================================================================================================================
+/*!
+ * LightApp_ModuleDlg::LightApp_ModuleDlg \n
+ *
+ * Constructor.
+ */
+//==============================================================================================================================
+LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon )
+ : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ QPixmap defaultIcon( ( const char** ) default_icon );
+ setCaption( tr( "CAPTION" ) );
+ setSizeGripEnabled( TRUE );
+
+ QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this );
+ ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 );
+
+ // Module's name and icon
+ myComponentFrame = new QFrame( this, "myComponentFrame" );
+ myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) );
+ myComponentFrame->setMinimumHeight( 100 );
+ myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+ QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame );
+ myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 );
+
+ // --> icon
+ myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" );
+ myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+ myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon );
+ myComponentIcon->setScaledContents( false );
+ myComponentIcon->setAlignment( AlignCenter );
+ // --> name
+ myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" );
+ QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt );
+ myComponentLab->setAlignment( AlignCenter );
+
+ myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 );
+ myComponentFrameLayout->addWidget( myComponentLab, 0, 1 );
+
+ // Info
+ QVBoxLayout* infoLayout = new QVBoxLayout();
+ infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 );
+
+ // --> top line
+ QFrame* myLine1 = new QFrame( this, "myLine1" );
+ myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain );
+ // --> info label
+ myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" );
+ myInfoLabel->setAlignment( AlignCenter );
+ // --> bottom line
+ QFrame* myLine2 = new QFrame( this, "myLine2" );
+ myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain );
+
+ infoLayout->addStretch();
+ infoLayout->addWidget( myLine1 );
+ infoLayout->addWidget( myInfoLabel );
+ infoLayout->addWidget( myLine2 );
+ infoLayout->addStretch();
+
+ // Buttons
+ QHBoxLayout* btnLayout = new QHBoxLayout();
+ btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );
+
+ // --> New
+ myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" );
+ myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true );
+ // --> Open
+ myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" );
+ myOpenBtn->setAutoDefault( true );
+ // --> Load
+ myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" );
+ myLoadBtn->setAutoDefault( true );
+ // --> Cancel
+ myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" );
+ myCancelBtn->setAutoDefault( true );
+
+ btnLayout->addWidget( myNewBtn );
+ btnLayout->addWidget( myOpenBtn );
+ btnLayout->addWidget( myLoadBtn );
+ btnLayout->addStretch();
+ btnLayout->addSpacing( 70 );
+ btnLayout->addStretch();
+ btnLayout->addWidget( myCancelBtn );
+
+ ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 );
+ ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 );
+ ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 );
+
+ // signals and slots connections
+ connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+ connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+ connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+ connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+//==============================================================================================================================
+/*!
+ * LightApp_ModuleDlg::onButtonClicked
+ *
+ * Buttons slot
+ */
+//==============================================================================================================================
+void LightApp_ModuleDlg::onButtonClicked()
+{
+ QPushButton* btn = ( QPushButton* )sender();
+ if ( btn == myNewBtn )
+ done( 1 );
+ if ( btn == myOpenBtn )
+ done( 2 );
+ if ( btn == myLoadBtn )
+ done( 3 );
+}
//
// 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;
+}
//
// See http://www.salome-platform.org/
//
-#ifndef LIGHTAPP_STUDY_H\r
-#define LIGHTAPP_STUDY_H\r
-\r
-#include <LightApp.h>\r
-#include <LightApp_Driver.h>\r
-\r
-#include <CAM_Study.h>\r
-#include <CAM_DataModel.h>\r
-#include <SUIT_Study.h>\r
-\r
-#include "string"\r
-#include "vector"\r
-\r
-class SUIT_Application;\r
-class CAM_DataModel;\r
-\r
-class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study\r
-{\r
- Q_OBJECT\r
-\r
-public:\r
- LightApp_Study( SUIT_Application* );\r
- virtual ~LightApp_Study();\r
-\r
- virtual void createDocument();\r
- virtual bool openDocument( const QString& );\r
- virtual bool loadDocument( const QString& ); \r
-\r
- virtual bool saveDocument();\r
- virtual bool saveDocumentAs( const QString& );\r
-\r
- virtual void closeDocument(bool permanently = true);\r
-\r
- virtual bool isSaved() const;\r
- virtual bool isModified() const;\r
-\r
- virtual void addComponent ( const CAM_DataModel* dm);\r
-\r
- virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile );\r
-\r
- virtual QString componentDataType( const QString& ) const;\r
- virtual QString referencedToEntry( const QString& ) const;\r
- virtual bool isComponent( const QString& ) const;\r
- virtual void children( const QString&, QStringList& ) const;\r
- virtual void components( QStringList& ) const;\r
-\r
-protected:\r
- virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );\r
- virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );\r
- virtual bool saveStudyData ( const QString& theFileName );\r
- virtual bool openStudyData ( const QString& theFileName );\r
-\r
- virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;\r
- virtual void SetListOfFiles ( const char* theModuleName,\r
- const std::vector<std::string> theListOfFiles );\r
-\r
- virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;\r
-\r
-protected:\r
- virtual bool openDataModel ( const QString&, CAM_DataModel* );\r
-\r
-signals:\r
- void saved ( SUIT_Study* );\r
- void opened ( SUIT_Study* );\r
- void closed ( SUIT_Study* );\r
- void created( SUIT_Study* );\r
-\r
-\r
-private:\r
- LightApp_Driver* myDriver;\r
-};\r
-\r
-#endif \r
+#ifndef LIGHTAPP_STUDY_H
+#define LIGHTAPP_STUDY_H
+
+#include <LightApp.h>
+#include <LightApp_Driver.h>
+
+#include <CAM_Study.h>
+#include <CAM_DataModel.h>
+#include <SUIT_Study.h>
+
+#include "string"
+#include "vector"
+
+class SUIT_Application;
+class CAM_DataModel;
+
+class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study
+{
+ Q_OBJECT
+
+public:
+ LightApp_Study( SUIT_Application* );
+ virtual ~LightApp_Study();
+
+ virtual void createDocument();
+ virtual bool openDocument( const QString& );
+ virtual bool loadDocument( const QString& );
+
+ virtual bool saveDocument();
+ virtual bool saveDocumentAs( const QString& );
+
+ virtual void closeDocument(bool permanently = true);
+
+ virtual bool isSaved() const;
+ virtual bool isModified() const;
+
+ virtual void addComponent ( const CAM_DataModel* dm);
+
+ virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile );
+
+ virtual QString componentDataType( const QString& ) const;
+ virtual QString referencedToEntry( const QString& ) const;
+ virtual bool isComponent( const QString& ) const;
+ virtual void children( const QString&, QStringList& ) const;
+ virtual void components( QStringList& ) const;
+
+protected:
+ virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );
+ virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );
+ virtual bool saveStudyData ( const QString& theFileName );
+ virtual bool openStudyData ( const QString& theFileName );
+
+ virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
+ virtual void SetListOfFiles ( const char* theModuleName,
+ const std::vector<std::string> theListOfFiles );
+
+ virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;
+
+protected:
+ virtual bool openDataModel ( const QString&, CAM_DataModel* );
+
+signals:
+ void saved ( SUIT_Study* );
+ void opened ( SUIT_Study* );
+ void closed ( SUIT_Study* );
+ void created( SUIT_Study* );
+
+
+private:
+ LightApp_Driver* myDriver;
+};
+
+#endif