1 /*
2  *  Copyright (C) 2016, Mike Walters <mike@flomp.net>
3  *
4  *  This file is part of inspectrum.
5  *
6  *  This program is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "plot.h"
21 
Plot(std::shared_ptr<AbstractSampleSource> src)22 Plot::Plot(std::shared_ptr<AbstractSampleSource> src) : sampleSource(src)
23 {
24 	sampleSource->subscribe(this);
25 }
26 
~Plot()27 Plot::~Plot()
28 {
29 	sampleSource->unsubscribe(this);
30 }
31 
invalidateEvent()32 void Plot::invalidateEvent()
33 {
34 
35 }
36 
mouseEvent(QEvent::Type type,QMouseEvent event)37 bool Plot::mouseEvent(QEvent::Type type, QMouseEvent event)
38 {
39 	return false;
40 }
41 
output()42 std::shared_ptr<AbstractSampleSource> Plot::output()
43 {
44 	return sampleSource;
45 }
46 
paintBack(QPainter & painter,QRect & rect,range_t<size_t> sampleRange)47 void Plot::paintBack(QPainter &painter, QRect &rect, range_t<size_t> sampleRange)
48 {
49     painter.save();
50     QPen pen(Qt::white, 1, Qt::DashLine);
51     painter.setPen(pen);
52     painter.drawLine(rect.left(), rect.center().y(), rect.right(), rect.center().y());
53     painter.restore();
54 }
55 
paintMid(QPainter & painter,QRect & rect,range_t<size_t> sampleRange)56 void Plot::paintMid(QPainter &painter, QRect &rect, range_t<size_t> sampleRange)
57 {
58 
59 }
60 
paintFront(QPainter & painter,QRect & rect,range_t<size_t> sampleRange)61 void Plot::paintFront(QPainter &painter, QRect &rect, range_t<size_t> sampleRange)
62 {
63 
64 }
65