| 518 | } |
| 519 | |
| 520 | void TOPPASBase::addTOPPASFile(const String& file_name, bool in_new_window) |
| 521 | { |
| 522 | if (file_name.empty()) return; |
| 523 | |
| 524 | if (!file_name.toQString().endsWith(".toppas", Qt::CaseInsensitive)) |
| 525 | { |
| 526 | OPENMS_LOG_ERROR << "The file '" << file_name << "' is not a .toppas file" << std::endl; |
| 527 | return; |
| 528 | } |
| 529 | |
| 530 | recent_files_menu_.add(file_name); |
| 531 | |
| 532 | TOPPASWidget* asw = activeSubWindow_(); |
| 533 | TOPPASScene* scene = nullptr; |
| 534 | if (in_new_window) |
| 535 | { |
| 536 | if (asw) |
| 537 | { |
| 538 | TOPPASWidget* uninitialized_window = window_(asw->getFirstWindowID()); |
| 539 | if (uninitialized_window && !uninitialized_window->getScene()->wasChanged()) |
| 540 | closeByTab(asw->getFirstWindowID()); |
| 541 | } |
| 542 | TOPPASWidget* tw = new TOPPASWidget(Param(), ws_, tmp_path_); |
| 543 | scene = tw->getScene(); |
| 544 | scene->load(file_name); // first load WF, including description etc |
| 545 | showAsWindow_(tw, File::basename(file_name)); // show it |
| 546 | } |
| 547 | else |
| 548 | { |
| 549 | if (!activeSubWindow_()) return; |
| 550 | |
| 551 | TOPPASScene* tmp_scene = new TOPPASScene(nullptr, this->tmp_path_.toQString(), false); |
| 552 | tmp_scene->load(file_name); |
| 553 | scene = activeSubWindow_()->getScene(); |
| 554 | scene->include(tmp_scene); |
| 555 | delete tmp_scene; |
| 556 | } |
| 557 | |
| 558 | //connect signals/slots for log messages |
| 559 | for (TOPPASScene::VertexIterator it = scene->verticesBegin(); it != scene->verticesEnd(); ++it) |
| 560 | { |
| 561 | TOPPASToolVertex* tv = dynamic_cast<TOPPASToolVertex*>(*it); |
| 562 | if (tv) |
| 563 | { |
| 564 | connect(tv, SIGNAL(toolStarted()), this, SLOT(toolStarted())); |
| 565 | connect(tv, SIGNAL(toolFinished()), this, SLOT(toolFinished())); |
| 566 | connect(tv, SIGNAL(toolCrashed()), this, SLOT(toolCrashed())); |
| 567 | connect(tv, SIGNAL(toolFailed()), this, SLOT(toolFailed())); |
| 568 | connect(tv, SIGNAL(toolFailed(const QString &)), this, SLOT(updateTOPPOutputLog(const QString &))); |
| 569 | // already done in ToppasScene: |
| 570 | //connect (tv, SIGNAL(toppOutputReady(const QString&)), this, SLOT(updateTOPPOutputLog(const QString&))); |
| 571 | continue; |
| 572 | } |
| 573 | |
| 574 | TOPPASMergerVertex* tmv = dynamic_cast<TOPPASMergerVertex*>(*it); |
| 575 | if (tmv) |
| 576 | { |
| 577 | connect(tmv, SIGNAL(mergeFailed(const QString)), this, SLOT(updateTOPPOutputLog(const QString &))); |
nothing calls this directly
no test coverage detected