Version: 9.16.0
FormContainerDecorator Class Reference

#include <FormContainerDecorator.hxx>

Inheritance diagram for FormContainerDecorator:
Collaboration diagram for FormContainerDecorator:

Public Slots

void on_tb_container_toggled (bool checked)
 
void onResMousePressed ()
 
void onResActivated (int)
 
void onContToggled (bool)
 

Signals

void typeOfContainerIsKnown (const QString &typeOfCont)
 
void resourceMousePressed ()
 
void resourceActivated (int)
 
void containerToggled (bool)
 

Public Member Functions

 FormContainerDecorator (YACS::ENGINE::Container *cont, QWidget *parent=0)
 
 ~FormContainerDecorator ()
 
void FillPanel (YACS::ENGINE::Container *container)
 
QWidgetgetWidget ()
 
bool onApply ()
 
void onCancel ()
 
void show ()
 
void hide ()
 
void synchronizeCheckContainer ()
 
std::string getHostName (int index) const
 
void setName (const std::string &name)
 

Static Public Attributes

static bool CHECKED = false
 

Private Member Functions

bool checkOK () const
 
void checkAndRepareTypeIfNecessary (YACS::ENGINE::Container *container)
 
void connectForTyp ()
 

Private Attributes

FormContainerBase_typ
 
QIcon _icon
 

Detailed Description

Definition at line 40 of file FormContainerDecorator.hxx.

Constructor & Destructor Documentation

◆ FormContainerDecorator()

FormContainerDecorator::FormContainerDecorator ( YACS::ENGINE::Container cont,
QWidget parent = 0 
)

Definition at line 34 of file FormContainerDecorator.cxx.

34 :QWidget(parent),_typ(0)
35{
36 setupUi(this);
37 _icon.addFile("icons:icon_down.png");
38 _icon.addFile("icons:icon_up.png",QSize(), QIcon::Normal, QIcon::On);
39 tb_container->setIcon(_icon);
40 connect(this,SIGNAL(typeOfContainerIsKnown(const QString&)),label,SLOT(setText(const QString &)));
41 if(!cont)
42 return ;
43 HomogeneousPoolContainer *hpc(dynamic_cast<HomogeneousPoolContainer *>(cont));
44 if(!hpc)
45 _typ=new FormContainer(this);
46 else
47 _typ=new FormHPContainer(this);
49 _typ->FillPanel(cont);
50 gridLayout_1->addWidget(_typ);
52 tb_container->setChecked(CHECKED);
54}
virtual QString getTypeStr() const =0
virtual void FillPanel(YACS::ENGINE::Container *container)
void typeOfContainerIsKnown(const QString &typeOfCont)
void on_tb_container_toggled(bool checked)

References _icon, _typ, CHECKED, connectForTyp(), FormContainerBase::FillPanel(), FormContainerBase::getTypeStr(), on_tb_container_toggled(), and typeOfContainerIsKnown().

◆ ~FormContainerDecorator()

FormContainerDecorator::~FormContainerDecorator ( )

Definition at line 56 of file FormContainerDecorator.cxx.

57{
58 delete _typ;
59}

References _typ.

Member Function Documentation

◆ checkAndRepareTypeIfNecessary()

void FormContainerDecorator::checkAndRepareTypeIfNecessary ( YACS::ENGINE::Container container)
private

Definition at line 157 of file FormContainerDecorator.cxx.

158{
159 if(!container)
160 return ;
162 if(_typ)
163 {
164 bool isTyp1(dynamic_cast<FormHPContainer *>(_typ)!=0);
165 if((!cont1 && !isTyp1) || (cont1 && isTyp1))
166 return ;
167 delete _typ; _typ=0;
168 }
169 if(!cont1)
170 _typ=new FormContainer(this);
171 else
172 _typ=new FormHPContainer(this);
173 gridLayout_1->addWidget(_typ);
176 _typ->FillPanel(container);
177}

References _typ, connectForTyp(), FormContainerBase::FillPanel(), FormContainerBase::getTypeStr(), and typeOfContainerIsKnown().

Referenced by FillPanel().

◆ checkOK()

bool FormContainerDecorator::checkOK ( ) const
private

Definition at line 152 of file FormContainerDecorator.cxx.

153{
154 return _typ;
155}

References _typ.

Referenced by getHostName(), hide(), onApply(), onCancel(), setName(), and show().

◆ connectForTyp()

void FormContainerDecorator::connectForTyp ( )
private

Definition at line 179 of file FormContainerDecorator.cxx.

180{
181 connect(_typ->cb_resource,SIGNAL(mousePressed()),this,SLOT(onResMousePressed()));
182 connect(_typ->cb_resource,SIGNAL(activated(int)),this,SLOT(onResActivated(int)));
183 connect(tb_container,SIGNAL(toggled(bool)),this,SLOT(onContToggled(bool)));
184}

References _typ, onContToggled(), onResActivated(), and onResMousePressed().

