| 41 | { |
| 42 | |
| 43 | TraditionalView::TraditionalView(const NodeTree &tree, UserData &ud, SolverData &sd) |
| 44 | : tree_(tree), |
| 45 | user_data_(ud), |
| 46 | solver_data_(sd), |
| 47 | vis_flags_(utils::make_unique<VisualFlags>()), |
| 48 | layout_(utils::make_unique<Layout>()), |
| 49 | layout_computer_(utils::make_unique<LayoutComputer>(tree, *layout_, *vis_flags_)) |
| 50 | { |
| 51 | utils::DebugMutexLocker tree_lock(&tree_.treeMutex()); |
| 52 | |
| 53 | scroll_area_.reset(new TreeScrollArea(tree_.getRoot(), tree_, user_data_, *layout_, *vis_flags_)); |
| 54 | |
| 55 | // std::cerr << "traditional view thread:" << std::this_thread::get_id() << std::endl; |
| 56 | |
| 57 | // connect(scroll_area_.get(), &TreeScrollArea::nodeClicked, this, &TraditionalView::setCurrentNode); |
| 58 | connect(scroll_area_.get(), &TreeScrollArea::nodeClicked, this, &TraditionalView::nodeSelected); |
| 59 | connect(scroll_area_.get(), &TreeScrollArea::nodeDoubleClicked, this, &TraditionalView::handleDoubleClick); |
| 60 | |
| 61 | connect(this, &TraditionalView::needsRedrawing, this, &TraditionalView::redraw); |
| 62 | connect(this, &TraditionalView::needsLayoutUpdate, this, &TraditionalView::updateLayout); |
| 63 | |
| 64 | connect(&tree, &NodeTree::childrenStructureChanged, [this](NodeID nid) { |
| 65 | if (nid == NodeID::NoNode) |
| 66 | { |
| 67 | return; |
| 68 | } |
| 69 | layout_computer_->dirtyUpLater(nid); |
| 70 | // layout_->setLayoutDone(nid, false); |
| 71 | }); |
| 72 | |
| 73 | auto autoLayoutTimer = new QTimer(this); |
| 74 | |
| 75 | connect(autoLayoutTimer, &QTimer::timeout, this, &TraditionalView::autoUpdate); |
| 76 | |
| 77 | /// stop this timer up when the tree is finished? |
| 78 | autoLayoutTimer->start(100); |
| 79 | } |
| 80 | |
| 81 | TraditionalView::~TraditionalView() = default; |
| 82 |
nothing calls this directly
no test coverage detected