1
/****************************************************************************************
2
* Copyright (c) 2003-2005 Max Howell <max.howell@methylblue.com> *
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 *
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. *
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
****************************************************************************************/
17
#ifndef BLOCKANALYZER_H
18
#define BLOCKANALYZER_H
20
#include "analyzerBase.h"
23
#include <QResizeEvent>
24
#include <QMouseEvent>
25
#include <QContextMenuEvent>
37
class BlockAnalyzer : public Analyzer::Base2D
40
BlockAnalyzer( QWidget* );
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;
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& );
58
void drawBackground();
62
QPixmap* const bar() { return &m_barPixmap; }
64
uint m_columns, m_rows; //number of rows and columns of blocks
65
uint m_y; //y-offset from top of widget
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;
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;
78
float m_step; //rows to fall per frame