mirror of
https://github.com/miek/inspectrum.git
synced 2026-02-20 01:31:35 +01:00
Whitespace cleanup
This commit is contained in:
@@ -21,22 +21,22 @@
|
||||
|
||||
void AbstractSampleSource::subscribe(Subscriber *subscriber)
|
||||
{
|
||||
subscribers.insert(subscriber);
|
||||
subscribers.insert(subscriber);
|
||||
}
|
||||
|
||||
void AbstractSampleSource::invalidate()
|
||||
{
|
||||
for (auto subscriber : subscribers) {
|
||||
subscriber->invalidateEvent();
|
||||
}
|
||||
for (auto subscriber : subscribers) {
|
||||
subscriber->invalidateEvent();
|
||||
}
|
||||
}
|
||||
|
||||
int AbstractSampleSource::subscriberCount()
|
||||
{
|
||||
return subscribers.size();
|
||||
return subscribers.size();
|
||||
}
|
||||
|
||||
void AbstractSampleSource::unsubscribe(Subscriber *subscriber)
|
||||
{
|
||||
subscribers.erase(subscriber);
|
||||
subscribers.erase(subscriber);
|
||||
}
|
||||
@@ -21,12 +21,12 @@
|
||||
|
||||
Plot::Plot(std::shared_ptr<AbstractSampleSource> src) : sampleSource(src)
|
||||
{
|
||||
sampleSource->subscribe(this);
|
||||
sampleSource->subscribe(this);
|
||||
}
|
||||
|
||||
Plot::~Plot()
|
||||
{
|
||||
sampleSource->unsubscribe(this);
|
||||
sampleSource->unsubscribe(this);
|
||||
}
|
||||
|
||||
void Plot::invalidateEvent()
|
||||
@@ -36,12 +36,12 @@ void Plot::invalidateEvent()
|
||||
|
||||
bool Plot::mouseEvent(QEvent::Type type, QMouseEvent event)
|
||||
{
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<AbstractSampleSource> Plot::output()
|
||||
{
|
||||
return sampleSource;
|
||||
return sampleSource;
|
||||
}
|
||||
|
||||
void Plot::paintBack(QPainter &painter, QRect &rect, range_t<size_t> sampleRange)
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
template <typename Tin, typename Tout>
|
||||
SampleBuffer<Tin, Tout>::SampleBuffer(std::shared_ptr<SampleSource<Tin>> src) : src(src)
|
||||
{
|
||||
src->subscribe(this);
|
||||
src->subscribe(this);
|
||||
}
|
||||
|
||||
template <typename Tin, typename Tout>
|
||||
SampleBuffer<Tin, Tout>::~SampleBuffer()
|
||||
{
|
||||
src->unsubscribe(this);
|
||||
src->unsubscribe(this);
|
||||
}
|
||||
|
||||
template <typename Tin, typename Tout>
|
||||
@@ -40,7 +40,7 @@ std::unique_ptr<Tout[]> SampleBuffer<Tin, Tout>::getSamples(size_t start, size_t
|
||||
auto history = std::min(start, (size_t)256);
|
||||
auto samples = src->getSamples(start - history, length + history);
|
||||
if (samples == nullptr)
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
|
||||
auto temp = std::make_unique<Tout[]>(history + length);
|
||||
auto dest = std::make_unique<Tout[]>(length);
|
||||
@@ -53,7 +53,7 @@ std::unique_ptr<Tout[]> SampleBuffer<Tin, Tout>::getSamples(size_t start, size_t
|
||||
template <typename Tin, typename Tout>
|
||||
void SampleBuffer<Tin, Tout>::invalidateEvent()
|
||||
{
|
||||
SampleSource<Tout>::invalidate();
|
||||
SampleSource<Tout>::invalidate();
|
||||
}
|
||||
|
||||
template class SampleBuffer<std::complex<float>, std::complex<float>>;
|
||||
|
||||
@@ -79,10 +79,10 @@ void TracePlot::drawTile(QString key, const QRect &rect, range_t<size_t> sampleR
|
||||
QPainter painter(&image);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
auto firstSample = sampleRange.minimum;
|
||||
auto length = sampleRange.length();
|
||||
auto firstSample = sampleRange.minimum;
|
||||
auto length = sampleRange.length();
|
||||
|
||||
// Is it a 2-channel (complex) trace?
|
||||
// Is it a 2-channel (complex) trace?
|
||||
if (auto src = dynamic_cast<SampleSource<std::complex<float>>*>(sampleSource.get())) {
|
||||
auto samples = src->getSamples(firstSample, length);
|
||||
if (samples == nullptr)
|
||||
@@ -102,7 +102,7 @@ void TracePlot::drawTile(QString key, const QRect &rect, range_t<size_t> sampleR
|
||||
painter.setPen(Qt::green);
|
||||
plotTrace(painter, rect, samples.get(), length, 1);
|
||||
} else {
|
||||
throw std::runtime_error("TracePlot::paintMid: Unsupported source type");
|
||||
throw std::runtime_error("TracePlot::paintMid: Unsupported source type");
|
||||
}
|
||||
|
||||
emit imageReady(key, image);
|
||||
|
||||
@@ -25,25 +25,25 @@
|
||||
|
||||
class TracePlot : public Plot
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TracePlot(std::shared_ptr<AbstractSampleSource> source);
|
||||
TracePlot(std::shared_ptr<AbstractSampleSource> source);
|
||||
|
||||
void paintMid(QPainter &painter, QRect &rect, range_t<size_t> sampleRange);
|
||||
std::shared_ptr<AbstractSampleSource> source() { return sampleSource; };
|
||||
|
||||
signals:
|
||||
void imageReady(QString key, QImage image);
|
||||
void imageReady(QString key, QImage image);
|
||||
|
||||
public slots:
|
||||
void handleImage(QString key, QImage image);
|
||||
void handleImage(QString key, QImage image);
|
||||
|
||||
private:
|
||||
QSet<QString> tasks;
|
||||
const int tileWidth = 1000;
|
||||
QSet<QString> tasks;
|
||||
const int tileWidth = 1000;
|
||||
|
||||
QPixmap getTile(size_t tileID, size_t sampleCount);
|
||||
void drawTile(QString key, const QRect &rect, range_t<size_t> sampleRange);
|
||||
void plotTrace(QPainter &painter, const QRect &rect, float *samples, size_t count, int step);
|
||||
QPixmap getTile(size_t tileID, size_t sampleCount);
|
||||
void drawTile(QString key, const QRect &rect, range_t<size_t> sampleRange);
|
||||
void plotTrace(QPainter &painter, const QRect &rect, float *samples, size_t count, int step);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user