+/*!
+ Constructor
+*/
+SUPERVGUI_CustomSettings::SUPERVGUI_CustomSettings(QListViewItem* theItem,
+ bool isMultiSel,
+ bool isCimpl)
+ : QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ Trace("SUPERVGUI_CustomSettings::SUPERVGUI_CustomSettings");
+
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop();
+
+ setSizeGripEnabled( true );
+
+ QGridLayout* TopLayout = new QGridLayout( this );
+ TopLayout->setSpacing( 6 );
+ TopLayout->setMargin( 11 );
+
+ QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
+ TopGroup->setColumnLayout(0, Qt::Vertical );
+ TopGroup->layout()->setSpacing( 0 );
+ TopGroup->layout()->setMargin( 0 );
+ QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
+ TopGroupLayout->setAlignment( Qt::AlignTop );
+ TopGroupLayout->setSpacing( 6 );
+ TopGroupLayout->setMargin( 11 );
+
+ QLabel* authL = new QLabel( tr( "AUTHOR_LBL" ), TopGroup);
+ authV = new QLineEdit( TopGroup );
+ authV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ authV->setMinimumSize( 200, 0 );
+ authV->setText( "" );
+
+ contL = new QLabel( tr( "CONTAINER_LBL" ), TopGroup );
+ contV = new QLineEdit( TopGroup );
+ contV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ contV->setMinimumSize( 200, 0 );
+
+ QLabel* commL = new QLabel( tr( "COMMENT_LBL" ), TopGroup);
+ commV = new QMultiLineEdit( TopGroup );
+ commV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+ commV->setMinimumSize( 200, 100 );
+
+ if ( !aSupMod->getInterfaceNameMap().contains(theItem->parent()->parent()->text(0)) ) {
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NONODE_TOADD"));
+ return;
+ }
+ const char* component = aSupMod->getInterfaceNameMap().find(theItem->parent()->parent()->text(0)).data();
+
+ QString aNodeDefComment;
+ if ( !isMultiSel ) {
+ // 1) set caption
+ const char* service = theItem->text(0).latin1();
+ aNodeDefComment = QString(service) + QString(tr("COMMENT_FROM")) + QString(component);
+ setCaption( tr( "TLT_CUSTOMPARAMETERS_SINGLE" ) + aNodeDefComment );
+ }
+ else {
+ // 1) set caption
+ aNodeDefComment = QString("Factory Node");
+ setCaption( tr( "TLT_CUSTOMPARAMETERS_MULTI" ) );
+ }
+
+ // 2) set Container
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
+ if (aMain==0) {
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
+ return;
+ }
+ const char* aContainer = aMain->getDataflow()->ContainerNameForComponent(component);
+ if ( aContainer && strlen(aContainer) > 0 )
+ contV->setText( QString(aContainer) );
+ else if ( isCimpl ) // C++ implementation
+ contV->setText( QString(aMain->getDataflow()->DefaultCContainerName()) );
+ else // Python implementation
+ contV->setText( QString(aMain->getDataflow()->DefaultPythonContainerName()) );
+
+ // 3) set comment
+ commV->setText( aNodeDefComment );
+
+ TopGroupLayout->addWidget( authL, 1, 0 );
+ TopGroupLayout->addWidget( authV, 1, 1 );
+ TopGroupLayout->addWidget( contL, 2, 0 );
+ TopGroupLayout->addWidget( contV, 2, 1 );
+ TopGroupLayout->addWidget( commL, 7, 0 );
+ TopGroupLayout->addMultiCellWidget( commV, 7, 8, 1, 1 );
+ TopGroupLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ), 8, 0 );
+ TopGroupLayout->setColStretch( 1, 5 );
+
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons );
+ connect( okB, SIGNAL( clicked() ), this, SLOT( okButton() ) );
+ QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
+ connect( cancelB, SIGNAL( clicked() ), this, SLOT( koButton() ) );
+
+ GroupButtonsLayout->addWidget( okB, 0, 0 );
+ GroupButtonsLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+ GroupButtonsLayout->addWidget( cancelB, 0, 2 );
+
+ TopLayout->addWidget( TopGroup, 0, 0 );
+ TopLayout->addWidget( GroupButtons, 1, 0 );
+ TopLayout->setRowStretch( 0, 1 );
+ TopLayout->setRowStretch( 1, 0 );
+
+ resize(370,200);
+}
+
+/*!
+ Destructor
+*/
+SUPERVGUI_CustomSettings::~SUPERVGUI_CustomSettings() {
+ Trace("SUPERVGUI_CustomSettings::~SUPERVGUI_CustomSettings");
+}
+
+/*!
+ Get author
+*/
+QString SUPERVGUI_CustomSettings::Author() {
+ return authV->text();
+}
+
+/*!
+ Get container
+*/
+QString SUPERVGUI_CustomSettings::Container() {
+ return contV->text();
+}
+
+/*!
+ Get comment
+*/
+QString SUPERVGUI_CustomSettings::Comment() {
+ return commV->text();
+}
+
+/*!
+ <OK> button slot
+*/
+void SUPERVGUI_CustomSettings::okButton() {
+ Trace("SUPERVGUI_CustomSettings::okButton");
+ accept();
+}
+
+/*!
+ <Cancel> button slot
+*/
+void SUPERVGUI_CustomSettings::koButton() {
+ Trace("SUPERVGUI_CustomSettings::koButton");
+ reject();
+}