1
/***************************************************************************
2
* Copyright (C) 2012 by santiago González *
3
* santigoro@gmail.com *
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. *
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. *
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/>. *
18
***************************************************************************/
20
#ifndef SEVENSEGMENT_H
21
#define SEVENSEGMENT_H
23
#include "component.h"
24
#include "e-element.h"
29
class MAINMODULE_EXPORT SevenSegment : public Component, public eElement
32
Q_PROPERTY( LedBase::LedColor Color READ color WRITE setColor DESIGNABLE true USER true )
33
Q_PROPERTY( int NumDisplays READ numDisplays WRITE setNumDisplays DESIGNABLE true USER true )
34
Q_PROPERTY( bool CommonCathode READ isCommonCathode WRITE setCommonCathode DESIGNABLE true USER true )
35
Q_PROPERTY( bool Vertical_Pins READ verticalPins WRITE setVerticalPins DESIGNABLE true USER true )
36
Q_PROPERTY( double Threshold READ threshold WRITE setThreshold DESIGNABLE true USER true )
37
Q_PROPERTY( double MaxCurrent READ maxCurrent WRITE setMaxCurrent DESIGNABLE true USER true )
38
Q_PROPERTY( double Resistance READ resistance WRITE setResistance DESIGNABLE true USER true )
41
SevenSegment( QObject* parent, QString type, QString id );
44
static Component* construct( QObject* parent, QString type, QString id );
45
static LibraryItem *libraryItem();
48
LedBase::LedColor color();
49
void setColor( LedBase::LedColor color );
52
void setNumDisplays( int dispNumber );
55
void setVerticalPins( bool v );
57
bool isCommonCathode();
58
void setCommonCathode( bool isCommonCathode );
61
void setThreshold( double threshold );
64
void setMaxCurrent( double current );
66
double resistance() { return m_resistance; }
67
void setResistance( double res );
69
virtual void stamp() override;
70
virtual void remove() override;
72
virtual void paint( QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget );
75
void createDisplay( int dispNumber );
76
void deleteDisplay( int dispNumber );
77
void resizeData( int displays );
87
LedBase::LedColor m_ledColor;
89
std::vector<ePin*> m_commonPin;
90
std::vector<ePin*> m_cathodePin;
91
std::vector<ePin*> m_anodePin;
92
std::vector<LedSmd*> m_segment;