Skip to content

Commit 525f328

Browse files
committed
Clean up
1 parent b6e7ee1 commit 525f328

File tree

7 files changed

+14
-66
lines changed

7 files changed

+14
-66
lines changed

src/Dataflow/Engine/Controller/NetworkEditorController.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,6 @@ ModuleHandle NetworkEditorController::connectNewModule(const PortDescriptionInte
296296
if (p->get_typename() == portToConnect->get_typename())
297297
{
298298
requestConnection(p.get(), portToConnect);
299-
if (portToConnectUponInsertion)
300-
{
301-
std::cout << "I CAN REQUEST ANOTHER CONNECTION HERE: first port is input, second is " << portToConnectUponInsertion->isInput() << std::endl;
302-
}
303299
return newMod;
304300
}
305301
}
@@ -313,12 +309,10 @@ ModuleHandle NetworkEditorController::connectNewModule(const PortDescriptionInte
313309
requestConnection(p.get(), portToConnect);
314310
if (portToConnectUponInsertion)
315311
{
316-
std::cout << "I CAN REQUEST ANOTHER CONNECTION HERE: first port is output, second is " << portToConnectUponInsertion->isInput() << std::endl;
317312
auto oports = newMod->outputPorts();
318313
auto fromPort = std::find_if(oports.begin(), oports.end(), [portToConnectUponInsertion](OutputPortHandle out) { return out->get_typename() == portToConnectUponInsertion->get_typename(); });
319314
if (fromPort != oports.end())
320315
{
321-
//removeConnection(*portToConnectUponInsertion->firstConnectionId());
322316
requestConnection(fromPort->get(), portToConnectUponInsertion);
323317
}
324318
}

src/Interface/Application/Connection.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ void ConnectionLine::destroyConnection()
318318
drawer_.reset();
319319
Q_EMIT deleted(id_);
320320
//GuiLogger::Instance().log("Connection deleted.");
321-
qDebug() << "Connection deleted.";
322321
HasNotes::destroy();
323322
NoteDisplayHelper::destroy();
324323
destroyed_ = true;

src/Interface/Application/GuiCommands.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ const char* SCIRun::Gui::addNewModuleActionTypePropertyName()
176176
return "connectNewModuleSource";
177177
}
178178

