aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-10-13 15:52:40 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-10-13 15:52:40 +0000
commit342ada45af81cba245abd9a2fb4a19b4974e93e4 (patch)
tree62e4fba4b52c5eb18024c266311ed87604359d2f /src
parentf904c00053fe42ef05952d4c1ffceb6af7b07b97 (diff)
downloadqmmp-342ada45af81cba245abd9a2fb4a19b4974e93e4.tar.gz
qmmp-342ada45af81cba245abd9a2fb4a19b4974e93e4.tar.bz2
qmmp-342ada45af81cba245abd9a2fb4a19b4974e93e4.zip
some visual api changes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@169 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
-rw-r--r--src/mainvisual.cpp44
-rw-r--r--src/mainvisual.h28
2 files changed, 32 insertions, 40 deletions
diff --git a/src/mainvisual.cpp b/src/mainvisual.cpp
index 77e0d3554..65bd287a1 100644
--- a/src/mainvisual.cpp
+++ b/src/mainvisual.cpp
@@ -44,10 +44,9 @@ MainVisual *MainVisual::getPointer()
return pointer;
}
-MainVisual::MainVisual ( QWidget *parent)
- : QWidget ( parent ), m_vis ( 0 ), m_playing ( FALSE ), m_fps ( 20 )
+MainVisual::MainVisual (QWidget *parent)
+ : QWidget (parent), m_vis (0), m_playing (FALSE)
{
- m_transparent = FALSE;
m_draw = TRUE;
m_skin = Skin::getPointer();
connect(m_skin, SIGNAL(skinChanged()), this, SLOT(updateSettings()));
@@ -90,10 +89,13 @@ void MainVisual::setVisual (VisualBase *newvis)
}
}
-void MainVisual::prepare()
+void MainVisual::clear()
{
while (!m_nodes.isEmpty())
delete m_nodes.takeFirst();
+ if (m_vis)
+ m_vis->clear();
+ update();
}
void MainVisual::add ( Buffer *b, unsigned long w, int c, int p )
@@ -138,7 +140,7 @@ void MainVisual::timeout()
{
VisualNode *node = 0;
- if ( /*playing &&*/ output() )
+ if ( /*playing &&*/ output())
{
//output()->mutex()->lock ();
//long olat = output()->latency();
@@ -166,9 +168,8 @@ void MainVisual::timeout()
node = prev;
}
- bool stop = TRUE;
- if ( m_vis )
- stop = m_vis->process ( node );
+ if (m_vis)
+ m_vis->process ( node );
delete node;
if ( m_vis )
@@ -230,11 +231,6 @@ void MainVisual::mousePressEvent (QMouseEvent *e)
void MainVisual::drawBackGround()
{
m_bg = QPixmap (75,20);
- if (m_transparent)
- {
- m_bg.fill(Qt::transparent);
- return;
- }
QPainter painter(&m_bg);
for (int x = 0; x < 75; x += 2)
{
@@ -438,11 +434,7 @@ Analyzer::Analyzer()
: m_analyzerBarWidth ( 4 ), m_fps ( 20 )
{
m_size = QSize(75,20);
- for ( int i = 0; i< 75; ++i )
- {
- m_intern_vis_data[i] = 0;
- m_peaks[i] = 0;
- }
+ clear();
m_skin = Skin::getPointer();
double peaks_speed[] = { 0.05, 0.1, 0.2, 0.4, 0.8 };
@@ -462,6 +454,15 @@ Analyzer::Analyzer()
Analyzer::~Analyzer()
{}
+void Analyzer::clear()
+{
+ for ( int i = 0; i< 75; ++i )
+ {
+ m_intern_vis_data[i] = 0;
+ m_peaks[i] = 0;
+ }
+}
+
bool Analyzer::process ( VisualNode *node )
{
static fft_state *state = 0;
@@ -573,9 +574,14 @@ void Analyzer::draw ( QPainter *p)
Scope::Scope()
{
+ clear();
+ m_skin = Skin::getPointer();
+}
+
+void Scope::clear()
+{
for (int i = 0; i< 75; ++i)
m_intern_vis_data[i] = 7;
- m_skin = Skin::getPointer();
}
Scope::~Scope()
diff --git a/src/mainvisual.h b/src/mainvisual.h
index 8490929e2..d31b1c73a 100644
--- a/src/mainvisual.h
+++ b/src/mainvisual.h
@@ -22,7 +22,7 @@
#include <QWidget>
#include <QResizeEvent>
-#include <visualization.h>
+#include <visual.h>
#include <constants.h>
#include "logscale.h"
@@ -59,7 +59,8 @@ class VisualBase
{
public:
virtual ~VisualBase()
- {}
+ {};
+ virtual void clear() = 0;
virtual bool process(VisualNode *node) = 0;
virtual void draw(QPainter *) = 0;
virtual const QString name() = 0;
@@ -67,7 +68,7 @@ public:
class Skin;
-class MainVisual : public QWidget, public Visualization
+class MainVisual : public QWidget, public Visual
{
Q_OBJECT
@@ -77,27 +78,12 @@ public:
static MainVisual *getPointer();
- VisualBase *visual() const
- {
- return m_vis;
- }
void setVisual( VisualBase *newvis );
void add(Buffer *, unsigned long, int, int);
- void prepare();
-
- void configChanged(QSettings &settings);
-
+ void clear();
void paintEvent( QPaintEvent * );
- static QStringList visuals();
-
- void setFrameRate( int newfps );
- int frameRate() const
- {
- return m_fps;
- }
-
protected:
virtual void hideEvent (QHideEvent *);
virtual void showEvent (QShowEvent *);
@@ -120,8 +106,6 @@ private:
QList <VisualNode*> m_nodes;
QTimer *m_timer;
bool m_playing;
- int m_fps;
- bool m_transparent;
bool m_draw;
Skin *m_skin;
//menu and actions
@@ -142,6 +126,7 @@ public:
Analyzer();
virtual ~Analyzer();
+ void clear();
bool process(VisualNode *node);
void draw(QPainter *p);
const QString name()
@@ -168,6 +153,7 @@ public:
Scope();
virtual ~Scope();
+ void clear();
bool process(VisualNode *node);
void draw(QPainter *p);
const QString name()