@@ -92,6 +92,7 @@ editor_(editor), name_(name), subnetModuleId_(subnetModuleId)
9292 WidgetStyleMixin::toolbarStyle (subnetBar);
9393 subnetBar->setObjectName (" SubnetToolbar" );
9494 SCIRunMainWindow::Instance ()->addNetworkActionsToBar (subnetBar);
95+ subnetBar->setIconSize (QSize (20 , 20 ));
9596 vbox->setMenuBar (subnetBar);
9697
9798 saveAsTemplatePushButton_->hide ();
@@ -230,20 +231,18 @@ void NetworkEditor::setupPortHolder(const std::vector<SharedPointer<PortDescript
230231 int offset = 12 ;
231232 for (const auto & port : ports)
232233 {
234+ SubnetPortWidgetCtorArgs args { QString::fromStdString (port->get_portname ()),
235+ to_color (PortColorLookup::toColor (port->get_typename ()), 230 ), port->get_typename (),
236+ [this ](){ return boost::make_shared<ConnectionFactory>([this ]() { return scene_; }); },
237+ [this ](){ return boost::make_shared<ClosestPortFinder>([this ]() { return scene_; }); },
238+ port.get ()};
239+
233240 PortWidget* portRepl;
234- if (name == " Outputs" )
235- portRepl = new SubnetInputPortWidget (QString::fromStdString (port->get_portname ()),
236- to_color (PortColorLookup::toColor (port->get_typename ()), 230 ), port->get_typename (),
237- [this ](){ return boost::make_shared<ConnectionFactory>([this ]() { return scene_; }); },
238- [this ](){ return boost::make_shared<ClosestPortFinder>([this ]() { return scene_; }); },
239- port.get ());
241+ if (name == " Outputs" ) // flip input and output designation here.
242+ portRepl = new SubnetInputPortWidget (args);
240243 else // Inputs
241- portRepl = new SubnetOutputPortWidget (QString::fromStdString (port->get_portname ()),
242- to_color (PortColorLookup::toColor (port->get_typename ()), 230 ), port->get_typename (),
243- [this ](){ return boost::make_shared<ConnectionFactory>([this ]() { return scene_; }); },
244- [this ](){ return boost::make_shared<ClosestPortFinder>([this ]() { return scene_; }); },
245- port.get ()
246- );
244+ portRepl = new SubnetOutputPortWidget (args);
245+
247246 layout->addWidget (portRepl);
248247 portRepl->setSceneFunc ([this ]() { return scene_; });
249248 portRepl->setPositionObject (boost::make_shared<LambdaPositionProvider>([proxy, offset]() { return proxy->pos () + QPointF (offset, 0 ); }));
@@ -264,24 +263,15 @@ void NetworkEditor::setupPortHolder(const std::vector<SharedPointer<PortDescript
264263 proxy->setPos (position (visibleRect ()));
265264}
266265
267- SubnetInputPortWidget::SubnetInputPortWidget (const QString& name, const QColor& color, const std::string& datatype,
268- boost::function<boost::shared_ptr<ConnectionFactory>()> connectionFactory,
269- boost::function<boost::shared_ptr<ClosestPortFinder>()> closestPortFinder,
270- PortDescriptionInterface* realPort,
271- QWidget* parent)
272- : InputPortWidget(name, color, datatype, ModuleId(), PortId(), 0, true, connectionFactory, closestPortFinder, {}, parent), realPort_(realPort)
273-
266+ SubnetInputPortWidget::SubnetInputPortWidget (const SubnetPortWidgetCtorArgs& args, QWidget* parent)
267+ : InputPortWidget(args.name, args.color, args.datatype, {}, PortId(), 0, true, args.connectionFactory, args.closestPortFinder, {}, parent), realPort_(args.realPort)
274268{
275269
276270}
277271
278272
279- SubnetOutputPortWidget::SubnetOutputPortWidget (const QString& name, const QColor& color, const std::string& datatype,
280- boost::function<boost::shared_ptr<ConnectionFactory>()> connectionFactory,
281- boost::function<boost::shared_ptr<ClosestPortFinder>()> closestPortFinder,
282- PortDescriptionInterface* realPort,
283- QWidget* parent)
284- : OutputPortWidget(name, color, datatype, ModuleId(), PortId(), 0, true, connectionFactory, closestPortFinder, {}, parent), realPort_(realPort)
273+ SubnetOutputPortWidget::SubnetOutputPortWidget (const SubnetPortWidgetCtorArgs& args, QWidget* parent)
274+ : OutputPortWidget(args.name, args.color, args.datatype, {}, PortId(), 0, true, args.connectionFactory, args.closestPortFinder, {}, parent), realPort_(args.realPort)
285275{
286276
287277}
0 commit comments