TablespaceWidget::TablespaceWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_TABLESPACE) { Ui_TablespaceWidget::setupUi(this); configureFormLayout(tablespace_grid, OBJ_TABLESPACE); tablespace_grid->addItem(new QSpacerItem(10,0,QSizePolicy::Minimum,QSizePolicy::Expanding), tablespace_grid->count(), 0); setRequiredField(directory_lbl); setRequiredField(directory_edt); configureTabOrder(); setMinimumSize(480, 140); }
CastWidget::CastWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_CAST) { try { QFont font; QFrame *frame=nullptr; QSpacerItem *spacer=new QSpacerItem(10,1,QSizePolicy::Fixed,QSizePolicy::Expanding); Ui_CastWidget::setupUi(this); src_datatype=new PgSQLTypeWidget(this, trUtf8("Source data type")); trg_datatype=new PgSQLTypeWidget(this, trUtf8("Target data type")); conv_func_sel=new ObjectSelectorWidget(OBJ_FUNCTION, true, this); cast_grid->addWidget(conv_func_sel,1,1,1,4); cast_grid->addWidget(src_datatype,2,0,1,5); cast_grid->addWidget(trg_datatype,3,0,1,5); configureFormLayout(cast_grid, OBJ_CAST); name_edt->setReadOnly(true); font=name_edt->font(); font.setItalic(true); name_edt->setFont(font); frame=generateInformationFrame(trUtf8("The function to be assigned to a cast from <em><strong>typeA</strong></em> to <em><strong>typeB</strong></em> must have the following signature: <em><strong>typeB</strong> function(<strong>typeA</strong>, integer, boolean)</em>.")); cast_grid->addWidget(frame, cast_grid->count()+1, 0, 1, 0); cast_grid->addItem(spacer, cast_grid->count()+1, 0, 1, 0); frame->setParent(this); connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); connect(input_output_chk, SIGNAL(toggled(bool)), conv_func_sel, SLOT(setDisabled(bool))); connect(input_output_chk, SIGNAL(toggled(bool)), conv_func_sel, SLOT(clearSelector(void))); parent_form->setMinimumSize(530, 520); parent_form->setMaximumHeight(520); setRequiredField(src_datatype); setRequiredField(trg_datatype); configureTabOrder({ explicit_rb, implicit_rb, assignment_rb, input_output_chk, conv_func_sel, src_datatype, trg_datatype }); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
DomainWidget::DomainWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_DOMAIN) { try { Ui_DomainWidget::setupUi(this); check_expr_hl=nullptr; check_expr_hl=new SyntaxHighlighter(check_expr_txt, false); check_expr_hl->loadConfiguration(GlobalAttributes::CONFIGURATIONS_DIR + GlobalAttributes::DIR_SEPARATOR + GlobalAttributes::SQL_HIGHLIGHT_CONF + GlobalAttributes::CONFIGURATION_EXT); data_type=nullptr; data_type=new PgSQLTypeWidget(this); domain_grid->addWidget(data_type,4,0,1,2); configureFormLayout(domain_grid, OBJ_DOMAIN); connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); parent_form->setMinimumSize(540, 570); parent_form->setMaximumHeight(570); setRequiredField(data_type); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
DomainWidget::DomainWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_DOMAIN) { try { Ui_DomainWidget::setupUi(this); check_expr_hl=nullptr; check_expr_hl=new SyntaxHighlighter(check_expr_txt, false, true); check_expr_hl->loadConfiguration(GlobalAttributes::SQL_HIGHLIGHT_CONF_PATH); data_type=nullptr; data_type=new PgSQLTypeWidget(this); domain_grid->addWidget(data_type,4,0,1,2); domain_grid->addItem(new QSpacerItem(10,1,QSizePolicy::Fixed,QSizePolicy::Expanding), domain_grid->count()+1, 0, 1, 0); configureFormLayout(domain_grid, OBJ_DOMAIN); setRequiredField(data_type); configureTabOrder({ def_value_edt, constr_name_edt, not_null_chk, check_expr_txt, data_type }); setMinimumSize(580, 530); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
ConversionWidget::ConversionWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_CONVERSION) { try { QFrame *frame=nullptr; QStringList encodings; Ui_ConversionWidget::setupUi(this); conv_func_sel=nullptr; conv_func_sel=new ObjectSelectorWidget(OBJ_FUNCTION, true, this); convcod_grid->addWidget(conv_func_sel,1,1,1,3); setRequiredField(src_encoding_lbl); setRequiredField(trg_encoding_lbl); setRequiredField(conv_func_lbl); setRequiredField(conv_func_sel); configureFormLayout(convcod_grid, OBJ_CONVERSION); frame=generateInformationFrame(trUtf8("The function to be assigned to an encoding conversion must have the following signature: <em>void function(integer, integer, cstring, internal, integer)</em>.")); convcod_grid->addWidget(frame, convcod_grid->count()+1, 0, 1, 0); frame->setParent(this); EncodingType::getTypes(encodings); src_encoding_cmb->addItems(encodings); trg_encoding_cmb->addItems(encodings); connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); parent_form->setMinimumSize(600, 360); parent_form->setMaximumHeight(360); configureTabOrder({ src_encoding_cmb, trg_encoding_cmb, conv_func_sel }); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
RuleWidget::RuleWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_RULE) { try { QStringList list; QFrame *frame=nullptr; Ui_RuleWidget::setupUi(this); cond_expr_hl=new SyntaxHighlighter(cond_expr_txt, false); cond_expr_hl->loadConfiguration(GlobalAttributes::CONFIGURATIONS_DIR + GlobalAttributes::DIR_SEPARATOR + GlobalAttributes::SQL_HIGHLIGHT_CONF + GlobalAttributes::CONFIGURATION_EXT); command_hl=new SyntaxHighlighter(comando_txt, false); command_hl->loadConfiguration(GlobalAttributes::CONFIGURATIONS_DIR + GlobalAttributes::DIR_SEPARATOR + GlobalAttributes::SQL_HIGHLIGHT_CONF + GlobalAttributes::CONFIGURATION_EXT); commands_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS, true, this); commands_tab->setHeaderLabel(trUtf8("SQL command"),0); commands_tab->setHeaderIcon(QPixmap(":/icones/icones/codigosql.png"),0); dynamic_cast<QGridLayout *>(commands_gb->layout())->addWidget(commands_tab, 1, 0, 1, 2); frame=generateInformationFrame(trUtf8("To create a rule that does not perform any action (<strong>DO NOTHING</strong>) simply do not specify commands in the SQL commands table.")); rule_grid->addWidget(frame, rule_grid->count()+1, 0, 1, 0); frame->setParent(this); configureFormLayout(rule_grid, OBJ_RULE); parent_form->setMinimumSize(550, 520); EventType::getTypes(list); event_cmb->addItems(list); ExecutionType::getTypes(list); exec_type_cmb->addItems(list); connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); connect(commands_tab, SIGNAL(s_rowAdded(int)), this, SLOT(handleCommand(int))); connect(commands_tab, SIGNAL(s_rowUpdated(int)), this, SLOT(handleCommand(int))); connect(commands_tab, SIGNAL(s_rowEdited(int)), this, SLOT(editCommand(int))); setRequiredField(event_lbl); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
AggregateWidget::AggregateWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_AGGREGATE) { try { QGridLayout *grid=nullptr; Ui_AggregateWidget::setupUi(this); QSpacerItem *spacer=nullptr; QFrame *frame=nullptr; initial_cond_hl=new SyntaxHighlighter(initial_cond_txt); initial_cond_hl->loadConfiguration(GlobalAttributes::SQL_HIGHLIGHT_CONF_PATH); final_func_sel=new ObjectSelectorWidget(OBJ_FUNCTION, true, this); transition_func_sel=new ObjectSelectorWidget(OBJ_FUNCTION, true, this); sort_op_sel=new ObjectSelectorWidget(OBJ_OPERATOR, true, this); input_type=new PgSQLTypeWidget(this, trUtf8("Input Data Type")); state_type=new PgSQLTypeWidget(this, trUtf8("State Data Type")); input_types_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^ ObjectTableWidget::EDIT_BUTTON, true, this); input_types_tab->setColumnCount(1); funcaoagregacao_grid->addWidget(final_func_sel,0,1,1,1); funcaoagregacao_grid->addWidget(transition_func_sel,1,1,1,1); funcaoagregacao_grid->addWidget(sort_op_sel,2,1,1,1); grid=new QGridLayout; grid->setContentsMargins(2,2,2,2); grid->addWidget(input_type,0,0); grid->addWidget(input_types_tab,1,0); state_input_types_twg->widget(0)->setLayout(grid); grid=new QGridLayout; spacer=new QSpacerItem(20, 1, QSizePolicy::Minimum, QSizePolicy::Expanding); grid->setContentsMargins(2,2,2,2); grid->addWidget(state_type,0,0); grid->addItem(spacer,1,0); state_input_types_twg->widget(1)->setLayout(grid); frame=generateInformationFrame(trUtf8("An aggregate function that accepts the types <em><strong>typeA</strong></em> and <em><strong>typeB</strong></em> as input types and which type of state is <em><strong>state_type</strong></em>, must obey the following rules: <br/><br/> <strong> • Final Function:</strong> <em>void final_function(<strong>state_type</strong>)</em><br/> <strong> • Transition Function:</strong> <em><strong>state_type</strong> transition_function(<strong>state_type</strong>, <strong>typeA</strong>, <strong>typeB</strong>)</em>")); funcaoagregacao_grid->addWidget(frame, funcaoagregacao_grid->count()+1, 0, 1, 2); frame->setParent(this); configureFormLayout(funcaoagregacao_grid, OBJ_AGGREGATE); parent_form->setMinimumSize(645, 750); connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); connect(input_types_tab, SIGNAL(s_rowAdded(int)), this, SLOT(handleDataType(int))); connect(input_types_tab, SIGNAL(s_rowUpdated(int)), this, SLOT(handleDataType(int))); setRequiredField(state_type); setRequiredField(input_type); setRequiredField(transition_func_sel); setRequiredField(transition_func_lbl); configureTabOrder({ final_func_sel, transition_func_sel, sort_op_sel }); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
FunctionWidget::FunctionWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_FUNCTION) { try { QStringList types; QGridLayout *grid=nullptr, *grid1=nullptr; QVBoxLayout *vlayout=nullptr; QSpacerItem *spacer=nullptr; map<QString, vector<QWidget *> > fields_map; map<QWidget *, vector<QString> > value_map; QFrame *frame=nullptr; Ui_FunctionWidget::setupUi(this); configureFormLayout(function_grid, OBJ_FUNCTION); connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); source_code_hl=new SyntaxHighlighter(source_code_txt, false); source_code_cp=new CodeCompletionWidget(source_code_txt); ret_type=new PgSQLTypeWidget(this); vlayout=new QVBoxLayout; spacer=new QSpacerItem(5,5,QSizePolicy::Preferred,QSizePolicy::Expanding); vlayout->addWidget(ret_type); vlayout->addSpacerItem(spacer); return_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^ ObjectTableWidget::UPDATE_BUTTON, true, this); return_tab->setColumnCount(2); return_tab->setHeaderLabel(trUtf8("Column"), 0); return_tab->setHeaderIcon(QPixmap(":/icones/icones/column.png"),0); return_tab->setHeaderLabel(trUtf8("Type"), 1); return_tab->setHeaderIcon(QPixmap(":/icones/icones/usertype.png"),1); parameters_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^ ObjectTableWidget::UPDATE_BUTTON, true, this); parameters_tab->setColumnCount(4); parameters_tab->setHeaderLabel(trUtf8("Name"),0); parameters_tab->setHeaderIcon(QPixmap(":/icones/icones/parameter.png"),0); parameters_tab->setHeaderLabel(trUtf8("Type"),1); parameters_tab->setHeaderIcon(QPixmap(":/icones/icones/usertype.png"),1); parameters_tab->setHeaderLabel(trUtf8("Mode"),2); parameters_tab->setHeaderLabel(trUtf8("Default Value"),3); grid=new QGridLayout; grid->addWidget(parameters_tab,0,0,1,1); grid->setContentsMargins(4,4,4,4); func_config_twg->widget(1)->setLayout(grid); grid=dynamic_cast<QGridLayout *>(func_config_twg->widget(0)->layout()); grid->addLayout(vlayout, grid->count(), 0, 1, 5); grid->addWidget(ret_table_gb, grid->count()-1, 0, 1, 5); grid1=new QGridLayout; grid1->addWidget(return_tab, 0, 0, 1, 1); grid1->setContentsMargins(2,2,2,2); ret_table_gb->setLayout(grid1); ret_table_gb->setVisible(false); fields_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_92)].push_back(leakproof_chk); frame=generateVersionWarningFrame(fields_map, &value_map); grid->addWidget(frame, grid->count()+1, 0, 1, 5); frame->setParent(func_config_twg->widget(0)); parent_form->setMinimumSize(645, 675); SecurityType::getTypes(types); security_cmb->addItems(types); FunctionType::getTypes(types); func_type_cmb->addItems(types); BehaviorType::getTypes(types); behavior_cmb->addItems(types); connect(simple_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void))); connect(set_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void))); connect(table_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void))); connect(language_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(selectLanguage(void))); connect(parameters_tab, SIGNAL(s_rowAdded(int)), this, SLOT(showParameterForm())); connect(parameters_tab, SIGNAL(s_rowEdited(int)), this, SLOT(showParameterForm())); connect(return_tab, SIGNAL(s_rowAdded(int)), this, SLOT(showParameterForm())); connect(return_tab, SIGNAL(s_rowEdited(int)), this, SLOT(showParameterForm())); setRequiredField(language_lbl); setRequiredField(ret_method_lbl); setRequiredField(symbol_lbl); setRequiredField(library_lbl); setRequiredField(sourc_code_lbl); configureTabOrder(); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
TypeWidget::TypeWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_TYPE) { try { QGridLayout *grid=nullptr; QFrame *frame=nullptr; QStringList list; unsigned i,i1; Ui_TypeWidget::setupUi(this); configureFormLayout(type_grid, OBJ_TYPE); like_type=new PgSQLTypeWidget(this, trUtf8("Like Type")); element_type=new PgSQLTypeWidget(this, trUtf8("Element Type")); range_subtype=new PgSQLTypeWidget(this, trUtf8("Subtype")); grid=dynamic_cast<QGridLayout *>(base_attribs_twg->widget(1)->layout()); grid->addWidget(like_type,6,0,1,0); grid->addWidget(element_type,7,0,1,0); grid->addItem(new QSpacerItem(20, 1, QSizePolicy::Minimum, QSizePolicy::Expanding),8,0); grid=dynamic_cast<QGridLayout *>(base_attribs_twg->widget(0)->layout()); for(i=Type::INPUT_FUNC; i <= Type::ANALYZE_FUNC; i++) { functions_sel[i]=nullptr; functions_sel[i]=new ObjectSelectorWidget(OBJ_FUNCTION, true, this); grid->addWidget(functions_sel[i],i,1,1,1); } enumerations_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^ (ObjectTableWidget::EDIT_BUTTON | ObjectTableWidget::DUPLICATE_BUTTON), true, this); grid=dynamic_cast<QGridLayout *>(enumerations_gb->layout()); grid->addWidget(enumerations_tab,1,0,1,2); enumerations_gb->setVisible(false); attributes_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^ ObjectTableWidget::DUPLICATE_BUTTON, true, this); attributes_tab->setColumnCount(3); attributes_tab->setHeaderLabel(trUtf8("Name"),0); attributes_tab->setHeaderIcon(QPixmap(PgModelerUiNS::getIconPath("uid")),0); attributes_tab->setHeaderLabel(trUtf8("Type"),1); attributes_tab->setHeaderIcon(QPixmap(PgModelerUiNS::getIconPath("usertype")),1); attributes_tab->setHeaderLabel(trUtf8("Collation"),2); attributes_tab->setHeaderIcon(QPixmap(PgModelerUiNS::getIconPath("collation")),2); grid=dynamic_cast<QGridLayout *>(attributes_gb->layout()); attrib_collation_sel=new ObjectSelectorWidget(OBJ_COLLATION, true, this); grid->addWidget(attrib_collation_sel, 1,1,1,2); attrib_type_wgt=new PgSQLTypeWidget(this); grid->addWidget(attrib_type_wgt,2,0,1,2); grid->addWidget(attributes_tab,3,0,1,2); attributes_gb->setVisible(false); grid=dynamic_cast<QGridLayout *>(base_attribs_twg->widget(0)->layout()); frame=generateInformationFrame(trUtf8("The functions to be assigned to a type should be written in C language and possess, respectively, the following signatures:<br/> <table> <tr> <td><strong>INPUT:</strong> <em>any function(cstring, oid, integer)</em></td> <td><strong>OUTPUT:</strong> <em>cstring function(any)</em></td> </tr> <tr> <td><strong>SEND:</strong> <em>byta function(any)</em></td> <td><strong>RECV:</strong> <em>any function(internal, oid, integer)</em></td> </tr> <tr> <td><strong>TPMOD_IN:</strong> <em>integer function(cstring[])</em></td> <td><strong>TPMOD_OUT:</strong> <em>cstring function(integer)</em></td> </tr> <tr> <td><strong>ANALYZE:</strong> <em>boolean function(internal)</em></td> <tr> </table>")); grid->addItem(new QSpacerItem(20, 1, QSizePolicy::Minimum, QSizePolicy::Expanding), grid->count()+1,0); grid->addWidget(frame, grid->count()+1, 0, 1, 0); frame->setParent(base_attribs_twg->widget(0)); grid=dynamic_cast<QGridLayout *>(range_attribs_gb->layout()); opclass_sel=new ObjectSelectorWidget(OBJ_OPCLASS, true, this); grid->addWidget(opclass_sel,0,1,1,1); for(i1=1, i=Type::CANONICAL_FUNC; i <= Type::SUBTYPE_DIFF_FUNC; i++,i1++) { functions_sel[i]=nullptr; functions_sel[i]=new ObjectSelectorWidget(OBJ_FUNCTION, true, this); grid->addWidget(functions_sel[i],i1,1,1,1); } grid->addWidget(range_subtype,3,0,1,2); frame=generateInformationFrame(trUtf8("The functions to be assigned to a range type should have the following signatures:<br/><br/><strong>Canonical:</strong> <em>any function(any)</em> <br/><strong>Subtype Diff:</strong> <em>double precision function(subtype, subtype)</em>")); grid->addItem(new QSpacerItem(20, 1, QSizePolicy::Minimum, QSizePolicy::Expanding),4,0); grid->addWidget(frame, 5, 0, 1, 0); range_attribs_gb->setVisible(false); //connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); connect(base_type_rb, SIGNAL(toggled(bool)), this, SLOT(selectTypeConfiguration(void))); connect(composite_rb, SIGNAL(toggled(bool)), this, SLOT(selectTypeConfiguration(void))); connect(enumeration_rb, SIGNAL(toggled(bool)), this, SLOT(selectTypeConfiguration(void))); connect(enumerations_tab, SIGNAL(s_rowAdded(int)), this, SLOT(handleEnumeration(int))); connect(enumerations_tab, SIGNAL(s_rowUpdated(int)), this, SLOT(handleEnumeration(int))); connect(attributes_tab, SIGNAL(s_rowAdded(int)), this, SLOT(handleAttribute(int))); connect(attributes_tab, SIGNAL(s_rowUpdated(int)), this, SLOT(handleAttribute(int))); connect(attributes_tab, SIGNAL(s_rowEdited(int)), this, SLOT(editAttribute(int))); StorageType::getTypes(list); storage_cmb->addItems(list); CategoryType::getTypes(list); category_cmb->addItems(list); setRequiredField(range_subtype); setRequiredField(input_lbl); setRequiredField(output_lbl); setRequiredField(functions_sel[Type::INPUT_FUNC]); setRequiredField(functions_sel[Type::OUTPUT_FUNC]); setRequiredField(enumerations_gb); setRequiredField(attributes_gb); configureTabOrder({base_type_rb, enumeration_rb, composite_rb, range_rb, enum_name_edt, attrib_name_edt, attrib_collation_sel, attrib_type_wgt, opclass_sel, functions_sel[Type::CANONICAL_FUNC], functions_sel[Type::SUBTYPE_DIFF_FUNC], base_attribs_twg}); setMinimumSize(620, 750); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
OperatorClassWidget::OperatorClassWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_OPCLASS) { try { QStringList tipos; QGridLayout *grid=nullptr; Ui_OperatorClassWidget::setupUi(this); family_sel=new ObjectSelectorWidget(OBJ_OPFAMILY, false, this); data_type=new PgSQLTypeWidget(this); operator_sel=new ObjectSelectorWidget(OBJ_OPERATOR, true, this); elem_family_sel=new ObjectSelectorWidget(OBJ_OPFAMILY, true, this); function_sel=new ObjectSelectorWidget(OBJ_FUNCTION, true, this); storage_type=new PgSQLTypeWidget(this, trUtf8("Storage Type")); elements_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS, true, this); elements_tab->setColumnCount(4); elements_tab->setHeaderLabel(trUtf8("Object"),0); elements_tab->setHeaderIcon(QPixmap(QString(":/icones/icones/table.png")),0); elements_tab->setHeaderLabel(trUtf8("Type"),1); elements_tab->setHeaderIcon(QPixmap(QString(":/icones/icones/usertype.png")),1); elements_tab->setHeaderLabel(trUtf8("Support/Strategy"),2); elements_tab->setHeaderLabel(trUtf8("Operator Family"),3); grid=new QGridLayout; grid->setContentsMargins(0,0,0,0); grid->addWidget(def_class_lbl,0,2,1,1); grid->addWidget(def_class_chk,0,3,1,1); grid->addWidget(indexing_lbl,0,0,1,1); grid->addWidget(indexing_cmb,0,1,1,1); grid->addWidget(family_lbl,2,0,1,1); grid->addWidget(family_sel,2,1,1,4); grid->addWidget(data_type,4,0,1,5); grid->addWidget(elements_grp,5,0,1,5); this->setLayout(grid); configureFormLayout(grid, OBJ_OPCLASS); grid=dynamic_cast<QGridLayout *>(elements_grp->layout()); grid->addWidget(function_sel, 1,1,1,4); grid->addWidget(operator_sel, 2,1,1,4); grid->addWidget(elem_family_sel, 3,1,1,4); grid->addWidget(storage_type, 5,0,1,5); grid->addWidget(elements_tab, 6,0,1,4); connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); connect(elem_type_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(selectElementType(int))); connect(elements_tab, SIGNAL(s_rowAdded(int)), this, SLOT(handleElement(int))); connect(elements_tab, SIGNAL(s_rowUpdated(int)), this, SLOT(handleElement(int))); connect(elements_tab, SIGNAL(s_rowEdited(int)), this, SLOT(editElement(int))); parent_form->setMinimumSize(620, 640); selectElementType(0); IndexingType::getTypes(tipos); indexing_cmb->addItems(tipos); setRequiredField(elements_grp); configureTabOrder({ indexing_cmb, def_class_chk , family_sel, data_type, elem_type_cmb, operator_sel, elem_family_sel, function_sel, stg_num_sb, storage_type }); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
OperatorWidget::OperatorWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_OPERATOR) { try { QGridLayout *grid=nullptr; unsigned i, i1; map<QString, vector<QWidget *> > field_map; QFrame *frame=nullptr; Ui_OperatorWidget::setupUi(this); arg_types[0]=nullptr; arg_types[0]=new PgSQLTypeWidget(this, trUtf8("Left Argument Type")); arg_types[1]=nullptr; arg_types[1]=new PgSQLTypeWidget(this, trUtf8("Right Argument Type")); grid=new QGridLayout; grid->setContentsMargins(4,4,4,4); grid->addWidget(arg_types[0],0,0); grid->addWidget(arg_types[1],1,0); frame=generateInformationFrame(trUtf8("To create a unary operator it is necessary to specify as <strong><em>'any'</em></strong> one of its arguments. Additionally, the function that defines the operator must have only one parameter and this, in turn, must have the same data type of the the argument of unary operator.")); grid->addWidget(frame, 2, 0); attributes_twg->widget(0)->setLayout(grid); grid=dynamic_cast<QGridLayout *>(attributes_twg->widget(1)->layout()); for(i=Operator::FUNC_OPERATOR; i <= Operator::FUNC_RESTRICT; i++) { functions_sel[i]=nullptr; functions_sel[i]=new ObjectSelectorWidget(OBJ_FUNCTION, true, this); if(i!=Operator::FUNC_OPERATOR) grid->addWidget(functions_sel[i],i,1,1,1); } //grid=dynamic_cast<QGridLayout *>(attributes_twg->widget(2)->layout()); for(i=Operator::OPER_COMMUTATOR, i1=3; i <= Operator::OPER_NEGATOR; i++,i1++) { operators_sel[i]=nullptr; operators_sel[i]=new ObjectSelectorWidget(OBJ_OPERATOR, true, this); grid->addWidget(operators_sel[i],i1,1,1,1); } operator_grid->addWidget(functions_sel[0],0,1,1,3); /*field_map[generateVersionsInterval(UNTIL_VERSION, SchemaParser::PGSQL_VERSION_82)].push_back(sort1_op_lbl); field_map[generateVersionsInterval(UNTIL_VERSION, SchemaParser::PGSQL_VERSION_82)].push_back(sort2_op_lbl); field_map[generateVersionsInterval(UNTIL_VERSION, SchemaParser::PGSQL_VERSION_82)].push_back(lessthan_op_lbl); field_map[generateVersionsInterval(UNTIL_VERSION, SchemaParser::PGSQL_VERSION_82)].push_back(greaterthan_op_lbl); frame=generateVersionWarningFrame(field_map); grid->addWidget(frame, grid->count()+1, 0, 1, 0); frame->setParent(attributes_twg->widget(2)); */ configureFormLayout(operator_grid, OBJ_OPERATOR); connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void))); parent_form->resize(530, 590); parent_form->setMinimumWidth(530); parent_form->setMinimumHeight(590); setRequiredField(operator_func_lbl); setRequiredField(functions_sel[0]); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }