summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/slideshow/slideshowgl.h
blob: dd8163d005b9685fe41adfe6d31a3590bb0230eb (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
/* ============================================================
 * File  : slideshowgl.h
 * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
 * Date  : 2004-01-19
 * Description : 
 * 
 * Copyright 2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
 * Copyright 2007 by Valerio Fuoglio <valerio.fuoglio@gmail.com>
 *
 * 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 SLIDESHOWGL_H
#define SLIDESHOWGL_H

// KDE includes
#include <kconfig.h>

// QT includes 
#include <tqvaluelist.h>
#include <tqstringlist.h>
#include <tqpair.h>
#include <tqstring.h>
#include <tqmap.h>
#include <tqgl.h>

// Local includes
#include "slideshowloader.h"

class TQTimer;

namespace KIPISlideShowPlugin
{
  class SlideShowGL;
  class ToolBar;
  
  class SlideShowGL : public TQGLWidget
  {
        Q_OBJECT
  
        
    public:
    
        SlideShowGL(const TQValueList<TQPair<TQString, int> >& fileList,
                    const TQStringList& commentsList, bool ImagesHasComments);
        ~SlideShowGL();
    
        void registerEffects();
    
        static TQStringList effectNames();
        static TQMap<TQString,TQString> effectNamesI18N();
        
    protected:
    
        void initializeGL();
        void paintGL();
        void resizeGL(int w, int h);
        
        void mousePressEvent(TQMouseEvent *event);
        void mouseMoveEvent(TQMouseEvent *);
        void wheelEvent(TQWheelEvent *e);
        void keyPressEvent(TQKeyEvent *event);
            
    private:
    
        // config ------------------
    
        KConfig*    m_config;
        
        int         m_delay;
        TQString     m_effectName;
        bool        m_loop;
        bool        m_printName;
        bool        m_printProgress;
        bool        m_printComments;
        
        bool        m_imagesHasComments;
        
        TQFont*      m_commentsFont;
        uint        m_commentsFontColor;
        uint        m_commentsBgColor;
        int         m_commentsLinesLength;
        
        bool        m_enableMouseWheel;
    
        uint         m_cacheSize;
        // -------------------------
        
        typedef void (SlideShowGL::*EffectMethod)();
        TQMap<TQString, EffectMethod> m_effects;
    
        TQValueList<TQPair<TQString, int> >  m_fileList;
        TQStringList  m_commentsList;
        TQTimer*      m_timer;
        int          m_fileIndex;
    
        SlideShowLoader*   m_imageLoader;
        GLuint             m_texture[2];
        bool               m_tex1First;
        int                m_curr;
        
        int          m_width;
        int          m_height;
    
        EffectMethod m_effect;
        bool         m_effectRunning;
        int          m_timeout;
        bool         m_random;
        bool         m_endOfShow;
    
        int          m_i;
        int          m_dir;
        float        m_points[40][40][3];
    
        ToolBar*     m_toolBar;
        TQTimer*      m_mouseMoveTimer;
    
        int          m_deskX;
        int          m_deskY;
        int          m_deskWidth;
        int          m_deskHeight;
        
    private:
    
        void          paintTexture();
        void          advanceFrame();
        void          previousFrame();
        void          loadImage();
        void          montage(TQImage& top, TQImage& bot);
        EffectMethod  getRandomEffect();
        void          showEndOfShow();
        void          printFilename(TQImage& layer);
        void          printProgress(TQImage& layer);
        void          printComments(TQImage& layer);
        
        void          readSettings();
        
        void          effectNone();
        void          effectBlend();
        void          effectFade();
        void          effectRotate();
        void          effectBend();
        void          effectInOut();
        void          effectSlide();
        void          effectFlutter();
        void          effectCube();
        
        
    private slots:
    
        void slotTimeOut();
        void slotMouseMoveTimeOut();
    
        void slotPause();
        void slotPlay();
        void slotPrev();
        void slotNext();
        void slotClose();
  };

}  // NameSpace KIPISlideShowPlugin

#endif /* SLIDESHOWGL_H */