00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef GUI_PRESENTATION_SLIDESHOWWIDGET_H
00012 #define GUI_PRESENTATION_SLIDESHOWWIDGET_H
00013
00014
00015
00016
00017 class Album;
00018 class Subalbum;
00019 class Photo;
00020 class QTimer;
00021
00022 #include <qwidget.h>
00023 #include <qimage.h>
00024 #include <qpixmap.h>
00025 #include <qdatetime.h>
00026 #include <qmutex.h>
00027
00028 typedef enum
00029 {
00030 AUTO_PLAY,
00031 IMMEDIATE,
00032 SCROLL_LEFT,
00033 SCROLL_RIGHT,
00034 SCROLL_UP,
00035 SCROLL_DOWN
00036 } ANIMATION_TYPE;
00037
00038
00039 class SlideshowWidget : public QWidget
00040 {
00041 Q_OBJECT
00042
00043 public:
00044 SlideshowWidget( QWidget *parent=0, const char* name=0, WFlags f=0 );
00045 void beginSlideshow(Album* albm, Subalbum* startCollection=NULL, Photo* startPhoto=NULL);
00046
00048 Subalbum* getCurCollection();
00049
00051 Photo* getCurPhoto();
00052
00053 protected:
00054 void paintEvent( QPaintEvent* );
00055 void keyPressEvent(QKeyEvent *e);
00056 void mousePressEvent(QMouseEvent *e);
00057 void mouseMoveEvent( QMouseEvent *e);
00058 void contextMenuEvent ( QContextMenuEvent* e );
00059
00060 void showCoverPage();
00061 void showCollectionPage(Subalbum* subalbum);
00062 void loadPhoto();
00063 void showPhoto();
00064 void refreshScreen();
00065 void paintOverlaidControls();
00066 void exchangePhotos();
00067
00068 signals:
00069 void endSlideshow();
00070
00071 private slots:
00072 void animate();
00073
00074
00075 void advancePhoto();
00076
00077
00078 void backupPhoto();
00079
00080
00081 void skipToFirstPhoto();
00082
00083
00084 void skipToLastPhoto();
00085
00086
00087 void advanceCollection();
00088
00089
00090 void backupCollection();
00091
00092
00093 void hideMouse();
00094
00095
00096 void toggleAutoPlay();
00097
00098
00099 void stop();
00100
00101
00102 void speedUp();
00103
00104
00105 void slowDown();
00106
00107
00108 void increaseTextSize();
00109
00110
00111 void decreaseTextSize();
00112
00113
00114
00115
00116 void contextMenuHiding();
00117
00118 private:
00119 QString themePath;
00120 Album* curAlbum;
00121 Subalbum* curCollection;
00122 Photo* curPhoto;
00123
00124 int photoNum, collectionNum;
00125
00126 bool photoLoaded;
00127
00128 QImage scaledImage1, scaledImage2;
00129 QImage* currImage;
00130 QImage* prevImage;
00131
00132 QImage Top_TextBorder, Bottom_TextBorder,
00133 Left_TextBorder, Right_TextBorder,
00134 TL_TextBorder, TR_TextBorder,
00135 BL_TextBorder, BR_TextBorder;
00136
00137
00138 QPixmap *paintBufferPrev, *paintBufferCurr;
00139 QPixmap paintBuffer1, paintBuffer2, screenBuffer;
00140
00141
00142 QImage speed1, speed2, speed4, speed8;
00143
00144
00145 QImage pauseInterface, playInterface, interfaceAlphaMask;
00146
00147
00148 int screenWidth, screenHeight;
00149
00150
00151 int lastStep, step;
00152 double initDelay, minDelay, delay, accel;
00153
00154
00155 QTimer* autoPlayTimer;
00156 int autoPlayDelay;
00157 bool autoPlay;
00158 bool displayAutoPlayDelay;
00159
00160
00161 QTimer *animatingTimer;
00162 QTime lastTime, currentTime;
00163
00164
00165 bool animating;
00166 ANIMATION_TYPE type;
00167 QMutex animatingMutex;
00168
00169
00170 bool displayDebugMessages;
00171
00172
00173 int fontSize;
00174
00175
00176 QTimer *mouseCursorTimer;
00177 bool mouseShown;
00178
00179
00180 bool contextMenuShown;
00181 bool contextMenuHidingBool;
00182
00183 };
00184
00185
00186 #endif //GUI_PRESENTATION_SLIDESHOWWIDGET_H