Chris@49: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@3: Chris@3: /* Chris@52: Sonic Visualiser Chris@52: An audio file viewer and annotation editor. Chris@52: Centre for Digital Music, Queen Mary, University of London. Chris@52: This file copyright 2006 Chris Cannam. Chris@3: Chris@52: This program is free software; you can redistribute it and/or Chris@52: modify it under the terms of the GNU General Public License as Chris@52: published by the Free Software Foundation; either version 2 of the Chris@52: License, or (at your option) any later version. See the file Chris@52: COPYING included with this distribution for more information. Chris@3: */ Chris@0: Chris@0: #include "Model.h" Chris@30: #include "PlayParameterRepository.h" Chris@0: Chris@146: #include Chris@146: Chris@43: #include Chris@43: Chris@0: const int Model::COMPLETION_UNKNOWN = -1; Chris@0: Chris@30: Model::~Model() Chris@30: { Chris@117: // std::cerr << "Model::~Model(" << this << ")" << std::endl; Chris@43: Chris@30: // Subclasses have to handle adding themselves to the repository, Chris@30: // if they want to be played. We can't do it from here because Chris@30: // the repository would be unable to tell whether we were playable Chris@30: // or not (because dynamic_cast won't work from the base class ctor) Chris@145: PlayParameterRepository::getInstance()->removeModel(this); Chris@30: } Chris@30: Chris@146: void Chris@146: Model::toXml(QTextStream &stream, QString indent, Chris@146: QString extraAttributes) const Chris@146: { Chris@146: stream << indent; Chris@146: stream << QString("\n") Chris@146: .arg(getObjectExportId(this)) Chris@146: .arg(encodeEntities(objectName())) Chris@146: .arg(getSampleRate()) Chris@146: .arg(getStartFrame()) Chris@146: .arg(getEndFrame()) Chris@146: .arg(extraAttributes); Chris@146: } Chris@146: Chris@3: QString Chris@3: Model::toXmlString(QString indent, QString extraAttributes) const Chris@3: { Chris@3: QString s; Chris@3: Chris@3: s += indent; Chris@3: Chris@4: s += QString("\n") Chris@4: .arg(getObjectExportId(this)) Chris@77: .arg(encodeEntities(objectName())) Chris@4: .arg(getSampleRate()) Chris@4: .arg(getStartFrame()) Chris@4: .arg(getEndFrame()) Chris@3: .arg(extraAttributes); Chris@3: Chris@3: return s; Chris@3: } Chris@3: Chris@0: #ifdef INCLUDE_MOCFILES Chris@0: #include "Model.moc.cpp" Chris@0: #endif Chris@0: