MythTV  master
mainvisual.h
Go to the documentation of this file.
1 // Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com>
2 //
3 // Use, modification and distribution is allowed without limitation,
4 // warranty, or liability of any kind.
5 //
6 
7 #ifndef __mainvisual_h
8 #define __mainvisual_h
9 
10 #include <vector>
11 using namespace std;
12 
13 #include "constants.h"
14 
15 #include <QResizeEvent>
16 #include <QPaintEvent>
17 #include <QStringList>
18 #include <QHideEvent>
19 #include <QWidget>
20 #include <QPixmap>
21 #include <QTimer>
22 #include <QList>
23 
24 // MythTV headers
25 #include <visual.h>
26 
27 // MythMusic
28 #include "visualize.h"
29 
30 class MythUIVideo;
31 
32 // base class to handle things like frame rate...
33 class MainVisual : public QObject, public MythTV::Visual
34 {
35  Q_OBJECT
36 
37  public:
38  explicit MainVisual(MythUIVideo *visualizer);
39  virtual ~MainVisual();
40 
41  VisualBase *visual(void) const { return m_vis; }
42  void setVisual(const QString &name);
43 
44  void stop(void);
45 
46  void resize(const QSize &size);
47 
48  void add(const void *, unsigned long, unsigned long, int, int) override; // Visual
49  void prepare(void) override; // Visual
50 
51  void customEvent(QEvent *) override; // QObject
52 
53  void setFrameRate(int newfps);
54  int frameRate(void) const { return m_fps; }
55 
56  QStringList getVisualizations(void) { return m_visualizers; }
57 
58  int getCurrentVisual(void) { return m_currentVisualizer; }
59 
60  public slots:
61  void timeout();
62 
63  private:
64  MythUIVideo *m_visualizerVideo {nullptr};
65  QStringList m_visualizers;
66  int m_currentVisualizer {0};
67  VisualBase *m_vis {nullptr};
68  QPixmap m_pixmap;
69  QList<VisualNode*> m_nodes;
70  bool m_playing {false};
71  int m_fps {20};
72  unsigned long m_samples {SAMPLES_DEFAULT_SIZE};
73  QTimer *m_updateTimer {nullptr};
74 };
75 
76 #endif // __mainvisual_h
77 
unsigned int slots[4]
Definition: element.c:38
int frameRate(void) const
Definition: mainvisual.h:54
VisualBase * visual(void) const
Definition: mainvisual.h:41
QList< VisualNode * > m_nodes
Definition: mainvisual.h:69
QPixmap m_pixmap
Definition: mainvisual.h:68
QStringList getVisualizations(void)
Definition: mainvisual.h:56
Video widget, displays raw image data.
Definition: mythuivideo.h:14
QStringList m_visualizers
Definition: mainvisual.h:65
int getCurrentVisual(void)
Definition: mainvisual.h:58
#define SAMPLES_DEFAULT_SIZE
Definition: visualize.h:46