void PlanSimSubpanel::init(vleVpz* vpz, vle::utils::Package* pkg, Logger* log) { mvpz = vpz; mpkg = pkg; mLog = log; onTreeItemSelected(); }
void DefaultSimSubpanel::init(vleVpm* vpm, vle::utils::Package* pkg, Logger* log) { mvpm = vpm; mpkg = pkg; mLog = log; onTreeItemSelected(); }
void PlanSimSubpanel::addPortToPlot(QString view, QString port) { for (unsigned int i = 0; i < portsToPlot.size(); i++) { const portToPlot& p = portsToPlot[i]; if (p.view == view and p.port == port) { return; } } portsToPlot.push_back(portToPlot(view, port)); onTreeItemSelected(); }
void PlanSimSubpanel::removePortToPlot(QString view, QString port) { std::vector<portToPlot>::iterator itb = portsToPlot.begin(); std::vector<portToPlot>::iterator ite = portsToPlot.end(); std::vector<portToPlot>::iterator itf = ite; for (; itb != ite; itb++) { if (itb->view == view and itb->port == port) { itf = itb; } } if (itf != ite) { portsToPlot.erase(itf); } onTreeItemSelected(); }
DefaultSimSubpanel::DefaultSimSubpanel(): PluginSimPanel(), left(new DefaultSimSubpanelLeftWidget), right(new DefaultSimSubpanelRightWidget), sim_process(0), thread(0), mvpm(0), mpkg(0),mLog(0), portsToPlot() { QObject::connect(left->ui->runButton, SIGNAL(pressed()), this, SLOT(onRunPressed())); QObject::connect(right->ui->butSimColor, SIGNAL(clicked()), this, SLOT(onToolColor())); QObject::connect(right->ui->treeSimViews, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(onTreeItemChanged(QTreeWidgetItem *, int))); QObject::connect(right->ui->treeSimViews, SIGNAL(itemSelectionChanged()), this, SLOT(onTreeItemSelected())); }
void PlanSimSubpanel::onToolColor() { QTreeWidgetItem* item = right->ui->treeSimViews->currentItem(); QString viewName = item->data(0, Qt::UserRole + 1).toString(); QString portName = item->data(0, Qt::UserRole + 2).toString(); if (portName == "") { return; } else { QColorDialog* colorDialog = new QColorDialog(left); colorDialog->setOptions(QColorDialog::DontUseNativeDialog); if (colorDialog->exec()) { portToPlot* p = getPortToPlot(viewName, portName); p->color = colorDialog->selectedColor(); onTreeItemSelected(); updateCustomPlot(); } } }
PlanSimSubpanel::PlanSimSubpanel() : PluginSimPanel() , debug(false) , nbthreads(0) , blockSize(8) , left(new PlanSimSubpanelLeftWidget) , right(new PlanSimSubpanelRightWidget) , sim_process(0) , thread(0) , mvpz(0) , mpkg(0) , mLog(0) , timer(this) , portsToPlot() , log_messages() , index_message(0) { QObject::connect( left->ui->runButton, SIGNAL(pressed()), this, SLOT(onRunPressed())); QObject::connect(left->ui->debugCombo, SIGNAL(currentTextChanged(QString)), this, SLOT(onDebugChanged(QString))); QObject::connect(left->ui->threadsSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onThreadsChanged(int))); QObject::connect(left->ui->blockSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onBlockSizeChanged(int))); QObject::connect( right->ui->butSimColor, SIGNAL(clicked()), this, SLOT(onToolColor())); QObject::connect(right->ui->treeSimViews, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(onTreeItemChanged(QTreeWidgetItem*, int))); QObject::connect(right->ui->treeSimViews, SIGNAL(itemSelectionChanged()), this, SLOT(onTreeItemSelected())); QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(onTimeout())); }