2 Copyright 2004-2005 Chris Tallon, Andreas Vogel
4 This file is part of VOMP.
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.
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.
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.
29 #include "timerreceiver.h"
30 #include "vmedialist.h"
33 #include "wjpegcomplex.h"
34 #include "imagereader.h"
44 * will ineract with the parent List for ff,back, slide show...
51 class VMediaView : public Boxx, public TimerReceiver
53 friend class VPReader;
55 virtual ~VMediaView();
57 void processMessage(Message* m);
58 int handleCommand(int command);
60 void timercall(int clientReference);
61 //factory method, create an instance (setting it disabled)
62 //return NULL on error
63 static VMediaView *createViewer(VMediaList * parent);
64 //show the picture currently selected in the parent
65 //potentially moving to next/previous one
66 void showPicture(ULONG move,bool bslideshow,bool forceBanner);
68 void enableBanner(bool enable);
71 //if activate is false no info will be shown
72 int play(bool all,bool activate,ULONG move=VMediaList::MV_NONE,bool showInfo=false);
74 //check if the audio player is still running
75 //to decide wether to shutdown or not
76 bool isAudioPlaying();
78 //player event parameters - no interference with audioplayer! - so we start at 100
79 const static int EVENT_SLIDESHOW;
80 const static int EVENT_DRAWINGDONE;
81 const static int EVENT_DRAWINGERROR;
82 const static int EVENT_DIRECTORYDONE;
88 * *************************************************************
90 void setPictureMode(bool enabled);
91 void setAudioMode(bool enabled,bool doHiding=true);
92 //destroy a view (banner, info) - from timer calls
93 void sendViewMsg(Boxx *v);
94 //send command in main thread - especially if this view is not on top
95 void sendCommandMsg(int command);
97 VMediaView(VMediaList * plist);
105 * *************************************************************
107 const static int PICTUREBANNER_TIME=8;
109 void startSlideshow();
111 void stopSlideshow(bool hard=true);
112 //showXXX functions enable the corresponding banner and restart the timer
113 //updateXXX functions update the content but do not retrigger the timer
114 void showPictureBanner(bool loading=false);
115 void destroyPictureBanner(bool fromTimer=false);
116 void updatePictureBanner(bool loading=false);
117 void showPictureInfo();
118 void updatePictureInfo();
119 void destroyInfo(bool fromTimer=false);
120 int loadPicture(Media *m,bool forceBanner);
121 void getDrawingParam(Surface *&sfc,WJpegComplex::JpegControl *&ctl);
122 void switchSurface(); //will switch surface and currentControl
123 void drawingDone(bool hasError);
125 // Picture member variables
126 VPreader *reader; //the reader for the drawing part
127 ImageReader *ireader;//the buffered media reader
128 VPictureBanner *pictureBanner;
129 bool havePictureBanner; //dow we have a normal banner (except during loading)
131 bool pictureShowing; //set to false if loading next is impossible
134 const char * pictureError;
135 Media * currentPicture;
136 const static int INITIAL_SHOWTIME=5;
137 WJpegComplex::Rotation rotate;
138 WJpegComplex::ScaleMode cropmode;
140 static DrawStyle pictureBack;
141 static DrawStyle infoBack;
142 static DrawStyle audioBannerBack;
144 MediaOptions *options;
145 WJpegComplex::JpegControl ctl;
146 WJpegComplex::JpegControl ctl2;
147 WJpegComplex::JpegControl *currentControl;
150 //which is the active surface
151 bool secondSurface(){
152 return surface == sfc2;
158 DrawingThread *drawingThread;
161 * *************************************************************
163 const static int AUDIOBANNER_TIME=30;
164 const static int AUDIOERROR_TIME=5;
167 //margin on SCREEN on each side
168 const static int AUDIOBANNER_X_MARGIN=50;
169 //margin on bottom of screen
170 const static int AUDIOBANNER_BOTTOM_MARGIN=30;
171 //length of the progress bar
172 const static int AUDIOBARLEN=250;
174 //the AudioInfo uses the same member as the PictureInfo
175 //so only one of them can be active at the same time
176 void updateAudioInfo();
177 void showAudioInfo();
178 void drawAudioInfo();
179 void drawAudioClocks();
180 void showAudioBanner();
181 void destroyAudioBanner(); //currently not called from timer!
182 //get the player - create it if necessary
183 AudioPlayer* getPlayer(bool create=true);
185 const char * audioError;
186 Media * currentAudio;
191 //retrigger info on events?
192 bool retriggerAudioInfo;