Qt3to4
[kdeartwork.git] / kscreensaver / kdesavers / slideshow.h
blob735c9a7714860b12a523eb133077682a41249a11
1 /* Slide Show Screen Saver
2 * (C) 1999 Stefan Taferner <taferner@kde.org>
3 * (C) 2003 Sven Leiber <s.leiber@web.de>
4 */
7 #ifndef SLIDESHOW_H
8 #define SLIDESHOW_H
10 #include <qtimer.h>
11 #include <q3ptrlist.h>
12 #include <qstringlist.h>
13 #include <qpixmap.h>
14 #include <qpainter.h>
15 #include <qimage.h>
17 #include <kscreensaver.h>
18 #include <kdialogbase.h>
20 #include "slideshowcfg.h"
22 class SlideShowCfg;
24 //-----------------------------------------------------------------------------
25 class kSlideShowSaver: public KScreenSaver
27 Q_OBJECT
28 public:
29 kSlideShowSaver( WId id );
30 virtual ~kSlideShowSaver();
32 typedef int (kSlideShowSaver::*EffectMethod)(bool);
34 void readConfig();
36 void restart();
38 protected slots:
39 void slotTimeout();
41 protected:
42 void blank();
44 /** Load list of images from directory */
45 virtual void loadDirectory();
47 /** Helper for loadDirectory() */
48 virtual void traverseDirectory(const QString &dirName);
50 /** Load next image from list. If the file cannot be read
51 it is automatically removed from the file list.
52 mImage contains the image after loading. */
53 virtual void loadNextImage();
55 /** Show next screen, completely, without transition. */
56 virtual void showNextScreen();
58 /** Set loaded image to next-screen buffer. */
59 virtual void createNextScreen();
61 /** Initialize next-screen buffer. */
62 virtual void initNextScreen();
64 /** Register effect methods in effect list. */
65 virtual void registerEffects();
67 /** Various effects. If adding one, do not forget to manually
68 add the effect to the list in the registerEffects() method. */
69 int effectHorizLines(bool doInit);
70 int effectVertLines(bool doInit);
71 int effectRandom(bool doInit);
72 int effectGrowing(bool doInit);
73 int effectChessboard(bool doInit);
74 int effectIncomingEdges(bool doInit);
75 int effectBlobs(bool doInit);
76 int effectCircleOut(bool doInit);
77 int effectSweep(bool doInit);
78 int effectMeltdown(bool doInit);
79 int effectSpiralIn(bool doInit);
80 int effectMultiCircleOut(bool doInit);
82 protected:
83 /** Init mPainter with next-screen's pixmap and call
84 mPainter.begin(&mWidget) */
85 void startPainter(Qt::PenStyle penStyle=Qt::NoPen);
87 protected:
88 bool mEffectRunning;
89 QTimer mTimer;
90 int mColorContext;
91 QStringList mFileList;
92 QStringList mRandomList;
93 int mFileIdx;
94 QImage mImage;
95 QPixmap mNextScreen;
96 EffectMethod* mEffectList;
97 EffectMethod mEffect;
98 int mNumEffects;
99 QPainter mPainter;
100 QString mImageName;
102 // config settings:
103 bool mShowRandom;
104 bool mZoomImages;
105 bool mPrintName;
106 bool mSubdirectory;
107 bool mRandomPosition;
108 int mDelay;
109 QString mDirectory;
111 // values for state of various effects:
112 int mx, my, mw, mh, mdx, mdy, mix, miy, mi, mj, mSubType;
113 int mx0, my0, mx1, my1, mwait;
114 double mfx, mfy, mAlpha, mfd;
115 int* mIntArray;
119 //-----------------------------------------------------------------------------
120 class kSlideShowSetup : public KDialogBase
122 Q_OBJECT
123 public:
124 kSlideShowSetup(QWidget *parent=NULL, const char *name=NULL);
125 ~kSlideShowSetup();
127 protected:
128 void readSettings();
130 protected slots:
131 void slotOk();
132 void slotHelp();
133 void writeSettings();
134 void slotDirSelected(const QString &where);
136 private:
137 kSlideShowSaver *mSaver;
138 SlideShowCfg *cfg;
141 #endif /*SLIDESHOW_H*/