]> git.vomp.tv Git - vompclient.git/blob - vmedialist.h
Replace TCP. Use new IP API only, getMAC works with if!=eth0
[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
32 class DirList;
33 class Message;
34 class BoxStack;
35 class Media;
36 class MediaList;
37 class MediaURI;
38 class VMediaView;
39 class MediaListHolder;
40
41 class VMediaList : public TBBoxx , public TimerReceiver
42 {
43   public:
44     VMediaList();
45     ~VMediaList();
46
47     void processMessage(Message* m);
48     int handleCommand(int command);
49     void draw();
50
51     //factory method
52     //return 0 on success
53     static int createList();
54
55     //move functions for getMedia
56     const static ULONG MV_NEXT=1;
57     const static ULONG MV_PREV=2;
58     const static ULONG MV_RND=3;
59     const static ULONG MV_NONE=0;
60
61     //move selection to the next matching media
62     //with the given move
63     //return NULL if none found
64     //the returned Media is a copy and must contain an URI!
65     Media * getMedia(ULONG type,ULONG move=MV_NONE);
66
67                 //get the number of media entries of particular types in this list
68                 //if lowerThen is set, only count entries lt this one
69                 int getNumEntries(ULONG mediaType,int lowerThen=-1,bool noAudiolist=false);
70
71     //get the directory of the current medium (display only)
72     const char * getDirname(ULONG mediaType) const;
73
74
75     //update all viewers/players
76     void updateAll();
77
78     //the engine on top of the viewer has finished
79     //its list
80     void directoryDone();
81
82     virtual void timercall(int ref);
83
84
85
86   private:
87     //set the media list, this makes no copy, list is owned by me afterwards
88     void setList(MediaListHolder* chanList);
89     /**
90       * fill the medialist basing on the current dirname
91       */
92     int           load();
93     VMediaView    *getViewer();
94     void          removeViewer();
95     void          playAudio(bool all=false,bool activate=false, bool showInfo=false);
96     BoxStack*     boxstack;
97     MediaListHolder *mediaList;
98     WSelectList   sl;
99     bool          loading;
100     void          doShowingBar();
101                 int           sortOrder;
102                 //sort list defined by new order
103                 void          sortList(int order);
104                 static const int SORT_NONE=0;
105                 static const int SORT_NAME=1;
106                 static const int SORT_TIME=2;
107                 static const int SORT_RANDOM=3;
108                 void          updateSelectList();
109                 void          updateSelectList(int current);
110     //start playing everything from the current selected Media
111     //the startlevel will be set to the current level
112     bool          playAll();
113     //change to the selected directory with updating
114     bool          changeDirectory(Media *m);
115     //update the selection in the dirlist from the selectlist
116     //or vice versa
117     void          updateSelection(bool toSelectList=false);
118     //find the next entry in a media list
119     //return -1 if none found, otherwise index in list
120     int           findNextEntry(int current, MediaList *list,ULONG ltype, ULONG move,bool wrap);
121     //get the currently selected media fro a list
122     Media *       getCurrentMedia(DirList *dl);
123                 DirList*      dirlist;
124     DirList*      audiodirlist;
125     VMediaView    *viewer;
126
127     enum Dirmode {
128       M_NONE,
129       M_AUDIO,
130       M_PICTURE,
131       M_COUNT
132     };
133     enum Dirmode dirmode;
134     bool playingAll; //flag for combined and recursive playing
135 };
136
137 #endif