179+
const char* SCIRun::Gui::insertNewModuleActionTypePropertyName()
180+
{
181+
return "inputPortToConnectPid";
182+
}
183+
179184
namespace std
180185
{
181186
template <typename T1, typename T2>

src/Interface/Application/ModuleWidget.cc

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,35 +1312,8 @@ void ModuleWidget::duplicate()
13121312

13131313
void ModuleWidget::connectNewModule(const PortDescriptionInterface* portToConnect, const std::string& newModuleName)
13141314
{
1315-
auto prop = sender()->property(addNewModuleActionTypePropertyName());
1316-
qDebug() << sender();
1317-
qDebug() << "ModuleWidget SENDER PROPERTY:" << prop;
1318-
if (prop.value<QString>() == "addNew")
1319-
{
1320-
qDebug() << "Action is done.";
1321-
}
1322-
else
1323-
{
1324-
qDebug() << "Action is not done, need to change a connection.";
1325-
}
1326-
setProperty(addNewModuleActionTypePropertyName(), prop);
1327-
1328-
qDebug() << "PORT CONNS:" << portToConnect->nconnections();
1329-
1330-
auto q = dynamic_cast<const PortWidget*>(portToConnect);
1331-
if (q)
1332-
{
1333-
for (size_t i = 0; i < q->nconnections(); ++i)
1334-
{
1335-
auto cpi = q->connectedPorts()[i];
1336-
qDebug() << QString::fromStdString(cpi->id().toString());
1337-
}
1338-
}
1339-
1340-
qDebug() << "port to connect to:" << sender()->property("inputPortToConnectPid");
1341-
qDebug() << "port to connect to:" << sender()->property("inputPortToConnectMid");
1342-
setProperty("inputPortToConnectPid", sender()->property("inputPortToConnectPid"));
1343-
setProperty("inputPortToConnectMid", sender()->property("inputPortToConnectMid"));
1315+
setProperty(addNewModuleActionTypePropertyName(), sender()->property(addNewModuleActionTypePropertyName()));
1316+
setProperty(insertNewModuleActionTypePropertyName(), sender()->property(insertNewModuleActionTypePropertyName()));
13441317

13451318
Q_EMIT connectNewModule(theModule_, portToConnect, newModuleName);
13461319
}

src/Interface/Application/NetworkEditor.cc

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -214,39 +214,28 @@ void NetworkEditor::duplicateModule(const ModuleHandle& module)
214214
void NetworkEditor::connectNewModule(const ModuleHandle& moduleToConnectTo, const PortDescriptionInterface* portToConnect, const std::string& newModuleName)
215215
{
216216
auto prop = sender()->property(addNewModuleActionTypePropertyName());
217-
qDebug() << sender();
218-
qDebug() << "NetworkEditor SENDER PROPERTY:" << prop;
219-
qDebug() << sender()->property("inputPortToConnectPid");
220217

221218
auto widget = findById(scene_->items(), moduleToConnectTo->get_id());
222219
QPointF increment(0, portToConnect->isInput() ? -110 : 110);
223220
lastModulePosition_ = widget->scenePos() + increment;
224221

225-
qDebug() << "PORT CONNS:" << portToConnect->nconnections();
226-
227222
PortWidget* newConnectionInputPort = nullptr;
228223
auto q = dynamic_cast<const PortWidget*>(portToConnect);
229224
if (q)
230225
{
231226
for (size_t i = 0; i < q->nconnections(); ++i)
232227
{
233228
auto cpi = q->connectedPorts()[i];
234-
qDebug() << QString::fromStdString(cpi->id().toString());
235-
if (QString::fromStdString(cpi->id().toString()) == sender()->property("inputPortToConnectPid"))
229+
if (QString::fromStdString(cpi->id().toString()) == sender()->property(insertNewModuleActionTypePropertyName()))
236230
newConnectionInputPort = cpi;
237231
}
238232
}
239233

240234
if (newConnectionInputPort)
241235
{
242-
qDebug() << "found port object to connect up with:" << newConnectionInputPort;
243236
controller_->removeConnection(*newConnectionInputPort->firstConnectionId());
244237
newConnectionInputPort->deleteConnectionsLater();
245238
}
246-
else
247-
{
248-
qDebug() << "Didn't find port object to connect up with, or this is just adding a new module, not inserting.";
249-
}
250239

251240
controller_->connectNewModule(portToConnect, newModuleName, newConnectionInputPort);
252241
}
@@ -321,7 +310,7 @@ namespace
321310

322311
void NetworkEditor::setupModuleWidget(ModuleWidget* module)
323312
{
324-
ModuleProxyWidget* proxy = new ModuleProxyWidget(module);
313+
auto proxy = new ModuleProxyWidget(module);
325314

326315
connect(module, SIGNAL(removeModule(const SCIRun::Dataflow::Networks::ModuleId&)), controller_.get(), SLOT(removeModule(const SCIRun::Dataflow::Networks::ModuleId&)));
327316
connect(module, SIGNAL(interrupt(const SCIRun::Dataflow::Networks::ModuleId&)), controller_.get(), SLOT(interrupt(const SCIRun::Dataflow::Networks::ModuleId&)));
@@ -361,18 +350,11 @@ void NetworkEditor::setupModuleWidget(ModuleWidget* module)
361350

362351
proxy->setZValue(zLevelManager_->get_max());
363352

364-
if (!insertingNewModuleAlongConnection_)
365-
{
366-
while (!scene_->items(lastModulePosition_.x() - 20, lastModulePosition_.y() - 20, 40, 40).isEmpty())
367-
{
368-
lastModulePosition_ += QPointF(20, -20);
369-
}
370-
proxy->setPos(lastModulePosition_);
371-
}
372-
else
353+
while (!scene_->items(lastModulePosition_.x() - 20, lastModulePosition_.y() - 20, 40, 40).isEmpty())
373354
{
374-
//TODO: find midpoint of two connected modules, set position there
355+
lastModulePosition_ += QPointF(20, -20);
375356
}
357+
proxy->setPos(lastModulePosition_);
376358

377359
proxy->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges);
378360
connect(scene_, SIGNAL(selectionChanged()), proxy, SLOT(highlightIfSelected()));

src/Interface/Application/Port.cc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -614,20 +614,14 @@ void PortWidget::connectNewModule()
614614
{
615615
auto action = qobject_cast<QAction*>(sender());
616616
auto moduleToAddName = action->text();
617-
qDebug() << "OLD SLOT:" << sender();
618-
qDebug() << "PortWidget SENDER PROPERTY:" << action->property(addNewModuleActionTypePropertyName());
619617
setProperty(addNewModuleActionTypePropertyName(), action->property(addNewModuleActionTypePropertyName()));
620618
Q_EMIT connectNewModule(this, moduleToAddName.toStdString());
621619
}
622620

623621
void PortWidget::insertNewModule(const PortDescriptionInterface* output, const std::string& newModuleName, const PortDescriptionInterface* input)
624622
{
625-
qDebug() << "NEW SLOT:" << sender();
626-
//auto action = qobject_cast<QAction*>(sender());
627-
qDebug() << "PortWidget SENDER PROPERTY:" << sender()->property(addNewModuleActionTypePropertyName());
628623
setProperty(addNewModuleActionTypePropertyName(), sender()->property(addNewModuleActionTypePropertyName()));
629-
setProperty("inputPortToConnectPid", QString::fromStdString(input->id().toString()));
630-
setProperty("inputPortToConnectMid", QString::fromStdString(input->getUnderlyingModuleId().id_));
624+
setProperty(insertNewModuleActionTypePropertyName(), QString::fromStdString(input->id().toString()));
631625

632626
Q_EMIT connectNewModule(output, newModuleName);
633627
}

src/Interface/Application/Utility.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ namespace Gui
7979
QPointF findCenterOfNetwork(const Dataflow::Networks::ModulePositions& positions);
8080

8181
const char* addNewModuleActionTypePropertyName();
82+
const char* insertNewModuleActionTypePropertyName();
8283
}
8384

8485
}

0 commit comments

Comments
 (0)