mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-19 04:50:16 +01:00
Make analyzers use QBasicTimer instead of QTimer
This commit is contained in:
parent
f1ff15d2f7
commit
d5a3c74043
@ -49,7 +49,6 @@ Analyzer::Base::Base( QWidget *parent, uint scopeSize )
|
||||
, m_engine(NULL)
|
||||
, m_lastScope(512)
|
||||
{
|
||||
connect( &m_timer, SIGNAL( timeout() ), SLOT( update() ) );
|
||||
}
|
||||
|
||||
void Analyzer::Base::hideEvent(QHideEvent *) {
|
||||
@ -57,7 +56,7 @@ void Analyzer::Base::hideEvent(QHideEvent *) {
|
||||
}
|
||||
|
||||
void Analyzer::Base::showEvent(QShowEvent *) {
|
||||
m_timer.start(timeout());
|
||||
m_timer.start(timeout(), this);
|
||||
}
|
||||
|
||||
void Analyzer::Base::transform( Scope &scope ) //virtual
|
||||
@ -217,3 +216,10 @@ Analyzer::initSin( Scope &v, const uint size ) //static
|
||||
radian += step;
|
||||
}
|
||||
}
|
||||
|
||||
void Analyzer::Base::timerEvent(QTimerEvent* e) {
|
||||
if (e->timerId() != m_timer.timerId())
|
||||
return;
|
||||
|
||||
update();
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "engines/engine_fwd.h"
|
||||
#include "fht.h" //stack allocated and convenience
|
||||
#include <QPixmap> //stack allocated and convenience
|
||||
#include <QTimer> //stack allocated
|
||||
#include <QBasicTimer> //stack allocated
|
||||
#include <QWidget> //baseclass
|
||||
#include <vector> //included for convenience
|
||||
|
||||
@ -51,6 +51,7 @@ protected:
|
||||
void hideEvent(QHideEvent *);
|
||||
void showEvent(QShowEvent *);
|
||||
void paintEvent( QPaintEvent* );
|
||||
void timerEvent(QTimerEvent *);
|
||||
|
||||
void polishEvent();
|
||||
|
||||
@ -62,14 +63,16 @@ protected:
|
||||
virtual void paused(QPainter& p);
|
||||
virtual void demo(QPainter& p);
|
||||
|
||||
void changeTimeout( uint newTimeout )
|
||||
{
|
||||
m_timer.setInterval( newTimeout );
|
||||
void changeTimeout( uint newTimeout ) {
|
||||
m_timeout = newTimeout;
|
||||
if (m_timer.isActive()) {
|
||||
m_timer.stop();
|
||||
m_timer.start(m_timeout, this);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
QTimer m_timer;
|
||||
QBasicTimer m_timer;
|
||||
uint m_timeout;
|
||||
FHT *m_fht;
|
||||
EngineBase* m_engine;
|
||||
|
Loading…
Reference in New Issue
Block a user