Added fullscreen button
[someplayer] / src / filestorage.h
1 #ifndef FILE_STORAGE
2 #define FILE_STORAGE
3
4 #include "someplayer.h"
5 #include "storage.h"
6 #include "playlist.h"
7 #include <QRegExp>
8
9 #define _CURRENT_PLAYLIST_NAME_ "___current"
10 #define _CURRENT_PLAYLIST_SUBST_ "Now playing"
11 #define _PLAYLIST_FILE_EXTENSION_ "spls"
12 #define _PLAYLIST_SIGNATURE_ "#SOMEPLAYLIST"
13 #define _PLAYLIST_META_KEYWORD_ "#META"
14 #define _PLAYLIST_PATH_KEYWORD_ "#PATH"
15
16 // format:
17 /*
18  #SOMEPLAYLIST
19  #META [ID][seconds],::artist::,::album::,::title::
20  #PATH file_path
21  #META [ID][seconds],::artist::,::album::,::title::
22  #PATH file_path
23  ...
24  */
25
26 // represents file-level storage
27 // it store data into separate files (e.g. playlist)
28
29 using SomePlayer::DataObjects::Playlist;
30
31 namespace SomePlayer {
32         namespace Storage {
33
34                 class FileStorage {
35                 public:
36                         FileStorage(QString path);
37
38                         QList<Playlist> getPlaylists();
39                         QStringList getPlaylistsNames();
40                         Playlist getPlaylist(QString name);
41                         void savePlaylist(Playlist playlist);
42                         void removePlaylist(Playlist playlist);
43                         void removePlaylist(QString name);
44
45                         Playlist getCurrentPlaylist();
46                         void saveCurrentPlaylist(Playlist playlist);
47                 private:
48                         QString _path_prefix;
49                         QRegExp _meta_regexp;
50                         QRegExp _path_regexp;
51                 };
52
53         };
54 };
55
56 #endif