/*** Olive - Non-Linear Video Editor Copyright (C) 2019 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ***/ #include "item.h" Item::Item() : parent_(nullptr) { } Item::~Item() { // Delete all children for (int i=0;iparent_ == this) { return; } children_.append(c); c->parent_ = this; } void Item::remove_child(Item *c) { if (c->parent_ != this) { return; } children_.removeAll(c); c->parent_ = nullptr; } int Item::child_count() { return children_.size(); } Item *Item::child(int i) { return children_.at(i); } const QString &Item::name() const { return name_; } void Item::set_name(const QString &n) { name_ = n; } Item *Item::parent() const { return parent_; } void Item::set_parent(Item *p) { if (parent_ != nullptr) { parent_->remove_child(this); } p->add_child(this); }