Back to index

kdeartwork  4.3.2
slideshow.h
Go to the documentation of this file.
00001 /* Slide Show Screen Saver
00002  * (C) 1999 Stefan Taferner <taferner@kde.org>
00003  * (C) 2003 Sven Leiber <s.leiber@web.de>
00004  */
00005 
00006 
00007 #ifndef SLIDESHOW_H
00008 #define SLIDESHOW_H
00009 
00010 #include <QTimer>
00011 #include <QStringList>
00012 #include <QPixmap>
00013 #include <QImage>
00014 
00015 #include <kscreensaver.h>
00016 #include <kdialog.h>
00017 
00018 #include "ui_slideshowcfg.h"
00019 
00020 class SlideShowCfg : public QWidget, public Ui::SlideShowCfg
00021 {
00022 public:
00023   SlideShowCfg( QWidget *parent=0L ) : QWidget( parent ) {
00024     setupUi( this );
00025   }
00026 };
00027 
00028 
00029 //-----------------------------------------------------------------------------
00030 class kSlideShowSaver: public KScreenSaver
00031 {
00032   Q_OBJECT
00033 public:
00034   kSlideShowSaver( WId id );
00035   virtual ~kSlideShowSaver();
00036 
00037   typedef int (kSlideShowSaver::*EffectMethod)(bool);
00038 
00039   void readConfig();
00040 
00041   void restart();
00042 
00043 protected slots:
00044   void slotTimeout();
00045 
00046 protected:
00048   virtual void loadDirectory();
00049 
00051   virtual void traverseDirectory(const QString &dirName);
00052 
00056   virtual void loadNextImage();
00057 
00059   virtual void showNextScreen();
00060 
00062   virtual void createNextScreen();
00063 
00065   virtual void initNextScreen();
00066 
00068   virtual void registerEffects();
00069 
00072   int effectHorizLines(bool doInit);
00073   int effectVertLines(bool doInit);
00074   int effectRandom(bool doInit);
00075   int effectGrowing(bool doInit);
00076   int effectChessboard(bool doInit);
00077   int effectIncomingEdges(bool doInit);
00078   int effectBlobs(bool doInit);
00079   int effectCircleOut(bool doInit);
00080   int effectSweep(bool doInit);
00081   int effectMeltdown(bool doInit);
00082   int effectSpiralIn(bool doInit);
00083   int effectMultiCircleOut(bool doInit);
00084 
00085 protected:
00086   void paintEvent(QPaintEvent *);
00087 
00088 protected:
00089   struct mScreenGeo {
00090     mScreenGeo(int w, int h, int x, int y) : mW(w), mH(h), mXorg(x), mYorg(y) {};
00091     int mW;
00092     int mH;
00093     int mXorg;
00094     int mYorg;
00095   };
00096   QList<mScreenGeo> mGeoList;
00097   bool mEffectRunning;
00098   QTimer mTimer;
00099   QStringList mFileList;
00100   QStringList mRandomList;
00101   int mFileIdx;
00102   QImage mImage;
00103   QPixmap mNextScreen;
00104   EffectMethod* mEffectList;
00105   EffectMethod mEffect;
00106   int mNumEffects;
00107   QString mImageName;
00108 
00109   // config settings:
00110   bool mShowRandom;
00111   bool mZoomImages;
00112   bool mPrintName;
00113   bool mSubdirectory;
00114   bool mRandomPosition;
00115   int mDelay;
00116   QString mDirectory;
00117 
00118   // values for state of various effects:
00119   int mx, my, mw, mh, mdx, mdy, mix, miy, mi, mj, mSubType;
00120   int mx0, my0, mx1, my1, mwait;
00121   double mfx, mfy, mAlpha, mfd;
00122   int* mIntArray;
00123 };
00124 
00125 
00126 //-----------------------------------------------------------------------------
00127 class kSlideShowSetup : public KDialog
00128 {
00129   Q_OBJECT
00130 public:
00131   kSlideShowSetup(QWidget *parent=NULL);
00132   ~kSlideShowSetup();
00133 
00134 protected:
00135   void readSettings();
00136 
00137 protected slots:
00138   void slotOk();
00139   void slotHelp();
00140   void writeSettings();
00141   void slotDirSelected(const QString &where);
00142   void slotDirSelected(const KUrl &);
00143 private:
00144   kSlideShowSaver *mSaver;
00145   SlideShowCfg *cfg;
00146 };
00147 
00148 #endif /*SLIDESHOW_H*/
00149