]> git.vomp.tv Git - vompclient.git/blob - vmedialist.h
More compiler warning fixes
[vompclient.git] / vmedialist.h
1 /*
2     Copyright 2004-2005 Chris Tallon, Andreas Vogel
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #ifndef VMEDIALIST_H
22 #define VMEDIALIST_H
23
24 #include <stdio.h>
25 #include <string.h>
26 #include <vector>
27
28 #include "tbboxx.h"
29 #include "wselectlist.h"
30 #include "timers.h"
31 #include "timerreceiver.h"
32
33 class DirList;
34 class Message;
35 class BoxStack;
36 class Media;
37 class MediaList;
38 class MediaURI;
39 class VMediaView;
40 class MediaListHolder;
41
42 class VMediaList : public TBBoxx , public TimerReceiver
43 {
44   public:
45     VMediaList();
46     ~VMediaList();
47
48     void processMessage(Message* m);
49     int handleCommand(int command);
50     void draw();
51
52     //factory method
53     //return 0 on success
54     static int createList();
55
56     //move functions for getMedia
57     const static ULONG MV_NEXT=1;
58     const static ULONG MV_PREV=2;
59     const static ULONG MV_RND=3;
60     const static ULONG MV_NONE=0;
61
62     //move selection to the next matching media
63     //with the given move
64     //return NULL if none found
65     //the returned Media is a copy and must contain an URI!
66     Media * getMedia(ULONG type,ULONG move=MV_NONE);
67
68                 //get the number of media entries of particular types in this list
69                 //if lowerThen is set, only count entries lt this one
70                 int getNumEntries(ULONG mediaType,int lowerThen=-1,bool noAudiolist=false);
71
72     //get the directory of the current medium (display only)
73     const char * getDirname(ULONG mediaType) const;
74
75
76     //update all viewers/players
77     void updateAll();
78
79     //the engine on top of the viewer has finished
80     //its list
81     void directoryDone();
82
83     virtual void timercall(int ref);
84
85
86
87   private:
88     //set the media list, this makes no copy, list is owned by me afterwards
89     void setList(MediaListHolder* chanList);
90     /**
91       * fill the medialist basing on the current dirname
92       */
93     int           load();
94     VMediaView    *getViewer();
95     void          removeViewer();
96     void          playAudio(bool all=false,bool activate=false, bool showInfo=false);
97     BoxStack*     boxstack;
98     MediaListHolder *mediaList;
99     WSelectList   sl;
100     bool          loading;
101     void          doShowingBar();
102                 int           sortOrder;
103                 //sort list defined by new order
104                 void          sortList(int order);
105                 static const int SORT_NONE=0;
106                 static const int SORT_NAME=1;
107                 static const int SORT_TIME=2;
108                 static const int SORT_RANDOM=3;
109                 void          updateSelectList();
110                 void          updateSelectList(int current);
111     //start playing everything from the current selected Media
112     //the startlevel will be set to the current level
113     bool          playAll();
114     //change to the selected directory with updating
115     bool          changeDirectory(Media *m);
116     //update the selection in the dirlist from the selectlist
117     //or vice versa
118     void          updateSelection(bool toSelectList=false);
119     //find the next entry in a media list
120     //return -1 if none found, otherwise index in list
121     int           findNextEntry(int current, MediaList *list,ULONG ltype, ULONG move,bool wrap);
122     //get the currently selected media fro a list
123     Media *       getCurrentMedia(DirList *dl);
124                 DirList*      dirlist;
125     DirList*      audiodirlist;
126     VMediaView    *viewer;
127
128     enum Dirmode {
129       M_NONE,
130       M_AUDIO,
131       M_PICTURE,
132       M_COUNT
133     };
134     enum Dirmode dirmode;
135     bool playingAll; //flag for combined and recursive playing
136 };
137
138 #endif