MythTV  master
singleview.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 /* ============================================================
3  * File : singleview.h
4  * Description :
5  *
6  * Copyright 2004-2006 Renchi Raju, Daniel Kristjansson
7  *
8  * This program is free software; you can redistribute it
9  * and/or modify it under the terms of the GNU General
10  * Public License as published bythe Free Software Foundation;
11  * either version 2, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * ============================================================ */
20 
21 #ifndef SINGLEVIEW_H
22 #define SINGLEVIEW_H
23 
24 #include <vector>
25 
26 using namespace std;
27 
28 // Qt headers
29 #include <QImage>
30 #include <QPolygon>
31 #include <QPixmap>
32 #include <QKeyEvent>
33 #include <QPaintEvent>
34 
35 // MythGallery headers
36 #include "mythdialogs.h"
37 #include "galleryutil.h"
38 #include "imageview.h"
39 #include "iconview.h"
40 #include "sequence.h"
41 
42 class QTimer;
43 
44 class SingleView : public MythDialog, public ImageView
45 {
46  Q_OBJECT
47 
48  public:
49  SingleView(const ThumbList& itemList, int *pos, int slideShow, int sortorder,
50  MythMainWindow *parent, const char *name="SingleView");
51  ~SingleView();
52 
53  // Effect subtype enumeration
54  static const int kSweepRightToLeft = 0;
55  static const int kSweepLeftToRight = 1;
56  static const int kSweepBottomToTop = 2;
57  static const int kSweepTopToBottom = 3;
58 
59  static const int kIncomingEdgesFixed = 0;
60  static const int kIncomingEdgesMoving = 1;
61 
62  protected:
63  // Commands
64  void Rotate(int angle) override; // ImageView
65  void DisplayNext(bool reset, bool loadImage) override; // ImageView
66  void DisplayPrev(bool reset, bool loadImage) override; // ImageView
67  void Load(void) override; // ImageView
68  void paintEvent(QPaintEvent *e) override; // QWidget
69  void keyPressEvent(QKeyEvent *e) override; // QWidget
70 
71  // Sets
72  void SetZoom(float zoom) override; // ImageView
73  void SetPixmap(QPixmap*);
74 
75  // Effects
76  void RegisterEffects(void) override; // ImageView
77  void RunEffect(const QString &effect) override; // ImageView
78 
79  private:
80  void StartPainter(void);
81  void CreateEffectPixmap(void);
82  void CheckPosition(void);
83 
84  // Various special effects methods
85  void EffectNone(void);
86  void EffectChessboard(void);
87  void EffectSweep(void);
88  void EffectGrowing(void);
89  void EffectHorizLines(void);
90  void EffectVertLines(void);
91  void EffectMeltdown(void);
92  void EffectIncomingEdges(void);
93  void EffectMultiCircleOut(void);
94  void EffectSpiralIn(void);
95  void EffectCircleOut(void);
96  void EffectBlobs(void);
97  void EffectNoise(void);
98 
99  static QPixmap *CreateBackground(const QSize &sz);
100 
101  private slots:
102  void SlideTimeout(void);
103  void CaptionTimeout(void);
104 
105  private:
106  // General
107  QPixmap *m_pixmap {nullptr};
108  QImage m_image;
109  int m_angle {0};
110  QPoint m_source_loc {0,0};
111  ScaleMax m_scaleMax {kScaleToFit};
112 
113  // Info variables
114  QPixmap *m_info_pixmap {nullptr};
115 
116  // Common slideshow variables
117  int m_caption_show {0};
118  bool m_caption_remove {false};
119  QPixmap *m_caption_pixmap {nullptr};
120  QPixmap *m_caption_restore_pixmap {nullptr};
121  QTimer *m_caption_timer {nullptr};
122 
123  // Common effect state variables
124  QPixmap *m_effect_pixmap {nullptr};
125  QPainter *m_effect_painter {nullptr};
126  int m_effect_subtype {0};
127  QRect m_effect_bounds {0,0,0,0};
128  QPoint m_effect_delta0 {0,0};
129  QPoint m_effect_delta1 {0,0};
130  int m_effect_i {0};
131  int m_effect_j {0};
132  int m_effect_framerate {0};
133  float m_effect_delta2_x {0.0F};
134  float m_effect_delta2_y {0.0F};
135  float m_effect_alpha {0.0F};
136 
137  // Unshared effect state variables
138  QPoint m_effect_spiral_tmp0 {0,0};
139  QPoint m_effect_spiral_tmp1 {0,0};
141  float m_effect_multi_circle_out_delta_alpha {0.0F};
142  QPolygon m_effect_milti_circle_out_points {4};
143  QPolygon m_effect_circle_out_points {4};
144 };
145 
146 #endif /* SINGLEVIEW_H */
unsigned int slots[4]
Definition: element.c:38
QList< ThumbItem * > ThumbList
Definition: thumbview.h:78
const char * name
Definition: ParseText.cpp:328
vector< int > m_effect_meltdown_y_disp
Definition: singleview.h:140
Base dialog for most dialogs in MythTV using the old UI.
Definition: mythdialogs.h:40
ScaleMax
Definition: galleryutil.h:28
QImage m_image
Definition: singleview.h:108