~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to dragonplayer/src/app/analyzer/blockAnalyzer.h

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************************
 
2
 * Copyright (c) 2003-2005 Max Howell <max.howell@methylblue.com>                       *
 
3
 *                                                                                      *
 
4
 * This program is free software; you can redistribute it and/or modify it under        *
 
5
 * the terms of the GNU General Public License as published by the Free Software        *
 
6
 * Foundation; either version 2 of the License, or (at your option) any later           *
 
7
 * version.                                                                             *
 
8
 *                                                                                      *
 
9
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
 
10
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
 
11
 * PARTICULAR PURPOSE. See the GNU General Pulic License for more details.              *
 
12
 *                                                                                      *
 
13
 * You should have received a copy of the GNU General Public License along with         *
 
14
 * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
 
15
 ****************************************************************************************/
 
16
 
 
17
#ifndef BLOCKANALYZER_H
 
18
#define BLOCKANALYZER_H
 
19
 
 
20
#include "analyzerBase.h"
 
21
#include <QColor>
 
22
//Added by qt3to4:
 
23
#include <QResizeEvent>
 
24
#include <QMouseEvent>
 
25
#include <QContextMenuEvent>
 
26
#include <QPixmap>
 
27
 
 
28
class QResizeEvent;
 
29
class QMouseEvent;
 
30
class QPalette;
 
31
 
 
32
 
 
33
/**
 
34
 * @author Max Howell
 
35
 */
 
36
 
 
37
class BlockAnalyzer : public Analyzer::Base2D
 
38
{
 
39
public:
 
40
    BlockAnalyzer( QWidget* );
 
41
   ~BlockAnalyzer();
 
42
 
 
43
   // Signed ints because most of what we compare them against are ints
 
44
    static const int HEIGHT      = 2;
 
45
    static const int WIDTH       = 4;
 
46
    static const int MIN_ROWS    = 3;   //arbituary
 
47
    static const int MIN_COLUMNS = 32;  //arbituary
 
48
    static const int MAX_COLUMNS = 256; //must be 2**n
 
49
    static const int FADE_SIZE   = 90;
 
50
 
 
51
protected:
 
52
    virtual void transform( QVector<float>& );
 
53
    virtual void analyze( const QVector<float>& );
 
54
    virtual void paintEvent( QPaintEvent* );
 
55
    virtual void resizeEvent( QResizeEvent* );
 
56
    virtual void paletteChange( const QPalette& );
 
57
 
 
58
    void drawBackground();
 
59
    void determineStep();
 
60
 
 
61
private:
 
62
    QPixmap* const bar() { return &m_barPixmap; }
 
63
 
 
64
    uint m_columns, m_rows;      //number of rows and columns of blocks
 
65
    uint m_y;                    //y-offset from top of widget
 
66
    QPixmap m_barPixmap;
 
67
    QPixmap m_topBarPixmap;
 
68
    QVector<float> m_scope;               //so we don't create a vector every frame
 
69
    std::vector<float> m_store;  //current bar heights
 
70
    std::vector<float> m_yscale;
 
71
 
 
72
    //FIXME why can't I namespace these? c++ issue?
 
73
    std::vector<QPixmap> m_fade_bars;
 
74
    std::vector<uint>    m_fade_pos;
 
75
    std::vector<int>     m_fade_intensity;
 
76
    QPixmap              m_background;
 
77
 
 
78
    float m_step; //rows to fall per frame
 
79
};
 
80
 
 
81
#endif