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