diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-10-20 17:04:49 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-10-27 12:02:01 +0200 |
commit | f43ee265e8d303d7b41b9b79036c3c2ba433877b (patch) | |
tree | 6acf03298179e6b6b8fc3581d79c3d5aa270b4a5 | |
parent | ba0ab7cb3069b76c2f6644afb211f66c54c7208c (diff) | |
download | nextpnr-f43ee265e8d303d7b41b9b79036c3c2ba433877b.tar.gz nextpnr-f43ee265e8d303d7b41b9b79036c3c2ba433877b.tar.bz2 nextpnr-f43ee265e8d303d7b41b9b79036c3c2ba433877b.zip |
Cleanup
-rw-r--r-- | gui/designwidget.cc | 16 | ||||
-rw-r--r-- | gui/treemodel.cc | 26 | ||||
-rw-r--r-- | gui/treemodel.h | 3 |
3 files changed, 15 insertions, 30 deletions
diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 300c8271..310fcdd6 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -306,8 +306,6 @@ void DesignWidget::newContext(Context *ctx) #endif
getTreeByElementType(ElementType::CELL)->loadData(std::unique_ptr<TreeModel::IdStringList>(new TreeModel::IdStringList(ElementType::CELL)));
getTreeByElementType(ElementType::NET)->loadData(std::unique_ptr<TreeModel::IdStringList>(new TreeModel::IdStringList(ElementType::NET)));
- getTreeByElementType(ElementType::CELL)->updateCells(ctx);
- getTreeByElementType(ElementType::NET)->updateNets(ctx);
}
updateTree();
}
@@ -331,8 +329,18 @@ void DesignWidget::updateTree() {
std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex);
std::lock_guard<std::mutex> lock(ctx->mutex);
- getTreeByElementType(ElementType::CELL)->updateCells(ctx);
- getTreeByElementType(ElementType::NET)->updateNets(ctx);
+
+ std::vector<IdString> cells;
+ for (auto &pair : ctx->cells) {
+ cells.push_back(pair.first);
+ }
+ std::vector<IdString> nets;
+ for (auto &pair : ctx->nets) {
+ nets.push_back(pair.first);
+ }
+
+ getTreeByElementType(ElementType::CELL)->updateElements(ctx, cells);
+ getTreeByElementType(ElementType::NET)->updateElements(ctx, nets);
}
}
QtProperty *DesignWidget::addTopLevelProperty(const QString &id)
diff --git a/gui/treemodel.cc b/gui/treemodel.cc index ee18dd57..ab7dc263 100644 --- a/gui/treemodel.cc +++ b/gui/treemodel.cc @@ -161,35 +161,13 @@ void Model::loadData(std::unique_ptr<Item> data) endResetModel(); } -void Model::updateCells(Context *ctx) +void Model::updateElements(Context *ctx, std::vector<IdString> elements) { if (!ctx) return; beginResetModel(); - - std::vector<IdString> cells; - for (auto &pair : ctx->cells) { - cells.push_back(pair.first); - } - root_->updateElements(ctx, cells); - - endResetModel(); -} - -void Model::updateNets(Context *ctx) -{ - if (!ctx) - return; - - beginResetModel(); - - std::vector<IdString> nets; - for (auto &pair : ctx->nets) { - nets.push_back(pair.first); - } - root_->updateElements(ctx, nets); - + root_->updateElements(ctx, elements); endResetModel(); } diff --git a/gui/treemodel.h b/gui/treemodel.h index b4f23cd0..5238ed7f 100644 --- a/gui/treemodel.h +++ b/gui/treemodel.h @@ -353,8 +353,7 @@ class Model : public QAbstractItemModel ~Model(); void loadData(std::unique_ptr<Item> data); - void updateCells(Context *ctx); - void updateNets(Context *ctx); + void updateElements(Context *ctx, std::vector<IdString> elements); Item *nodeFromIndex(const QModelIndex &idx) const; QModelIndex indexFromNode(Item *node) { |