Mercurial > hg > easaier-soundaccess
diff sv/document/ESFileReader.h @ 19:2a6f70f97395
add
- EasaierSessionManager
- Easaier menus
- Interval model
author | lbajardsilogic |
---|---|
date | Mon, 14 May 2007 13:13:59 +0000 |
parents | |
children | 74d1b3bda5a3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sv/document/ESFileReader.h Mon May 14 13:13:59 2007 +0000 @@ -0,0 +1,90 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* Sound Access + EASAIER client application. + Silogic 2007. Laure Bajard. + + 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 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef _ES_FILE_READER_H_ +#define _ES_FILE_READER_H_ + +#include "layer/LayerFactory.h" +#include "transform/Transform.h" +#include "data/model/AudioSourceInfoModel.h" +#include "data/fileio/HttpClient.h" + +#include <QXmlDefaultHandler> + +#include <map> + +class Pane; +class Model; +class Document; +class PlayParameters; + +class ESFileReaderPaneCallback +{ +public: + virtual ~ESFileReaderPaneCallback(){} + virtual Pane *addPane() = 0; + virtual void setWindowSize(int width, int height) = 0; + virtual void addSelection(int start, int end) = 0; +}; + +class ESFileReader : public QXmlDefaultHandler +{ +public: + ESFileReader(Document *document, + ESFileReaderPaneCallback &callback); + virtual ~ESFileReader(); + + void parse(const QString &xmlData); + void parse(QXmlInputSource &source); + + bool isOK(); + QString getErrorString() const { return m_errorString; } + + // For loading a single layer onto an existing pane + void setCurrentPane(Pane *pane) { m_currentPane = pane; } + + virtual bool startElement(const QString &namespaceURI, + const QString &localName, + const QString &qName, + const QXmlAttributes& atts); + + virtual bool characters(const QString &); + + virtual bool endElement(const QString &namespaceURI, + const QString &localName, + const QString &qName); + + bool error(const QXmlParseException &exception); + bool fatalError(const QXmlParseException &exception); + +protected: + bool readWindow(const QXmlAttributes &); + bool readView(const QXmlAttributes &); + bool readLayer(const QXmlAttributes &); + + Document *m_document; + ESFileReaderPaneCallback &m_paneCallback; + Pane *m_currentPane; + std::map<int, Layer *> m_layers; + + bool m_inView; + bool m_inData; + + QString m_errorString; + bool m_ok; + +}; + + + +#endif