Mercurial > hg > easaier-soundaccess
view sv/main/EasaierSessionManager.h @ 214:c4e897bf012b
resolve bug 1887753
author | lbajardsilogic |
---|---|
date | Wed, 06 Feb 2008 15:07:18 +0000 |
parents | 97fd6148fb8e |
children | bf7e98ee11f4 |
line wrap: on
line source
/* -*- 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 _EASAIER_SESSION_MANAGER_H_ #define _EASAIER_SESSION_MANAGER_H_ #include <QObject> #include <QFile> #include <map> #include <set> #include "data/fileio/HttpClient.h" #include "document/Document.h" #include "view/Pane.h" #include "data/model/QueryModel.h" class EasaierSessionManager : public QObject { Q_OBJECT public: EasaierSessionManager(HttpClient* httpClient); virtual ~EasaierSessionManager(); class LoadedFile : public QFile { public: LoadedFile() : QFile(){} LoadedFile(const QString & name ) : QFile(name ){} virtual ~LoadedFile(){} enum FileType { UNKNOWN = 0, AUDIO_SOURCE_INFO = 1, // information (metadata) about an audio file MODEL = 2, // load a model in a existing layer METADATA = 3, // load the model and create an associated layer QUERY_CONFIG = 4, // config of the queries QUERY_RESULTS = 5, // query results RELATED_MEDIA_LIST = 6, // related media list RELATED_MEDIA = 7 // related media }; inline FileType getFileType() const {return m_type;} inline void setFileType(const FileType type) {m_type = type;} inline QString getUri() const {return m_uri;} inline void setUri(const QString& uri) {m_uri = uri;} protected: FileType m_type; QString m_uri; }; public: inline void setHttpClient(HttpClient* httpClient) {m_httpClient = httpClient;} void loadFile(const QString& query, const QString& filename, LoadedFile::FileType type); bool newSession(); void closeSession(); void closeFile(); /* open a existing session file: - open the audio source info file - load the appropriate metadata (needed by opened layers) */ bool openSession(Document *document); /* open an audio source info file */ bool openAudioInfoFile(Document *document); /*import metadata info in a new layer*/ void importMetadata(const QString& filename, Pane* pane); /*load all the related media from the list*/ void importRelatedMedia(std::list<QString> *relMediaList); /* load the appropriate metadata (needed by opened layers) of an audio file */ void loadRelatedModel(); /* add the metadata to the corresponding layers */ bool addModelToLayers(const QString& name, const QString& filename); /*query the database*/ void queryDatabase(const QString& themeName); public slots: void fileLoaded(int, bool); signals: void queryModelLoaded(QueryModel* queryModel); void audioFileLoaded(); private: QString m_fileName; HttpClient *m_httpClient; Document *m_document; std::map<int , LoadedFile*> m_loadFile; AudioSourceInfoModel *m_audioSourceInfoModel; std::set<QString> m_modelLoaded; Pane *m_currentPane; QueryModel *m_queryModel; }; #endif