clang format and some cleanup
This commit is contained in:
parent
cc901d67f5
commit
7a741b66a1
@ -40,7 +40,10 @@ enum class ElementType
|
|||||||
class ElementTreeItem : public QTreeWidgetItem
|
class ElementTreeItem : public QTreeWidgetItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElementTreeItem(ElementType t, QString str, QTreeWidgetItem *parent) : QTreeWidgetItem(parent, QStringList(str)), type(t) {}
|
ElementTreeItem(ElementType t, QString str, QTreeWidgetItem *parent)
|
||||||
|
: QTreeWidgetItem(parent, QStringList(str)), type(t)
|
||||||
|
{
|
||||||
|
}
|
||||||
virtual ~ElementTreeItem(){};
|
virtual ~ElementTreeItem(){};
|
||||||
|
|
||||||
ElementType getType() { return type; };
|
ElementType getType() { return type; };
|
||||||
@ -52,7 +55,10 @@ class ElementTreeItem : public QTreeWidgetItem
|
|||||||
class IdStringTreeItem : public ElementTreeItem
|
class IdStringTreeItem : public ElementTreeItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IdStringTreeItem(IdString d, ElementType t, QString str, QTreeWidgetItem *parent) : ElementTreeItem(t, str, parent) { this->data = d; }
|
IdStringTreeItem(IdString d, ElementType t, QString str, QTreeWidgetItem *parent) : ElementTreeItem(t, str, parent)
|
||||||
|
{
|
||||||
|
this->data = d;
|
||||||
|
}
|
||||||
virtual ~IdStringTreeItem(){};
|
virtual ~IdStringTreeItem(){};
|
||||||
|
|
||||||
IdString getData() { return this->data; };
|
IdString getData() { return this->data; };
|
||||||
@ -61,7 +67,6 @@ class IdStringTreeItem : public ElementTreeItem
|
|||||||
IdString data;
|
IdString data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), nets_root(nullptr), cells_root(nullptr)
|
DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), nets_root(nullptr), cells_root(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -99,9 +104,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net
|
|||||||
connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), SLOT(onItemClicked(QTreeWidgetItem *, int)));
|
connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), SLOT(onItemClicked(QTreeWidgetItem *, int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
DesignWidget::~DesignWidget()
|
DesignWidget::~DesignWidget() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignWidget::newContext(Context *ctx)
|
void DesignWidget::newContext(Context *ctx)
|
||||||
{
|
{
|
||||||
@ -112,28 +115,28 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
QTreeWidgetItem *bel_root = new QTreeWidgetItem(treeWidget);
|
QTreeWidgetItem *bel_root = new QTreeWidgetItem(treeWidget);
|
||||||
QMap<QString, QTreeWidgetItem *> bel_items;
|
QMap<QString, QTreeWidgetItem *> bel_items;
|
||||||
bel_root->setText(0, "Bels");
|
bel_root->setText(0, "Bels");
|
||||||
treeWidget->insertTopLevelItem(0, bel_root);
|
treeWidget->insertTopLevelItem(0, bel_root);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
for (auto bel : ctx->getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto id = ctx->getBelName(bel);
|
auto id = ctx->getBelName(bel);
|
||||||
QStringList items = QString(id.c_str(ctx)).split("/");
|
QStringList items = QString(id.c_str(ctx)).split("/");
|
||||||
QString name;
|
QString name;
|
||||||
QTreeWidgetItem *parent = nullptr;
|
QTreeWidgetItem *parent = nullptr;
|
||||||
for(int i=0;i<items.size();i++)
|
for (int i = 0; i < items.size(); i++) {
|
||||||
{
|
if (!name.isEmpty())
|
||||||
if (!name.isEmpty()) name += "/";
|
name += "/";
|
||||||
name += items.at(i);
|
name += items.at(i);
|
||||||
if (!bel_items.contains(name)) {
|
if (!bel_items.contains(name)) {
|
||||||
if (i==items.size()-1)
|
if (i == items.size() - 1)
|
||||||
bel_items.insert(name,new IdStringTreeItem(id, ElementType::BEL, items.at(i),parent));
|
bel_items.insert(name, new IdStringTreeItem(id, ElementType::BEL, items.at(i), parent));
|
||||||
else
|
else
|
||||||
bel_items.insert(name,new ElementTreeItem(ElementType::NONE, items.at(i),parent));
|
bel_items.insert(name, new ElementTreeItem(ElementType::NONE, items.at(i), parent));
|
||||||
}
|
}
|
||||||
parent = bel_items[name];
|
parent = bel_items[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto bel : bel_items.toStdMap()) {
|
for (auto bel : bel_items.toStdMap()) {
|
||||||
bel_root->addChild(bel.second);
|
bel_root->addChild(bel.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,28 +144,28 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
QTreeWidgetItem *wire_root = new QTreeWidgetItem(treeWidget);
|
QTreeWidgetItem *wire_root = new QTreeWidgetItem(treeWidget);
|
||||||
QMap<QString, QTreeWidgetItem *> wire_items;
|
QMap<QString, QTreeWidgetItem *> wire_items;
|
||||||
wire_root->setText(0, "Wires");
|
wire_root->setText(0, "Wires");
|
||||||
treeWidget->insertTopLevelItem(0, wire_root);
|
treeWidget->insertTopLevelItem(0, wire_root);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
for (auto wire : ctx->getWires()) {
|
for (auto wire : ctx->getWires()) {
|
||||||
auto id = ctx->getWireName(wire);
|
auto id = ctx->getWireName(wire);
|
||||||
QStringList items = QString(id.c_str(ctx)).split("/");
|
QStringList items = QString(id.c_str(ctx)).split("/");
|
||||||
QString name;
|
QString name;
|
||||||
QTreeWidgetItem *parent = nullptr;
|
QTreeWidgetItem *parent = nullptr;
|
||||||
for(int i=0;i<items.size();i++)
|
for (int i = 0; i < items.size(); i++) {
|
||||||
{
|
if (!name.isEmpty())
|
||||||
if (!name.isEmpty()) name += "/";
|
name += "/";
|
||||||
name += items.at(i);
|
name += items.at(i);
|
||||||
if (!wire_items.contains(name)) {
|
if (!wire_items.contains(name)) {
|
||||||
if (i==items.size()-1)
|
if (i == items.size() - 1)
|
||||||
wire_items.insert(name,new IdStringTreeItem(id, ElementType::WIRE, items.at(i),parent));
|
wire_items.insert(name, new IdStringTreeItem(id, ElementType::WIRE, items.at(i), parent));
|
||||||
else
|
else
|
||||||
wire_items.insert(name,new ElementTreeItem(ElementType::NONE, items.at(i),parent));
|
wire_items.insert(name, new ElementTreeItem(ElementType::NONE, items.at(i), parent));
|
||||||
}
|
}
|
||||||
parent = wire_items[name];
|
parent = wire_items[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto wire : wire_items.toStdMap()) {
|
for (auto wire : wire_items.toStdMap()) {
|
||||||
wire_root->addChild(wire.second);
|
wire_root->addChild(wire.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,34 +180,33 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
QStringList items = QString(id.c_str(ctx)).split("/");
|
QStringList items = QString(id.c_str(ctx)).split("/");
|
||||||
QString name;
|
QString name;
|
||||||
QTreeWidgetItem *parent = nullptr;
|
QTreeWidgetItem *parent = nullptr;
|
||||||
for(int i=0;i<items.size();i++)
|
for (int i = 0; i < items.size(); i++) {
|
||||||
{
|
if (!name.isEmpty())
|
||||||
if (!name.isEmpty()) name += "/";
|
name += "/";
|
||||||
name += items.at(i);
|
name += items.at(i);
|
||||||
if (!pip_items.contains(name)) {
|
if (!pip_items.contains(name)) {
|
||||||
if (i==items.size()-1)
|
if (i == items.size() - 1)
|
||||||
pip_items.insert(name,new IdStringTreeItem(id, ElementType::PIP, items.at(i),parent));
|
pip_items.insert(name, new IdStringTreeItem(id, ElementType::PIP, items.at(i), parent));
|
||||||
else
|
else
|
||||||
pip_items.insert(name,new ElementTreeItem(ElementType::NONE, items.at(i),parent));
|
pip_items.insert(name, new ElementTreeItem(ElementType::NONE, items.at(i), parent));
|
||||||
}
|
}
|
||||||
parent = pip_items[name];
|
parent = pip_items[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto pip : pip_items.toStdMap()) {
|
for (auto pip : pip_items.toStdMap()) {
|
||||||
pip_root->addChild(pip.second);
|
pip_root->addChild(pip.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add nets to tree
|
// Add nets to tree
|
||||||
nets_root = new QTreeWidgetItem(treeWidget);
|
nets_root = new QTreeWidgetItem(treeWidget);
|
||||||
nets_root->setText(0, "Nets");
|
nets_root->setText(0, "Nets");
|
||||||
treeWidget->insertTopLevelItem(0, nets_root);
|
treeWidget->insertTopLevelItem(0, nets_root);
|
||||||
|
|
||||||
// Add cells to tree
|
// Add cells to tree
|
||||||
cells_root = new QTreeWidgetItem(treeWidget);
|
cells_root = new QTreeWidgetItem(treeWidget);
|
||||||
cells_root->setText(0, "Cells");
|
cells_root->setText(0, "Cells");
|
||||||
treeWidget->insertTopLevelItem(0, cells_root);
|
treeWidget->insertTopLevelItem(0, cells_root);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignWidget::updateTree()
|
void DesignWidget::updateTree()
|
||||||
@ -217,34 +219,33 @@ void DesignWidget::updateTree()
|
|||||||
nets_root = new QTreeWidgetItem(treeWidget);
|
nets_root = new QTreeWidgetItem(treeWidget);
|
||||||
QMap<QString, QTreeWidgetItem *> nets_items;
|
QMap<QString, QTreeWidgetItem *> nets_items;
|
||||||
nets_root->setText(0, "Nets");
|
nets_root->setText(0, "Nets");
|
||||||
treeWidget->insertTopLevelItem(0, nets_root);
|
treeWidget->insertTopLevelItem(0, nets_root);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
for (auto& item : ctx->nets) {
|
for (auto &item : ctx->nets) {
|
||||||
auto id = item.first;
|
auto id = item.first;
|
||||||
QString name = QString(id.c_str(ctx));
|
QString name = QString(id.c_str(ctx));
|
||||||
nets_items.insert(name, new IdStringTreeItem(id, ElementType::NET, name, nullptr));
|
nets_items.insert(name, new IdStringTreeItem(id, ElementType::NET, name, nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto item : nets_items.toStdMap()) {
|
for (auto item : nets_items.toStdMap()) {
|
||||||
nets_root->addChild(item.second);
|
nets_root->addChild(item.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add cells to tree
|
// Add cells to tree
|
||||||
cells_root = new QTreeWidgetItem(treeWidget);
|
cells_root = new QTreeWidgetItem(treeWidget);
|
||||||
QMap<QString, QTreeWidgetItem *> cells_items;
|
QMap<QString, QTreeWidgetItem *> cells_items;
|
||||||
cells_root->setText(0, "Cells");
|
cells_root->setText(0, "Cells");
|
||||||
treeWidget->insertTopLevelItem(0, cells_root);
|
treeWidget->insertTopLevelItem(0, cells_root);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
for (auto& item : ctx->cells) {
|
for (auto &item : ctx->cells) {
|
||||||
auto id = item.first;
|
auto id = item.first;
|
||||||
QString name = QString(id.c_str(ctx));
|
QString name = QString(id.c_str(ctx));
|
||||||
cells_items.insert(name,new IdStringTreeItem(id, ElementType::CELL,name, nullptr));
|
cells_items.insert(name, new IdStringTreeItem(id, ElementType::CELL, name, nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto item : cells_items.toStdMap()) {
|
for (auto item : cells_items.toStdMap()) {
|
||||||
cells_root->addChild(item.second);
|
cells_root->addChild(item.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignWidget::addProperty(QtProperty *property, const QString &id)
|
void DesignWidget::addProperty(QtProperty *property, const QString &id)
|
||||||
@ -270,12 +271,11 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
if (!item->parent())
|
if (!item->parent())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
ElementType type = static_cast<ElementTreeItem *>(item)->getType();
|
ElementType type = static_cast<ElementTreeItem *>(item)->getType();
|
||||||
if (type == ElementType::NONE) {
|
if (type == ElementType::NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearProperties();
|
clearProperties();
|
||||||
if (type == ElementType::BEL) {
|
if (type == ElementType::BEL) {
|
||||||
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
||||||
@ -295,7 +295,7 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
} else if (type == ElementType::WIRE) {
|
} else if (type == ElementType::WIRE) {
|
||||||
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
||||||
|
|
||||||
QtProperty *topItem = groupManager->addProperty("Wire");
|
QtProperty *topItem = groupManager->addProperty("Wire");
|
||||||
addProperty(topItem, "Wire");
|
addProperty(topItem, "Wire");
|
||||||
|
|
||||||
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
||||||
@ -305,7 +305,7 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
} else if (type == ElementType::PIP) {
|
} else if (type == ElementType::PIP) {
|
||||||
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
||||||
|
|
||||||
QtProperty *topItem = groupManager->addProperty("Pip");
|
QtProperty *topItem = groupManager->addProperty("Pip");
|
||||||
addProperty(topItem, "Pip");
|
addProperty(topItem, "Pip");
|
||||||
|
|
||||||
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
||||||
@ -316,36 +316,35 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
||||||
NetInfo *net = ctx->nets.at(c).get();
|
NetInfo *net = ctx->nets.at(c).get();
|
||||||
|
|
||||||
QtProperty *topItem = groupManager->addProperty("Net");
|
QtProperty *topItem = groupManager->addProperty("Net");
|
||||||
addProperty(topItem, "Net");
|
addProperty(topItem, "Net");
|
||||||
|
|
||||||
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
||||||
nameItem->setValue(net->name.c_str(ctx));
|
nameItem->setValue(net->name.c_str(ctx));
|
||||||
topItem->addSubProperty(nameItem);
|
topItem->addSubProperty(nameItem);
|
||||||
|
|
||||||
QtProperty *driverItem = groupManager->addProperty("Driver");
|
QtProperty *driverItem = groupManager->addProperty("Driver");
|
||||||
topItem->addSubProperty(driverItem);
|
topItem->addSubProperty(driverItem);
|
||||||
|
|
||||||
QtVariantProperty *portItem = readOnlyManager->addProperty(QVariant::String, "Port");
|
QtVariantProperty *portItem = readOnlyManager->addProperty(QVariant::String, "Port");
|
||||||
portItem->setValue(net->driver.port.c_str(ctx));
|
portItem->setValue(net->driver.port.c_str(ctx));
|
||||||
driverItem->addSubProperty(portItem);
|
driverItem->addSubProperty(portItem);
|
||||||
|
|
||||||
QtVariantProperty *budgetItem = readOnlyManager->addProperty(QVariant::Double, "Budget");
|
QtVariantProperty *budgetItem = readOnlyManager->addProperty(QVariant::Double, "Budget");
|
||||||
budgetItem->setValue(net->driver.budget);
|
budgetItem->setValue(net->driver.budget);
|
||||||
driverItem->addSubProperty(budgetItem);
|
driverItem->addSubProperty(budgetItem);
|
||||||
|
|
||||||
if (net->driver.cell) {
|
QtVariantProperty *cellNameItem = readOnlyManager->addProperty(QVariant::String, "Cell");
|
||||||
CellInfo *cell = net->driver.cell;
|
if (net->driver.cell)
|
||||||
|
cellNameItem->setValue(net->driver.cell->name.c_str(ctx));
|
||||||
QtVariantProperty *cellNameItem = readOnlyManager->addProperty(QVariant::String, "Cell");
|
else
|
||||||
cellNameItem->setValue(cell->name.c_str(ctx));
|
cellNameItem->setValue("");
|
||||||
driverItem->addSubProperty(cellNameItem);
|
driverItem->addSubProperty(cellNameItem);
|
||||||
}
|
|
||||||
QtProperty *usersItem = groupManager->addProperty("Users");
|
QtProperty *usersItem = groupManager->addProperty("Users");
|
||||||
topItem->addSubProperty(usersItem);
|
topItem->addSubProperty(usersItem);
|
||||||
for(auto &item : net->users)
|
for (auto &item : net->users) {
|
||||||
{
|
QtProperty *portItem = groupManager->addProperty(item.port.c_str(ctx));
|
||||||
QtProperty *portItem = groupManager->addProperty(item.port.c_str(ctx));
|
|
||||||
usersItem->addSubProperty(portItem);
|
usersItem->addSubProperty(portItem);
|
||||||
|
|
||||||
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Port");
|
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Port");
|
||||||
@ -364,30 +363,28 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
portItem->addSubProperty(userItem);
|
portItem->addSubProperty(userItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
QtProperty *attrsItem = groupManager->addProperty("Attributes");
|
QtProperty *attrsItem = groupManager->addProperty("Attributes");
|
||||||
topItem->addSubProperty(attrsItem);
|
topItem->addSubProperty(attrsItem);
|
||||||
for(auto &item : net->attrs)
|
for (auto &item : net->attrs) {
|
||||||
{
|
|
||||||
QtVariantProperty *attrItem = readOnlyManager->addProperty(QVariant::String, item.first.c_str(ctx));
|
QtVariantProperty *attrItem = readOnlyManager->addProperty(QVariant::String, item.first.c_str(ctx));
|
||||||
attrItem->setValue(item.second.c_str());
|
attrItem->setValue(item.second.c_str());
|
||||||
attrsItem->addSubProperty(attrItem);
|
attrsItem->addSubProperty(attrItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
QtProperty *wiresItem = groupManager->addProperty("Wires");
|
QtProperty *wiresItem = groupManager->addProperty("Wires");
|
||||||
topItem->addSubProperty(wiresItem);
|
topItem->addSubProperty(wiresItem);
|
||||||
for(auto &item : net->wires)
|
for (auto &item : net->wires) {
|
||||||
{
|
|
||||||
auto name = ctx->getWireName(item.first).c_str(ctx);
|
auto name = ctx->getWireName(item.first).c_str(ctx);
|
||||||
|
|
||||||
QtProperty *wireItem = groupManager->addProperty(name);
|
QtProperty *wireItem = groupManager->addProperty(name);
|
||||||
|
|
||||||
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
QtVariantProperty *nameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
||||||
nameItem->setValue(name);
|
nameItem->setValue(name);
|
||||||
wireItem->addSubProperty(nameItem);
|
wireItem->addSubProperty(nameItem);
|
||||||
|
|
||||||
QtVariantProperty *pipItem = readOnlyManager->addProperty(QVariant::String, "Pip");
|
QtVariantProperty *pipItem = readOnlyManager->addProperty(QVariant::String, "Pip");
|
||||||
|
|
||||||
if (item.second.pip!=PipId())
|
if (item.second.pip != PipId())
|
||||||
pipItem->setValue(ctx->getPipName(item.second.pip).c_str(ctx));
|
pipItem->setValue(ctx->getPipName(item.second.pip).c_str(ctx));
|
||||||
else
|
else
|
||||||
pipItem->setValue("");
|
pipItem->setValue("");
|
||||||
@ -397,14 +394,14 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
strengthItem->setValue((int)item.second.strength);
|
strengthItem->setValue((int)item.second.strength);
|
||||||
wireItem->addSubProperty(strengthItem);
|
wireItem->addSubProperty(strengthItem);
|
||||||
|
|
||||||
wiresItem->addSubProperty(wireItem);
|
wiresItem->addSubProperty(wireItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (type == ElementType::CELL) {
|
} else if (type == ElementType::CELL) {
|
||||||
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
IdString c = static_cast<IdStringTreeItem *>(item)->getData();
|
||||||
CellInfo *cell = ctx->cells.at(c).get();
|
CellInfo *cell = ctx->cells.at(c).get();
|
||||||
|
|
||||||
QtProperty *topItem = groupManager->addProperty("Cell");
|
QtProperty *topItem = groupManager->addProperty("Cell");
|
||||||
addProperty(topItem, "Cell");
|
addProperty(topItem, "Cell");
|
||||||
|
|
||||||
QtVariantProperty *cellNameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
QtVariantProperty *cellNameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
||||||
@ -414,9 +411,9 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
QtVariantProperty *cellTypeItem = readOnlyManager->addProperty(QVariant::String, "Type");
|
QtVariantProperty *cellTypeItem = readOnlyManager->addProperty(QVariant::String, "Type");
|
||||||
cellTypeItem->setValue(cell->type.c_str(ctx));
|
cellTypeItem->setValue(cell->type.c_str(ctx));
|
||||||
topItem->addSubProperty(cellTypeItem);
|
topItem->addSubProperty(cellTypeItem);
|
||||||
|
|
||||||
QtVariantProperty *cellBelItem = readOnlyManager->addProperty(QVariant::String, "Bel");
|
QtVariantProperty *cellBelItem = readOnlyManager->addProperty(QVariant::String, "Bel");
|
||||||
if (cell->bel!=BelId())
|
if (cell->bel != BelId())
|
||||||
cellBelItem->setValue(ctx->getBelName(cell->bel).c_str(ctx));
|
cellBelItem->setValue(ctx->getBelName(cell->bel).c_str(ctx));
|
||||||
else
|
else
|
||||||
cellBelItem->setValue("");
|
cellBelItem->setValue("");
|
||||||
@ -428,10 +425,9 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
|
|
||||||
QtProperty *cellPortsItem = groupManager->addProperty("Ports");
|
QtProperty *cellPortsItem = groupManager->addProperty("Ports");
|
||||||
topItem->addSubProperty(cellPortsItem);
|
topItem->addSubProperty(cellPortsItem);
|
||||||
for(auto &item : cell->ports)
|
for (auto &item : cell->ports) {
|
||||||
{
|
|
||||||
PortInfo p = item.second;
|
PortInfo p = item.second;
|
||||||
|
|
||||||
QtProperty *portInfoItem = groupManager->addProperty(p.name.c_str(ctx));
|
QtProperty *portInfoItem = groupManager->addProperty(p.name.c_str(ctx));
|
||||||
|
|
||||||
QtVariantProperty *portInfoNameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
QtVariantProperty *portInfoNameItem = readOnlyManager->addProperty(QVariant::String, "Name");
|
||||||
@ -445,7 +441,7 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
QtVariantProperty *portInfoNetItem = readOnlyManager->addProperty(QVariant::String, "Net");
|
QtVariantProperty *portInfoNetItem = readOnlyManager->addProperty(QVariant::String, "Net");
|
||||||
if (p.net)
|
if (p.net)
|
||||||
portInfoNetItem->setValue(p.net->name.c_str(ctx));
|
portInfoNetItem->setValue(p.net->name.c_str(ctx));
|
||||||
else
|
else
|
||||||
portInfoNetItem->setValue("");
|
portInfoNetItem->setValue("");
|
||||||
portInfoItem->addSubProperty(portInfoNetItem);
|
portInfoItem->addSubProperty(portInfoNetItem);
|
||||||
|
|
||||||
@ -454,8 +450,7 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
|
|
||||||
QtProperty *cellAttrItem = groupManager->addProperty("Attributes");
|
QtProperty *cellAttrItem = groupManager->addProperty("Attributes");
|
||||||
topItem->addSubProperty(cellAttrItem);
|
topItem->addSubProperty(cellAttrItem);
|
||||||
for(auto &item : cell->attrs)
|
for (auto &item : cell->attrs) {
|
||||||
{
|
|
||||||
QtVariantProperty *attrItem = readOnlyManager->addProperty(QVariant::String, item.first.c_str(ctx));
|
QtVariantProperty *attrItem = readOnlyManager->addProperty(QVariant::String, item.first.c_str(ctx));
|
||||||
attrItem->setValue(item.second.c_str());
|
attrItem->setValue(item.second.c_str());
|
||||||
cellAttrItem->addSubProperty(attrItem);
|
cellAttrItem->addSubProperty(attrItem);
|
||||||
@ -463,18 +458,15 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
|
|
||||||
QtProperty *cellParamsItem = groupManager->addProperty("Parameters");
|
QtProperty *cellParamsItem = groupManager->addProperty("Parameters");
|
||||||
topItem->addSubProperty(cellParamsItem);
|
topItem->addSubProperty(cellParamsItem);
|
||||||
for(auto &item : cell->params)
|
for (auto &item : cell->params) {
|
||||||
{
|
|
||||||
QtVariantProperty *paramItem = readOnlyManager->addProperty(QVariant::String, item.first.c_str(ctx));
|
QtVariantProperty *paramItem = readOnlyManager->addProperty(QVariant::String, item.first.c_str(ctx));
|
||||||
paramItem->setValue(item.second.c_str());
|
paramItem->setValue(item.second.c_str());
|
||||||
cellParamsItem->addSubProperty(paramItem);
|
cellParamsItem->addSubProperty(paramItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QtProperty *cellPinsItem = groupManager->addProperty("Pins");
|
QtProperty *cellPinsItem = groupManager->addProperty("Pins");
|
||||||
topItem->addSubProperty(cellPinsItem);
|
topItem->addSubProperty(cellPinsItem);
|
||||||
for(auto &item : cell->pins)
|
for (auto &item : cell->pins) {
|
||||||
{
|
|
||||||
std::string cell_port = item.first.c_str(ctx);
|
std::string cell_port = item.first.c_str(ctx);
|
||||||
std::string bel_pin = item.second.c_str(ctx);
|
std::string bel_pin = item.second.c_str(ctx);
|
||||||
|
|
||||||
@ -489,8 +481,7 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
|||||||
pinGroupItem->addSubProperty(belItem);
|
pinGroupItem->addSubProperty(belItem);
|
||||||
|
|
||||||
cellPinsItem->addSubProperty(pinGroupItem);
|
cellPinsItem->addSubProperty(pinGroupItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
#include "qtgroupboxpropertybrowser.h"
|
||||||
#include "qtpropertymanager.h"
|
#include "qtpropertymanager.h"
|
||||||
#include "qttreepropertybrowser.h"
|
#include "qttreepropertybrowser.h"
|
||||||
#include "qtvariantproperty.h"
|
#include "qtvariantproperty.h"
|
||||||
#include "qtgroupboxpropertybrowser.h"
|
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
|||||||
setFormat(fmt);
|
setFormat(fmt);
|
||||||
|
|
||||||
fmt = format();
|
fmt = format();
|
||||||
//printf("FPGAViewWidget running on OpenGL %d.%d\n", fmt.majorVersion(), fmt.minorVersion());
|
// printf("FPGAViewWidget running on OpenGL %d.%d\n", fmt.majorVersion(), fmt.minorVersion());
|
||||||
if (fmt.majorVersion() < 3) {
|
if (fmt.majorVersion() < 3) {
|
||||||
printf("Could not get OpenGL 3.0 context. Aborting.\n");
|
printf("Could not get OpenGL 3.0 context. Aborting.\n");
|
||||||
log_abort();
|
log_abort();
|
||||||
|
@ -34,8 +34,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
// Vertex2DPOD is a structure of X, Y coordinates that can be passed to OpenGL
|
// Vertex2DPOD is a structure of X, Y coordinates that can be passed to OpenGL
|
||||||
// directly.
|
// directly.
|
||||||
NPNR_PACKED_STRUCT(struct Vertex2DPOD
|
NPNR_PACKED_STRUCT(struct Vertex2DPOD {
|
||||||
{
|
|
||||||
GLfloat x;
|
GLfloat x;
|
||||||
GLfloat y;
|
GLfloat y;
|
||||||
|
|
||||||
@ -44,8 +43,7 @@ NPNR_PACKED_STRUCT(struct Vertex2DPOD
|
|||||||
|
|
||||||
// Vertex2DPOD is a structure of R, G, B, A values that can be passed to OpenGL
|
// Vertex2DPOD is a structure of R, G, B, A values that can be passed to OpenGL
|
||||||
// directly.
|
// directly.
|
||||||
NPNR_PACKED_STRUCT(struct ColorPOD
|
NPNR_PACKED_STRUCT(struct ColorPOD {
|
||||||
{
|
|
||||||
GLfloat r;
|
GLfloat r;
|
||||||
GLfloat g;
|
GLfloat g;
|
||||||
GLfloat b;
|
GLfloat b;
|
||||||
|
Loading…
Reference in New Issue
Block a user