void TransformsGui::addWidget(TransformWidget *transformWidget) { if (!transformWidgetList.isEmpty()) { // only if there is already another TransformWidget TransformWidget *previousTw = transformWidgetList.last(); connect(previousTw,SIGNAL(updated()),transformWidget,SLOT(updatingFrom())); } transformWidgetList.append(transformWidget); // updating the list // Adding the widget to the gui ui->scrollAreaWidgetContents->layout()->addWidget(transformWidget); connect(transformWidget, SIGNAL(error(QString,QString)),logger, SLOT(logError(QString,QString))); connect(transformWidget, SIGNAL(warning(QString,QString)),logger, SLOT(logWarning(QString,QString))); connect(transformWidget, SIGNAL(status(QString,QString)),logger, SLOT(logStatus(QString,QString))); connect(transformWidget,SIGNAL(transfoRequest(TransformWidget*)),this,SLOT(processNewTransformation(TransformWidget*))); connect(transformWidget,SIGNAL(deletionRequest(TransformWidget*)), this, SLOT(processDeletionRequest(TransformWidget*))); connect(transformWidget, SIGNAL(transformChanged()), this, SLOT(onTransformChanged()),Qt::QueuedConnection); connect(transformWidget, SIGNAL(tryNewName(QString)), this, SLOT(onNameChangeRequest(QString))); emit entriesChanged(); }
TransformWidget::TransformWidget(GuiHelper *nguiHelper ,QWidget *parent) : QWidget(parent) { ui = new(std::nothrow) Ui::TransformWidget(); if (ui == nullptr) { qFatal("Cannot allocate memory for Ui::TransformWidget X{"); } currentTransform = nullptr; infoDialog = nullptr; settingsTab = nullptr; gotoWidget = nullptr; searchWidget = nullptr; folded = false; guiHelper = nguiHelper; transformFactory = guiHelper->getTransformFactory(); manager = guiHelper->getNetworkManager(); logger = guiHelper->getLogger(); byteSource = new(std::nothrow) BasicSource(); if (byteSource == nullptr) { qFatal("Cannot allocate memory for byteSource X{"); } connect(byteSource, SIGNAL(log(QString,QString,Pip3lineConst::LOGLEVEL)), logger, SLOT(logMessage(QString,QString,Pip3lineConst::LOGLEVEL)), Qt::QueuedConnection); connect(byteSource, SIGNAL(updated(quintptr)), this, SLOT(refreshOutput())); connect(byteSource, SIGNAL(nameChanged(QString)), this, SIGNAL(tryNewName(QString))); ui->setupUi(this); buildSelectionArea(); // cannot do that in the buildSelectionArea() function as it is called frequently ui->wayGroupBox->setVisible(false); ui->deleteButton->setEnabled(false); ui->infoPushButton->setEnabled(false); connect(ui->transfoComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onTransformSelected(QString)), Qt::UniqueConnection); ui->activityStackedWidget->setCurrentIndex(1); ui->transfoComboBox->setFocusPolicy( Qt::StrongFocus ); ui->transfoComboBox->installEventFilter(guiHelper) ; configureViewArea(); messagePanel = new(std::nothrow) MessagePanelWidget(this); if (messagePanel == nullptr) { qFatal("Cannot allocate memory for MessagePanelWidget X{"); } ui->mainLayout->insertWidget(0,messagePanel); connect(byteSource, SIGNAL(log(QString,QString,Pip3lineConst::LOGLEVEL)), messagePanel, SLOT(log(QString,QString,Pip3lineConst::LOGLEVEL))); firstView = true; setAcceptDrops(true); connect(transformFactory, SIGNAL(transformsUpdated()),this, SLOT(buildSelectionArea()), Qt::QueuedConnection); connect(guiHelper, SIGNAL(filterChanged()), this, SLOT(buildSelectionArea())); connect(this, SIGNAL(sendRequest(TransformRequest*)), guiHelper->getCentralTransProc(), SLOT(processRequest(TransformRequest*)), Qt::QueuedConnection); connect(ui->deleteButton, SIGNAL(clicked()), SLOT(deleteMe())); connect(ui->foldPushButton, SIGNAL(clicked()), this, SLOT(onFoldRequest())); connect(ui->insertPushButton, SIGNAL(clicked(bool)), this, SIGNAL(insertRequest())); // qDebug() << "Created" << this; }