AlbumShaper
1.0a3
|
00001 //============================================== 00002 // copyright : (C) 2003-2005 by Will Stokes 00003 //============================================== 00004 // This program is free software; you can redistribute it 00005 // and/or modify it under the terms of the GNU General 00006 // Public License as published by the Free Software 00007 // Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 //============================================== 00010 00011 #ifndef GUI_PRESENTATION_SLIDESHOWWIDGET_H 00012 #define GUI_PRESENTATION_SLIDESHOWWIDGET_H 00013 00014 //-------------------- 00015 //forward declarations 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 //advance one photo 00075 void advancePhoto(); 00076 00077 //backup one photo 00078 void backupPhoto(); 00079 00080 //skip to first photo in collection 00081 void skipToFirstPhoto(); 00082 00083 //skip to last photo in collection 00084 void skipToLastPhoto(); 00085 00086 //advance one collection 00087 void advanceCollection(); 00088 00089 //backup one collection 00090 void backupCollection(); 00091 00092 //turn off mouse cursor 00093 void hideMouse(); 00094 00095 //toggle auto play 00096 void toggleAutoPlay(); 00097 00098 //end the slideshow 00099 void stop(); 00100 00101 //speed up presentation 00102 void speedUp(); 00103 00104 //slow down presentation 00105 void slowDown(); 00106 00107 //increse text font size 00108 void increaseTextSize(); 00109 00110 //decrease text font size 00111 void decreaseTextSize(); 00112 00113 //trap context menu hiding signals and store 00114 //this info in a bool which disables moving on to the next phot in 00115 //respone to a mouse press 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 //paint buffers 00138 QPixmap *paintBufferPrev, *paintBufferCurr; 00139 QPixmap paintBuffer1, paintBuffer2, screenBuffer; 00140 00141 //speed images 00142 QImage speed1, speed2, speed4, speed8; 00143 00144 //control images 00145 QImage pauseInterface, playInterface, interfaceAlphaMask; 00146 00147 //full screen size 00148 int screenWidth, screenHeight; 00149 00150 //specs for ongoing animation 00151 int lastStep, step; 00152 double initDelay, minDelay, delay, accel; 00153 00154 //specs for autoplay 00155 QTimer* autoPlayTimer; 00156 int autoPlayDelay; 00157 bool autoPlay; 00158 bool displayAutoPlayDelay; 00159 00160 //timer and time variables for ongoing animation 00161 QTimer *animatingTimer; 00162 QTime lastTime, currentTime; 00163 00164 //animating variable and mutex 00165 bool animating; 00166 ANIMATION_TYPE type; 00167 QMutex animatingMutex; 00168 00169 //display debug messages? 00170 bool displayDebugMessages; 00171 00172 //font size 00173 int fontSize; 00174 00175 //timer for turning off mouse cursor 00176 QTimer *mouseCursorTimer; 00177 bool mouseShown; 00178 00179 //right click context menu 00180 bool contextMenuShown; 00181 bool contextMenuHidingBool; 00182 //---------------------- 00183 }; 00184 //====================== 00185 00186 #endif //GUI_PRESENTATION_SLIDESHOWWIDGET_H