Added stringifying debug methods to track tree classes, and added a big
tree to the sequence
This commit is contained in:
parent
a117fe99e5
commit
5e8620135c
8 changed files with 89 additions and 16 deletions
|
|
@ -29,5 +29,15 @@ ClipTrack::ClipTrack()
|
|||
{
|
||||
}
|
||||
|
||||
std::string
|
||||
ClipTrack::print_track()
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
||||
os << "ClipTrack\t\"" << get_name() << "\"";
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
} // namespace model
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ClipTrack : public Track
|
|||
public:
|
||||
ClipTrack();
|
||||
|
||||
|
||||
std::string print_track();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,16 @@ namespace model {
|
|||
GroupTrack::GroupTrack()
|
||||
{
|
||||
}
|
||||
|
||||
std::string
|
||||
GroupTrack::print_track()
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
||||
os << "GroupTrack\t\"" << get_name() << "\"";
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
} // namespace model
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class GroupTrack : public ParentTrack
|
|||
public:
|
||||
GroupTrack();
|
||||
|
||||
std::string print_track();
|
||||
};
|
||||
|
||||
} // namespace model
|
||||
|
|
|
|||
|
|
@ -30,24 +30,42 @@ namespace model {
|
|||
Sequence::Sequence()
|
||||
{
|
||||
// TEST CODE
|
||||
//static bool first = true;
|
||||
static bool first = true;
|
||||
|
||||
shared_ptr<GroupTrack> group_track, group_track2;
|
||||
shared_ptr<ClipTrack> clip_track;
|
||||
tracks.push_back(group_track = shared_ptr<GroupTrack>(new GroupTrack()));
|
||||
group_track->set_name("Group Track");
|
||||
|
||||
/*if(first)
|
||||
|
||||
if(first)
|
||||
{
|
||||
group_track.add_child_track(shared_ptr<Track>(new ClipTrack()));
|
||||
group_track.add_child_track(
|
||||
group_track2 = shared_ptr<Track>(new GroupTrack()));
|
||||
group_track2.add_child_track(shared_ptr<Track>(new ClipTrack()));
|
||||
group_track->get_child_track_list().push_back(
|
||||
clip_track = shared_ptr<ClipTrack>(new ClipTrack()));
|
||||
group_track->get_child_track_list().push_back(
|
||||
group_track2 = shared_ptr<GroupTrack>(new GroupTrack()));
|
||||
group_track2->set_name("Group Track 2");
|
||||
group_track2->get_child_track_list().push_back(
|
||||
shared_ptr<ClipTrack>(new ClipTrack()));
|
||||
first = false;
|
||||
}*/
|
||||
}
|
||||
|
||||
tracks.push_back(shared_ptr<GroupTrack>(new GroupTrack()));
|
||||
|
||||
tracks.push_back(shared_ptr<Track>(new ClipTrack()));
|
||||
|
||||
// END TEST CODE
|
||||
|
||||
INFO(gui, "\n%s", print_branch().c_str());
|
||||
}
|
||||
|
||||
std::string
|
||||
Sequence::print_track()
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
||||
os << "Sequence\t\"" << get_name() << "\"";
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
} // namespace model
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ class Sequence : public ParentTrack
|
|||
public:
|
||||
Sequence();
|
||||
|
||||
|
||||
std::string print_track();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* *****************************************************/
|
||||
|
||||
#include "track.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace gui {
|
||||
namespace model {
|
||||
|
|
@ -38,17 +39,42 @@ Track::get_child_tracks() const
|
|||
return Track::NoChildren;
|
||||
}
|
||||
|
||||
const Glib::ustring
|
||||
const std::string
|
||||
Track::get_name() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
void
|
||||
Track::set_name(const Glib::ustring &name)
|
||||
Track::set_name(const std::string &name)
|
||||
{
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
std::string
|
||||
Track::print_branch()
|
||||
{
|
||||
return print_branch_recursive(0);
|
||||
}
|
||||
|
||||
std::string
|
||||
Track::print_branch_recursive(const unsigned int indentation)
|
||||
{
|
||||
Glib::ustring str;
|
||||
|
||||
for(unsigned int i = 0; i < indentation; i++)
|
||||
str += " ";
|
||||
str += print_track();
|
||||
str += "\n";
|
||||
|
||||
BOOST_FOREACH(boost::shared_ptr<Track> track, get_child_tracks())
|
||||
{
|
||||
REQUIRE(track);
|
||||
str += track->print_branch_recursive(indentation + 1);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
} // namespace model
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -41,13 +41,20 @@ public:
|
|||
virtual std::list< boost::shared_ptr<Track> >
|
||||
get_child_tracks() const;
|
||||
|
||||
const Glib::ustring get_name() const;
|
||||
const std::string get_name() const;
|
||||
|
||||
void set_name(const Glib::ustring &name);
|
||||
|
||||
void set_name(const std::string &name);
|
||||
|
||||
std::string print_branch();
|
||||
|
||||
virtual std::string print_track() = 0;
|
||||
|
||||
protected:
|
||||
std::string print_branch_recursive(const unsigned int indentation);
|
||||
|
||||
private:
|
||||
//----- Data -----//
|
||||
Glib::ustring name;
|
||||
std::string name;
|
||||
|
||||
protected:
|
||||
static const std::list< boost::shared_ptr<Track> > NoChildren;
|
||||
|
|
|
|||
Loading…
Reference in a new issue