~arcachofo/simulide/1.1.0

« back to all changes in this revision

Viewing changes to src/gui/circuitwidget/components/meters/oscope.cpp

  • Committer: arcachofo
  • Date: 2021-01-01 14:23:42 UTC
  • Revision ID: arcachofo@simulide.com-20210101142342-ozfljnll44g5lbl3
Initial Commit 0.5.15-RC3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2018 by santiago González                               *
 
3
 *   santigoro@gmail.com                                                   *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 3 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 *                                                                         *
 
10
 *   This program is distributed in the hope that it will be useful,       *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
13
 *   GNU General Public License for more details.                          *
 
14
 *                                                                         *
 
15
 *   You should have received a copy of the GNU General Public License     *
 
16
 *   along with this program; if not, see <http://www.gnu.org/licenses/>.  *
 
17
 *                                                                         *
 
18
 ***************************************************************************/
 
19
 
 
20
#include "oscope.h"
 
21
#include "connector.h"
 
22
#include "circuit.h"
 
23
#include "itemlibrary.h"
 
24
#include "oscopechannel.h"
 
25
//#include "pin.h"
 
26
 
 
27
static const char* Oscope_properties[] = {
 
28
    QT_TRANSLATE_NOOP("App::Property","Filter")
 
29
};
 
30
 
 
31
Component* Oscope::construct( QObject* parent, QString type, QString id )
 
32
{
 
33
    return new Oscope( parent, type, id );
 
34
}
 
35
 
 
36
LibraryItem* Oscope::libraryItem()
 
37
{
 
38
    return new LibraryItem(
 
39
        tr( "Oscope" ),
 
40
        tr( "Meters" ),
 
41
        "oscope.png",
 
42
        "Oscope",
 
43
        Oscope::construct );
 
44
}
 
45
 
 
46
Oscope::Oscope( QObject* parent, QString type, QString id )
 
47
      : PlotBase( parent, type, id )
 
48
{
 
49
    Q_UNUSED( Oscope_properties );
 
50
 
 
51
    m_graphical = true;
 
52
 
 
53
    setLabelPos(-80,-80, 0);
 
54
 
 
55
    m_baSizeX = 120;
 
56
    m_baSizeY = 100;
 
57
    m_adSizeX = 240;
 
58
    m_adSizeY = 200;
 
59
 
 
60
    //m_dataSize = 200;
 
61
    m_bufferSize = 600000;
 
62
 
 
63
    for(int i=0; i<2; i++ )
 
64
    {
 
65
        m_channel[i] = new OscopeChannel( (id+"Chan"+QString::number(i)));
 
66
        m_channel[i]->m_channel = i;
 
67
        m_channel[i]->m_ePin[0] = m_pin[i];
 
68
        m_channel[i]->m_ePin[1] = m_pin[2]; // Ref Pin
 
69
    }
 
70
 
 
71
    setAdvanc( false ); // Create Widgets
 
72
    m_filter = 0.0;
 
73
}
 
74
Oscope::~Oscope() {}
 
75
 
 
76
void Oscope::setFilter( double filter )
 
77
{
 
78
    m_filter = filter;
 
79
 
 
80
    for(int i=0; i<2; i++ ) m_channel[i]->setFilter( filter );
 
81
}
 
82
 
 
83
#include "moc_oscope.cpp"