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 "imagereader.h"
43 * will ineract with the parent List for ff,back, slide show...
50 class VMediaView : public Boxx, public TimerReceiver
52 friend class VPReader;
56 void processMessage(Message* m);
57 int handleCommand(int command);
59 void timercall(int clientReference);
60 //factory method, create an instance (setting it disabled)
61 //return NULL on error
62 static VMediaView *createViewer(VMediaList * parent);
63 //show the picture currently selected in the parent
64 //potentially moving to next/previous one
65 void showPicture(ULONG move,bool bslideshow,bool forceBanner);
67 void enableBanner(bool enable);
70 //if activate is false no info will be shown
71 int play(bool all,bool activate,ULONG move=VMediaList::MV_NONE,bool showInfo=false);
73 //check if the audio player is still running
74 //to decide wether to shutdown or not
75 bool isAudioPlaying();
77 //player event parameters - no interference with audioplayer! - so we start at 100
78 const static int EVENT_SLIDESHOW;
79 const static int EVENT_DRAWINGDONE;
80 const static int EVENT_DRAWINGERROR;
81 const static int EVENT_DIRECTORYDONE;
87 * *************************************************************
89 void setPictureMode(bool enabled);
90 void setAudioMode(bool enabled,bool doHiding=true);
91 //destroy a view (banner, info) - from timer calls
92 void sendViewMsg(Boxx *v);
93 //send command in main thread - especially if this view is not on top
94 void sendCommandMsg(int command);
96 VMediaView(VMediaList * plist);
104 * *************************************************************
106 const static int PICTUREBANNER_TIME=8;
108 void startSlideshow();
110 void stopSlideshow(bool hard=true);
111 //showXXX functions enable the corresponding banner and restart the timer
112 //updateXXX functions update the content but do not retrigger the timer
113 void showPictureBanner(bool loading=false);
114 void destroyPictureBanner(bool fromTimer=false);
115 void updatePictureBanner(bool loading=false);
116 void showPictureInfo();
117 void updatePictureInfo();
118 void destroyInfo(bool fromTimer=false);
119 int loadPicture(Media *m,bool forceBanner);
120 void getDrawingParam(Surface *&sfc,WJpeg::JpegControl *&ctl);
121 void switchSurface(); //will switch surface and currentControl
122 void drawingDone(bool hasError);
124 // Picture member variables
125 VPreader *reader; //the reader for the drawing part
126 ImageReader *ireader;//the buffered media reader
127 VPictureBanner *pictureBanner;
128 bool havePictureBanner; //dow we have a normal banner (except during loading)
130 bool pictureShowing; //set to false if loading next is impossible
133 const char * pictureError;
134 Media * currentPicture;
135 const static int INITIAL_SHOWTIME=5;
136 WJpeg::Rotation rotate;
137 WJpeg::ScaleMode cropmode;
139 static Colour pictureBack;
140 static Colour infoBack;
141 static Colour audioBannerBack;
143 MediaOptions *options;
144 WJpeg::JpegControl ctl;
145 WJpeg::JpegControl ctl2;
146 WJpeg::JpegControl *currentControl;
149 //which is the active surface
150 bool secondSurface(){
151 return surface == sfc2;
157 DrawingThread *drawingThread;
160 * *************************************************************
162 const static int AUDIOBANNER_TIME=30;
163 const static int AUDIOERROR_TIME=5;
166 //margin on SCREEN on each side
167 const static int AUDIOBANNER_X_MARGIN=50;
168 //margin on bottom of screen
169 const static int AUDIOBANNER_BOTTOM_MARGIN=30;
170 //length of the progress bar
171 const static int AUDIOBARLEN=250;
173 //the AudioInfo uses the same member as the PictureInfo
174 //so only one of them can be active at the same time
175 void updateAudioInfo();
176 void showAudioInfo();
177 void drawAudioInfo();
178 void drawAudioClocks();
179 void showAudioBanner();
180 void destroyAudioBanner(); //currently not called from timer!
181 //get the player - create it if necessary
182 AudioPlayer* getPlayer(bool create=true);
184 const char * audioError;
185 Media * currentAudio;
190 //retrigger info on events?
191 bool retriggerAudioInfo;