digiKam
kbeffect.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2007-11-14
7  * Description : a presentation tool.
8  *
9  * Copyright (C) 2007-2008 by Valerio Fuoglio <valerio dot fuoglio at gmail dot com>
10  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * Parts of this code are based on smoothslidesaver by Carsten Weinhold
13  * <carsten dot weinhold at gmx dot de>
14  *
15  * This program is free software; you can redistribute it
16  * and/or modify it under the terms of the GNU General
17  * Public License as published by the Free Software Foundation;
18  * either version 2, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_KB_EFFECT_H
28 #define DIGIKAM_KB_EFFECT_H
29 
30 // Qt includes
31 
32 #include <QObject>
33 
35 {
36 
37 class KBImage;
38 class PresentationKB;
39 
40 class KBEffect
41 {
42 
43 public:
44 
45  typedef enum
46  {
48  Blend
49  } Type;
50 
51 public:
52 
53  explicit KBEffect(PresentationKB* const parent, bool m_needFadeIn = true);
54  virtual ~KBEffect() = default;
55 
56  virtual bool fadeIn() const
57  {
58  return m_needFadeIn;
59  };
60 
61  virtual void advanceTime(float step) = 0;
62  virtual Type type() = 0;
63  virtual bool done() = 0;
64 
65  static Type chooseKBEffect(Type oldType);
66 
67 protected:
68 
69  void setupNewImage(int img);
70  void swapImages();
71  KBImage* image(int img) const;
72 
73 protected:
74 
78 
79 private:
80 
81  PresentationKB* m_slideWidget;
82 
83 private:
84 
85  Q_DISABLE_COPY(KBEffect)
86 };
87 
88 // -------------------------------------------------------------------------
89 
90 class FadeKBEffect: public KBEffect
91 {
92 
93 public:
94 
95  explicit FadeKBEffect(PresentationKB* const parent, bool m_needFadeIn = true);
96  ~FadeKBEffect() override;
97 
98  Type type() override
99  {
100  return Fade;
101  };
102 
103  void advanceTime(float step) override;
104  bool done() override;
105 
106 private:
107 
108  Q_DISABLE_COPY(FadeKBEffect)
109 };
110 
111 // -------------------------------------------------------------------------
112 
113 class BlendKBEffect: public KBEffect
114 {
115 
116 public:
117 
118  explicit BlendKBEffect(PresentationKB* const parent, bool m_needFadeIn = true);
119  ~BlendKBEffect() override;
120 
121  Type type() override
122  {
123  return Blend;
124  };
125 
126  void advanceTime(float step) override;
127  bool done() override;
128 
129 private:
130 
131  Q_DISABLE_COPY(BlendKBEffect)
132 };
133 
134 } // namespace DigikamGenericPresentationPlugin
135 
136 #endif // DIGIKAM°KB_EFFECT_H
bool done() override
Definition: kbeffect.cpp:154
Type type() override
Definition: kbeffect.h:121
BlendKBEffect(PresentationKB *const parent, bool m_needFadeIn=true)
Definition: kbeffect.cpp:143
~BlendKBEffect() override
Definition: kbeffect.cpp:150
void advanceTime(float step) override
Definition: kbeffect.cpp:167
void advanceTime(float step) override
Definition: kbeffect.cpp:118
Type type() override
Definition: kbeffect.h:98
~FadeKBEffect() override
Definition: kbeffect.cpp:102
bool done() override
Definition: kbeffect.cpp:106
FadeKBEffect(PresentationKB *const parent, bool m_needFadeIn=true)
Definition: kbeffect.cpp:96
virtual bool fadeIn() const
Definition: kbeffect.h:56
void swapImages()
Definition: kbeffect.cpp:60
static int m_numKBEffectRepeated
Definition: kbeffect.h:75
KBImage * image(int img) const
Definition: kbeffect.cpp:65
KBImage * m_img[2]
Definition: kbeffect.h:77
virtual void advanceTime(float step)=0
static Type chooseKBEffect(Type oldType)
Definition: kbeffect.cpp:72
KBEffect(PresentationKB *const parent, bool m_needFadeIn=true)
Definition: kbeffect.cpp:47
bool m_needFadeIn
Definition: kbeffect.h:76
void setupNewImage(int img)
Definition: kbeffect.cpp:55
Definition: presentationkb.h:94
Definition: presentationkb.h:114
Definition: presentation_audiopage.cpp:46