Fix include
[kdeartwork.git] / kscreensaver / kdesavers / slideshow.h
blob973e07c7f6946a92ccdc8fcd4561a909b22aec42
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 //-----------------------------------------------------------------------------
23 class kSlideShowSaver: public KScreenSaver
25 Q_OBJECT
26 public:
27 kSlideShowSaver( WId id );
28 virtual ~kSlideShowSaver();
30 typedef int (kSlideShowSaver::*EffectMethod)(bool);
32 void readConfig();
34 void restart();
36 protected slots:
37 void slotTimeout();
39 protected:
40 void blank();
42 /** Load list of images from directory */
43 virtual void loadDirectory();
45 /** Helper for loadDirectory() */
46 virtual void traverseDirectory(const QString &dirName);
48 /** Load next image from list. If the file cannot be read
49 it is automatically removed from the file list.
50 mImage contains the image after loading. */
51 virtual void loadNextImage();
53 /** Show next screen, completely, without transition. */
54 virtual void showNextScreen();
56 /** Set loaded image to next-screen buffer. */
57 virtual void createNextScreen();
59 /** Initialize next-screen buffer. */
60 virtual void initNextScreen();
62 /** Register effect methods in effect list. */
63 virtual void registerEffects();
65 /** Various effects. If adding one, do not forget to manually
66 add the effect to the list in the registerEffects() method. */
67 int effectHorizLines(bool doInit);
68 int effectVertLines(bool doInit);
69 int effectRandom(bool doInit);
70 int effectGrowing(bool doInit);
71 int effectChessboard(bool doInit);
72 int effectIncomingEdges(bool doInit);
73 int effectBlobs(bool doInit);
74 int effectCircleOut(bool doInit);
75 int effectSweep(bool doInit);
76 int effectMeltdown(bool doInit);
77 int effectSpiralIn(bool doInit);
78 int effectMultiCircleOut(bool doInit);
80 protected:
81 /** Init mPainter with next-screen's pixmap and call
82 mPainter.begin(&mWidget) */
83 void startPainter(Qt::PenStyle penStyle=Qt::NoPen);
85 protected:
86 bool mEffectRunning;
87 QTimer mTimer;
88 QStringList mFileList;
89 QStringList mRandomList;
90 int mFileIdx;
91 QImage mImage;
92 QPixmap mNextScreen;
93 EffectMethod* mEffectList;
94 EffectMethod mEffect;
95 int mNumEffects;
96 QPainter mPainter;
97 QString mImageName;
99 // config settings:
100 bool mShowRandom;
101 bool mZoomImages;
102 bool mPrintName;
103 bool mSubdirectory;
104 bool mRandomPosition;
105 int mDelay;
106 QString mDirectory;
108 // values for state of various effects:
109 int mx, my, mw, mh, mdx, mdy, mix, miy, mi, mj, mSubType;
110 int mx0, my0, mx1, my1, mwait;
111 double mfx, mfy, mAlpha, mfd;
112 int* mIntArray;
116 //-----------------------------------------------------------------------------
117 class kSlideShowSetup : public KDialogBase
119 Q_OBJECT
120 public:
121 kSlideShowSetup(QWidget *parent=NULL, const char *name=NULL);
122 ~kSlideShowSetup();
124 protected:
125 void readSettings();
127 protected slots:
128 void slotOk();
129 void slotHelp();
130 void writeSettings();
131 void slotDirSelected(const QString &where);
133 private:
134 kSlideShowSaver *mSaver;
135 Ui_SlideShowCfg *cfg;
138 #endif /*SLIDESHOW_H*/