Skip to content

Commit 4dfe45a

Browse files
committed
Fixes
1 parent fae150f commit 4dfe45a

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

src/Interface/Application/NetworkEditor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ namespace Gui {
413413
void setupPortHolder(const std::vector<SharedPointer<SCIRun::Dataflow::Networks::PortDescriptionInterface>>& ports, const QString& name,
414414
std::function<QPointF(const QRectF&)> position);
415415
PortRewiringMap portRewiringMap_;
416+
QSet<QString> currentSubnetNames_;
416417

417418
static NetworkEditor* inEditingContext_;
418419
struct InEditingContext

src/Interface/Application/Port.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,12 @@ void PortWidget::connectToSubnetPort(PortWidget* subnetPort)
482482
auto in = isInput_ ? this : subnetPort;
483483

484484
ConnectionDescription cd { { out->moduleId_, out->portId_ }, { in->moduleId_, in->portId_ } };
485-
connectionFactory_()->makeFinishedConnection(out, in, ConnectionId::create(cd));
485+
if (connectionFactory_ && connectionFactory_())
486+
connectionFactory_()->makeFinishedConnection(out, in, ConnectionId::create(cd));
487+
else
488+
{
489+
qDebug() << "NO CONNECTION FACTORY AVAILABLE!!";
490+
}
486491
//TODO: position provider needs adjustment
487492
//TODO: management of return value?
488493
}

src/Interface/Application/Subnetworks.cc

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -362,19 +362,25 @@ void NetworkEditor::makeSubnetwork()
362362
}
363363
}
364364

365-
if (underlyingModules.empty())
366-
{
367-
QMessageBox::information(this, "Make subnetwork", "Please select at least one module.");
368-
return;
369-
}
370-
371365
bool ok;
372366
auto name = QInputDialog::getText(nullptr, "Make subnet", "Enter subnet name:", QLineEdit::Normal, "subnet", &ok);
373367
if (!ok || name.isEmpty())
374368
{
375369
QMessageBox::information(this, "Make subnetwork", "Invalid name.");
376370
return;
377371
}
372+
373+
if (currentSubnetNames_.contains(name))
374+
{
375+
QMessageBox::information(this, "Make subnetwork", "A subnet by that name already exists.");
376+
return;
377+
}
378+
379+
if (underlyingModules.empty())
380+
{
381+
QMessageBox::information(this, "Make subnetwork", "Please select at least one module.");
382+
return;
383+
}
378384

379385
makeSubnetworkFromComponents(name, underlyingModules, includeConnections(items), rect);
380386
}
@@ -456,6 +462,8 @@ class SubnetModuleFactory : public Modules::Factory::HardCodedModuleFactory
456462
void NetworkEditor::makeSubnetworkFromComponents(const QString& name, const std::vector<ModuleHandle>& modules,
457463
QList<QGraphicsItem*> items, const QRectF& rect)
458464
{
465+
currentSubnetNames_.insert(name);
466+
459467
SubnetModuleFactory factory;
460468
auto subnetModule = factory.makeSubnet(name, modules, items);
461469
portRewiringMap_ = factory.getMap();
@@ -469,6 +477,7 @@ void NetworkEditor::makeSubnetworkFromComponents(const QString& name, const std:
469477
auto colorize = new QGraphicsDropShadowEffect;
470478
colorize->setColor(QColor(255,182,193,200));
471479
colorize->setOffset(8,8);
480+
colorize->setBlurRadius(10);
472481
proxy->setGraphicsEffect(colorize);
473482

474483
auto pic = grabSubnetPic(rect);
@@ -523,7 +532,7 @@ void NetworkEditor::makeSubnetworkFromComponents(const QString& name, const std:
523532
childrenNetworkItems_[name] = items;
524533

525534
addSubnetChild(name, subnetModule);
526-
qDebug() << "port repl map out of scope";
535+
//qDebug() << "port repl map out of scope";
527536
}
528537

529538
QPixmap NetworkEditor::grabSubnetPic(const QRectF& rect)

0 commit comments

Comments
 (0)