Mercurial > hg > easaier-soundaccess
comparison sv/main/EasaierSessionManager.h @ 21:ac5491829e61
add
- EasaierSessionManager
- Easaier menus
- Interval model
author | lbajardsilogic |
---|---|
date | Mon, 14 May 2007 13:15:26 +0000 |
parents | |
children | 87495ac7710a |
comparison
equal
deleted
inserted
replaced
20:32d0a863e040 | 21:ac5491829e61 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* Sound Access | |
4 EASAIER client application. | |
5 Silogic 2007. Laure Bajard. | |
6 | |
7 This program is free software; you can redistribute it and/or | |
8 modify it under the terms of the GNU General Public License as | |
9 published by the Free Software Foundation; either version 2 of the | |
10 License, or (at your option) any later version. See the file | |
11 COPYING included with this distribution for more information. | |
12 */ | |
13 | |
14 #ifndef _EASAIER_SESSION_MANAGER_H_ | |
15 #define _EASAIER_SESSION_MANAGER_H_ | |
16 | |
17 #include <QObject> | |
18 #include <QFile> | |
19 | |
20 #include <map> | |
21 #include <set> | |
22 | |
23 #include "data/fileio/HttpClient.h" | |
24 #include "document/Document.h" | |
25 #include "view/Pane.h" | |
26 #include "data/model/QueryModel.h" | |
27 | |
28 class EasaierSessionManager : public QObject | |
29 { | |
30 Q_OBJECT | |
31 public: | |
32 EasaierSessionManager(HttpClient* httpClient); | |
33 virtual ~EasaierSessionManager(); | |
34 | |
35 class LoadedFile : public QFile | |
36 { | |
37 public: | |
38 LoadedFile() : QFile(){} | |
39 LoadedFile(const QString & name ) : QFile(name ){} | |
40 virtual ~LoadedFile(){} | |
41 | |
42 enum FileType { | |
43 UNKNOWN = 0, | |
44 AUDIO_SOURCE_INFO = 1, // information (metadata) about an audio file | |
45 MODEL = 2, // load a model in a existing layer | |
46 METADATA = 3, // load the model and create an associated layer | |
47 QUERY_CONFIG = 4, // config of the queries | |
48 QUERY_RESULTS = 5 // query results | |
49 }; | |
50 | |
51 inline FileType getFileType() const {return m_type;} | |
52 inline void setFileType(const FileType type) {m_type = type;} | |
53 | |
54 inline QString getUri() const {return m_uri;} | |
55 inline void setUri(const QString& uri) {m_uri = uri;} | |
56 | |
57 protected: | |
58 FileType m_type; | |
59 | |
60 QString m_uri; | |
61 | |
62 }; | |
63 | |
64 public: | |
65 | |
66 inline void setHttpClient(HttpClient* httpClient) {m_httpClient = httpClient;} | |
67 | |
68 void loadFile(const QString& uri, LoadedFile::FileType type); | |
69 | |
70 bool newSession(); | |
71 void closeSession(); | |
72 void closeFile(); | |
73 | |
74 /* open a existing session file: | |
75 - open the audio source info file | |
76 - load the appropriate metadata (needed by opened layers) | |
77 */ | |
78 bool openSession(Document *document); | |
79 | |
80 /* open an audio source info file | |
81 */ | |
82 bool openAudioInfoFile(Document *document); | |
83 | |
84 /*import metadata info in a new layer*/ | |
85 void importMetadata(const QString& filename, Pane* pane); | |
86 | |
87 /* load the appropriate metadata (needed by opened layers) | |
88 of an audio file | |
89 */ | |
90 void loadRelatedModel(); | |
91 | |
92 /* add the metadata to the corresponding layers */ | |
93 bool addModelToLayers(const QString& name, const QString& filename); | |
94 | |
95 /*query the database*/ | |
96 void queryDatabase(const QString& themeName); | |
97 | |
98 public slots: | |
99 void fileLoaded(int, bool); | |
100 | |
101 signals: | |
102 void queryModelLoaded(QueryModel* queryModel); | |
103 | |
104 private: | |
105 | |
106 | |
107 QString m_fileName; | |
108 | |
109 HttpClient *m_httpClient; | |
110 | |
111 Document *m_document; | |
112 | |
113 std::map<int , LoadedFile*> m_loadFile; | |
114 | |
115 AudioSourceInfoModel *m_audioSourceInfoModel; | |
116 | |
117 std::set<QString> m_modelLoaded; | |
118 | |
119 Pane *m_currentPane; | |
120 | |
121 QueryModel *m_queryModel; | |
122 }; | |
123 | |
124 #endif |