X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/2bdaa0aa3fab52f0808f60d9bbdabcd56d0efae9..HEAD:/BlockLibraryWidget.cpp diff --git a/BlockLibraryWidget.cpp b/BlockLibraryWidget.cpp index 5dfd4b0..47fd875 100644 --- a/BlockLibraryWidget.cpp +++ b/BlockLibraryWidget.cpp @@ -1,5 +1,6 @@ #include "BlockLibraryWidget.h" #include "BlockLibraryTree.h" +#include "Graph.h" BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher, Parameters* _params, @@ -31,7 +32,7 @@ BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher, QString msg = "Connect to main clock/rst ext_clk/reset_0 ("; - msg += QString::number(params->clocks.at(0)); + msg += QString::number(params->getGraph()->getClock(0)); msg += ")"; radAutoClk = new QRadioButton(msg); radChooseClk = new QRadioButton("Choose among available clk/rst"); @@ -135,12 +136,13 @@ void BlockLibraryWidget::addClicked() { cout << "adding block to scene " << v.toInt() << endl; QHash clkRstToGen; - for(int i=0;irowCount();i++) { + for(int i=1;i<=nbClock+nbRst;i++) { QLayoutItem* item = layClkRst->itemAtPosition(i,0); QLabel* lab = (QLabel *)(item->widget()); item = layClkRst->itemAtPosition(i,1); QComboBox* combo = (QComboBox *)(item->widget()); clkRstToGen.insert(lab->text(),combo->currentIndex()); + cout << "addblock: have to connect " << qPrintable(lab->text()) << " to clk/rst n° " << combo->currentIndex() << endl; } @@ -197,7 +199,7 @@ void BlockLibraryWidget::updateBoxConn() { //enableAvailableClocks(true); } QString msg = "Auto-connect to main clk/rst (ext_clk_0 at "; - msg += QString::number(params->clocks.at(0)); + msg += QString::number(params->getGraph()->getClock(0)); msg += " MHz)"; radAutoClk->setText(msg); } @@ -218,7 +220,7 @@ void BlockLibraryWidget::updateClkRst(int idCat, int idBlock) { QWidget* widget = layClkRst->itemAt(0)->widget(); layClkRst->removeWidget(widget); delete widget; - } + } if (nbClock != 0) { delete [] comboClkGen; @@ -235,13 +237,14 @@ void BlockLibraryWidget::updateClkRst(int idCat, int idBlock) { nbClock = lstClocks.size(); QList lstRst = currentRefBlock->getInterfaces(AbstractInterface::Input, AbstractInterface::Reset); nbRst = lstRst.size(); + cout << "For chosen block there are " << nbClock << " clocks and " << nbRst << " resets" << endl; comboClkGen = new QComboBox*[lstClocks.size()]; for(int i=0;iclocks) { + foreach(double d, params->getGraph()->getClocks()) { name = "ext_clk_"+QString::number(id)+" ("; name += QString::number(d) + " MHz)"; comboClkGen[i]->addItem(name); @@ -253,7 +256,7 @@ void BlockLibraryWidget::updateClkRst(int idCat, int idBlock) { for(int i=0;iclocks.size();j++) { + for(int j=0;jgetGraph()->getClocks().size();j++) { name = "ext_rst_"+QString::number(j); comboRstGen[i]->addItem(name); }