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