summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/slideshow/slideshow.h
blob: 6f01feba3b2a6708f591ba59055019e42069848f (plain)
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* ============================================================
 *
 * This file is a part of kipi-plugins project
 * http://www.kipi-plugins.org
 *
 * Date        : 2003-02-16
 * Description : a kipi plugin to slide images.
 *
 * Copyright (C) 2006-2007 by Valerio Fuoglio <valerio dot fuoglio at gmail dot com>
 * Copyright (C) 2003-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * ============================================================ */

#ifndef SLIDESHOW_H
#define SLIDESHOW_H

// QT includes.

#include <tqvaluelist.h>
#include <tqstringlist.h>
#include <tqpair.h>
#include <tqstring.h>
#include <tqwidget.h>
#include <tqpainter.h>
#include <tqpixmap.h>
#include <tqmap.h>
#include <tqfont.h>
#include <tqstring.h>

// KDE includes.

#include <kconfig.h>
#include <kurl.h>

// Libkipi includes.

#include <libkipi/imagecollection.h>
#include <libkipi/interface.h>

// Local includes.

#include "slideshowloader.h"

class TQTimer;

typedef TQPair<TQString, int> FileAnglePair;
typedef TQValueList<FileAnglePair > FileList;

namespace KIPISlideShowPlugin
{
  
class ToolBar;

class SlideShow;

typedef int (SlideShow::*EffectMethod)(bool);
  
class SlideShow : public TQWidget
{

    Q_OBJECT
  
    
public:

    SlideShow(const FileList& fileList, const TQStringList& commentsList, bool ImagesHasComments);
    ~SlideShow();

    void registerEffects();

    static TQStringList effectNames();
    static TQMap<TQString,TQString> effectNamesI18N();

protected:

    void mousePressEvent(TQMouseEvent *event);
    void mouseMoveEvent(TQMouseEvent *);
    void wheelEvent(TQWheelEvent *);
    void keyPressEvent(TQKeyEvent *event);
    
    int effectNone(bool);
    int effectChessboard(bool doInit);
    int effectMeltdown(bool doInit);
    int effectSweep(bool doInit);
    int effectRandom(bool doInit);
    int effectGrowing(bool doInit);
    int effectIncom_ingEdges(bool doInit);
    int effectHorizLines(bool doInit);
    int effectVertLines(bool doInit);
    int effectMultiCircleOut(bool doInit);
    int effectSpiralIn(bool doInit);
    int effectCircleOut(bool doInit);
    int effectBlobs(bool doInit);
    
    void startPainter(TQt::PenStyle penStyle=NoPen);
    
private slots:

    void slotTimeOut();
    void slotMouseMoveTimeOut();

    void slotPause();
    void slotPlay();
    void slotPrev();
    void slotNext();
    void slotClose();
    
private:

    void          loadNextImage();
    void          loadPrevImage();
    void          showCurrentImage();
    void          printFilename();
    void          printComments();
    void          printProgress();
    EffectMethod  getRandomEffect();
    void          showEndOfShow();
    
    void          readSettings();
    
private:

    // config ------------------
    
    TDEConfig*    m_config;
    
    int         m_delay;
    bool        m_printName;
    bool        m_printComments;
    bool        m_printProgress;
    TQString     m_effectName;
    bool        m_loop;

    bool        m_ImagesHasComments;

    TQFont*      m_commentsFont;
    uint        m_commentsFontColor;
    uint        m_commentsBgColor;
    int         m_commentsLinesLength;
    
    bool        m_enableMouseWheel;
    
    uint        m_cacheSize;
    // -------------------------
    
    TQMap<TQString, EffectMethod> Effects;

    SlideShowLoader*   m_imageLoader;
    TQPixmap* m_currImage;
    
    FileList    m_fileList;
    TQStringList m_commentsList;
    TQTimer*     m_timer;
    int         m_fileIndex;

    EffectMethod m_effect;
    bool         m_effectRunning;

    // values for state of various effects:
    int      m_x, m_y, m_w, m_h, m_dx, m_dy, m_ix, m_iy, m_i, m_j, m_subType;
    int      m_x0, m_y0, m_x1, m_y1, m_wait;
    double   m_fx, m_fy, m_alpha, m_fd;
    int*     m_intArray;
    TQPainter m_painter;

    ToolBar*     m_toolBar;
    TQTimer*      m_mouseMoveTimer;
    bool         m_endOfShow;
    
    int          m_deskX;
    int          m_deskY;
    int          m_deskWidth;
    int          m_deskHeight;
};

}  // NameSpace KIPISlideShowPlugin

#endif /* SLIDESHOW_H */