Mercurial > hg > svcore
annotate data/model/Model.cpp @ 288:7b96b3bd4bae
* Fix #1757772 tempo, dynamic related plug-ins bug -- make auto-align
only auto-align if there is a unit involved
* Fix #1755366 text layer bug in retrieved session
* Fix input model selection in plugin parameter dialog (was being ignored)
* Use lighter background than the standard widget one for panes (assuming the
widget background is light but not white) -- similarly darker if dark
* Fix colour reference counting in loaded session in SingleColourLayer
* Reset overview pane colour when switching dark background on or off
author | Chris Cannam |
---|---|
date | Tue, 14 Aug 2007 13:58:53 +0000 |
parents | 3e6fee4e4257 |
children | 70a232b1f12a |
rev | line source |
---|---|
Chris@150 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@150 | 2 |
Chris@150 | 3 /* |
Chris@150 | 4 Sonic Visualiser |
Chris@150 | 5 An audio file viewer and annotation editor. |
Chris@150 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@150 | 7 This file copyright 2006 Chris Cannam. |
Chris@150 | 8 |
Chris@150 | 9 This program is free software; you can redistribute it and/or |
Chris@150 | 10 modify it under the terms of the GNU General Public License as |
Chris@150 | 11 published by the Free Software Foundation; either version 2 of the |
Chris@150 | 12 License, or (at your option) any later version. See the file |
Chris@150 | 13 COPYING included with this distribution for more information. |
Chris@150 | 14 */ |
Chris@150 | 15 |
Chris@150 | 16 #include "Model.h" |
Chris@150 | 17 #include "base/PlayParameterRepository.h" |
Chris@150 | 18 |
Chris@150 | 19 #include <QTextStream> |
Chris@150 | 20 |
Chris@150 | 21 #include <iostream> |
Chris@150 | 22 |
Chris@150 | 23 const int Model::COMPLETION_UNKNOWN = -1; |
Chris@150 | 24 |
Chris@150 | 25 Model::~Model() |
Chris@150 | 26 { |
Chris@150 | 27 // std::cerr << "Model::~Model(" << this << ")" << std::endl; |
Chris@150 | 28 |
Chris@150 | 29 // Subclasses have to handle adding themselves to the repository, |
Chris@150 | 30 // if they want to be played. We can't do it from here because |
Chris@150 | 31 // the repository would be unable to tell whether we were playable |
Chris@150 | 32 // or not (because dynamic_cast won't work from the base class ctor) |
Chris@150 | 33 PlayParameterRepository::getInstance()->removeModel(this); |
Chris@150 | 34 } |
Chris@150 | 35 |
Chris@150 | 36 void |
Chris@150 | 37 Model::toXml(QTextStream &stream, QString indent, |
Chris@150 | 38 QString extraAttributes) const |
Chris@150 | 39 { |
Chris@150 | 40 stream << indent; |
Chris@150 | 41 stream << QString("<model id=\"%1\" name=\"%2\" sampleRate=\"%3\" start=\"%4\" end=\"%5\" %6/>\n") |
Chris@150 | 42 .arg(getObjectExportId(this)) |
Chris@150 | 43 .arg(encodeEntities(objectName())) |
Chris@150 | 44 .arg(getSampleRate()) |
Chris@150 | 45 .arg(getStartFrame()) |
Chris@150 | 46 .arg(getEndFrame()) |
Chris@150 | 47 .arg(extraAttributes); |
Chris@150 | 48 } |
Chris@150 | 49 |
Chris@150 | 50 QString |
Chris@150 | 51 Model::toXmlString(QString indent, QString extraAttributes) const |
Chris@150 | 52 { |
Chris@150 | 53 QString s; |
Chris@150 | 54 |
Chris@288 | 55 { |
Chris@288 | 56 QTextStream out(&s); |
Chris@288 | 57 toXml(out, indent, extraAttributes); |
Chris@288 | 58 } |
Chris@150 | 59 |
Chris@150 | 60 return s; |
Chris@150 | 61 } |
Chris@150 | 62 |