Referenced by checkAndRepareTypeIfNecessary(), and FormContainerDecorator().

◆ containerToggled

void FormContainerDecorator::containerToggled ( bool  )
signal

Referenced by onContToggled().

◆ FillPanel()

◆ getHostName()

std::string FormContainerDecorator::getHostName ( int  index) const

Definition at line 123 of file FormContainerDecorator.cxx.

124{
125 if(!checkOK())
126 return std::string();
127 return _typ->cb_resource->itemText(index).toStdString();
128}

References _typ, and checkOK().

Referenced by YACS::HMI::EditionSalomeNode::changeHost().

◆ getWidget()

QWidget * FormContainerDecorator::getWidget ( )

Definition at line 67 of file FormContainerDecorator.cxx.

68{
69 return _typ;
70}

References _typ.

Referenced by on_tb_container_toggled().

◆ hide()

void FormContainerDecorator::hide ( )

Definition at line 96 of file FormContainerDecorator.cxx.

97{
98 QWidget::hide();
99 if(!checkOK())
100 return ;
101 _typ->hide();
102}

References _typ, and checkOK().

Referenced by YACS::HMI::EditionScript::on_remote_toggled(), and YACS::HMI::EditionScript::on_tb_options_toggled().

◆ on_tb_container_toggled

void FormContainerDecorator::on_tb_container_toggled ( bool  checked)
slot

Definition at line 104 of file FormContainerDecorator.cxx.

105{
106 DEBTRACE("FormContainer::on_tb_container_toggled " << checked);
107 CHECKED = checked;
108 if (CHECKED)
109 {
110 getWidget()->show();
111 }
112 else
113 {
114 getWidget()->hide();
115 }
116}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31

References CHECKED, DEBTRACE, and getWidget().

Referenced by FormContainerDecorator(), and show().

◆ onApply()

bool FormContainerDecorator::onApply ( )

◆ onCancel()

void FormContainerDecorator::onCancel ( )

Definition at line 79 of file FormContainerDecorator.cxx.

80{
81 if(!checkOK())
82 return ;
83 _typ->onCancel();
84}
virtual void onCancel()

References _typ, checkOK(), and FormContainerBase::onCancel().

Referenced by YACS::HMI::EditionContainer::onCancel(), and YACS::HMI::EditionScript::onCancel().

◆ onContToggled

void FormContainerDecorator::onContToggled ( bool  v)
slot

Definition at line 147 of file FormContainerDecorator.cxx.

148{
149 emit(containerToggled(v));
150}
void containerToggled(bool)

References containerToggled().

Referenced by connectForTyp().

◆ onResActivated

void FormContainerDecorator::onResActivated ( int  v)
slot

Definition at line 142 of file FormContainerDecorator.cxx.

143{
144 emit(resourceActivated(v));
145}

References resourceActivated().

Referenced by connectForTyp().

◆ onResMousePressed

void FormContainerDecorator::onResMousePressed ( )
slot

Definition at line 137 of file FormContainerDecorator.cxx.

138{
139 emit(resourceMousePressed());
140}

References resourceMousePressed().

Referenced by connectForTyp().

◆ resourceActivated

void FormContainerDecorator::resourceActivated ( int  )
signal

Referenced by onResActivated().

◆ resourceMousePressed

void FormContainerDecorator::resourceMousePressed ( )
signal

Referenced by onResMousePressed().

◆ setName()

void FormContainerDecorator::setName ( const std::string &  name)

Definition at line 130 of file FormContainerDecorator.cxx.

131{
132 if(!checkOK())
133 return ;
134 _typ->le_name->setText(name.c_str());
135}

References _typ, and checkOK().

Referenced by YACS::HMI::EditionContainer::update().

◆ show()

void FormContainerDecorator::show ( )

Definition at line 86 of file FormContainerDecorator.cxx.

87{
88 QWidget::show();
89 if(!checkOK())
90 return ;
91 _typ->show();
92 tb_container->setChecked(CHECKED);
94}

References _typ, CHECKED, checkOK(), and on_tb_container_toggled().

Referenced by YACS::HMI::EditionScript::on_remote_toggled(), and YACS::HMI::EditionScript::on_tb_options_toggled().

◆ synchronizeCheckContainer()

void FormContainerDecorator::synchronizeCheckContainer ( )

Definition at line 118 of file FormContainerDecorator.cxx.

119{
120 tb_container->setChecked(CHECKED);
121}

References CHECKED.

Referenced by YACS::HMI::EditionSalomeNode::synchronize().

◆ typeOfContainerIsKnown

void FormContainerDecorator::typeOfContainerIsKnown ( const QString &  typeOfCont)
signal

Member Data Documentation

◆ _icon

QIcon FormContainerDecorator::_icon
private

Definition at line 73 of file FormContainerDecorator.hxx.

Referenced by FormContainerDecorator().

◆ _typ

◆ CHECKED

bool FormContainerDecorator::CHECKED = false
static

The documentation for this class was generated from the following files: