AnalyzerBase: Refactor code

This commit is contained in:
Jonas Kvinge
2022-04-01 22:30:00 +02:00
parent 58eec8df1e
commit f471462a84
3 changed files with 33 additions and 26 deletions

View File

@@ -32,10 +32,11 @@
#include <QVector>
#include <QPainter>
#include <QPalette>
#include <QBasicTimer>
#include <QShowEvent>
#include <QHideEvent>
#include <QTimerEvent>
#include <QtEvents>
#include "core/logging.h"
#include "engine/enginebase.h"
// INSTRUCTIONS Base2D
@@ -51,16 +52,34 @@
Analyzer::Base::Base(QWidget *parent, const uint scopeSize)
: QWidget(parent),
timeout_(40),
fht_(new FHT(scopeSize)),
engine_(nullptr),
lastscope_(512),
new_frame_(false),
is_playing_(false) {}
is_playing_(false),
timeout_(40) {}
void Analyzer::Base::hideEvent(QHideEvent*) { timer_.stop(); }
Analyzer::Base::~Base() {
delete fht_;
}
void Analyzer::Base::showEvent(QShowEvent*) { timer_.start(timeout(), this); }
void Analyzer::Base::showEvent(QShowEvent*) {
timer_.start(timeout(), this);
}
void Analyzer::Base::hideEvent(QHideEvent*) {
timer_.stop();
}
void Analyzer::Base::ChangeTimeout(const int timeout) {
timeout_ = timeout;
if (timer_.isActive()) {
timer_.stop();
timer_.start(timeout_, this);
}
}
void Analyzer::Base::transform(Scope &scope) {
@@ -186,10 +205,6 @@ void Analyzer::Base::demo(QPainter &p) {
}
void Analyzer::Base::polishEvent() {
init();
}
void Analyzer::interpolate(const Scope &inVec, Scope &outVec) {
double pos = 0.0;