| 701 | } |
| 702 | |
| 703 | void |
| 704 | MultiInstancePanelPrivate::addTableRow(const NodePtr & node) |
| 705 | { |
| 706 | for (Nodes::iterator it = instances.begin(); it != instances.end(); ++it) { |
| 707 | if (it->first.lock() == node) { |
| 708 | return; |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | instances.push_back( std::make_pair(node, false) ); |
| 713 | int newRowIndex = view->rowCount(); |
| 714 | model->insertRow(newRowIndex); |
| 715 | |
| 716 | std::list<KnobPtr > instanceSpecificKnobs; |
| 717 | { |
| 718 | const std::vector<KnobPtr > & instanceKnobs = node->getKnobs(); |
| 719 | for (U32 i = 0; i < instanceKnobs.size(); ++i) { |
| 720 | boost::shared_ptr<KnobSignalSlotHandler> slotsHandler = |
| 721 | instanceKnobs[i]->getSignalSlotHandler(); |
| 722 | if (slotsHandler) { |
| 723 | QObject::connect( slotsHandler.get(), SIGNAL(valueChanged(ViewSpec,int,int)), publicInterface, SLOT(onInstanceKnobValueChanged(ViewSpec,int,int)) ); |
| 724 | } |
| 725 | |
| 726 | if ( instanceKnobs[i]->isInstanceSpecific() ) { |
| 727 | KnobInt* isInt = dynamic_cast<KnobInt*>( instanceKnobs[i].get() ); |
| 728 | KnobBool* isBool = dynamic_cast<KnobBool*>( instanceKnobs[i].get() ); |
| 729 | KnobDouble* isDouble = dynamic_cast<KnobDouble*>( instanceKnobs[i].get() ); |
| 730 | KnobColor* isColor = dynamic_cast<KnobColor*>( instanceKnobs[i].get() ); |
| 731 | KnobString* isString = dynamic_cast<KnobString*>( instanceKnobs[i].get() ); |
| 732 | if (!isInt && !isBool && !isDouble && !isColor && !isString) { |
| 733 | qDebug() << "Multi-instance panel doesn't support the following type of knob: " << instanceKnobs[i]->typeName().c_str(); |
| 734 | continue; |
| 735 | } |
| 736 | |
| 737 | instanceSpecificKnobs.push_back(instanceKnobs[i]); |
| 738 | } |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | |
| 743 | ///first add the enabled column |
| 744 | { |
| 745 | QCheckBox* checkbox = new QCheckBox(); |
| 746 | checkbox->setChecked( !node->isNodeDisabled() ); |
| 747 | QObject::connect( checkbox, SIGNAL(toggled(bool)), publicInterface, SLOT(onCheckBoxChecked(bool)) ); |
| 748 | view->setCellWidget(newRowIndex, COL_ENABLED, checkbox); |
| 749 | TableItem* newItem = new TableItem; |
| 750 | newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable); |
| 751 | view->setItem(newRowIndex, COL_ENABLED, newItem); |
| 752 | view->resizeColumnToContents(COL_ENABLED); |
| 753 | } |
| 754 | |
| 755 | ///Script name |
| 756 | { |
| 757 | TableItem* newItem = new TableItem; |
| 758 | view->setItem(newRowIndex, COL_SCRIPT_NAME, newItem); |
| 759 | newItem->setToolTip( tr("The script-name of the item as exposed to Python scripts") ); |
| 760 | newItem->setText( QString::fromUtf8( node->getScriptName().c_str() ) ); |
no test coverage detected