~ubuntu-branches/ubuntu/maverick/ktechlab/maverick

« back to all changes in this revision

Viewing changes to src/electronics/components/binarycounter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Georges Khaznadar
  • Date: 2009-02-09 00:28:49 UTC
  • mfrom: (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090209002849-9o8eqqiczqo4vat3
Tags: 0.3.6-4
modified debian/rules so it does not invoke make if there is no 
Makefile
Closes: #514552

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
#include "binarycounter.h"
12
12
 
 
13
#include <cstdlib>
 
14
#include <kiconloader.h>
 
15
#include <klocale.h>
 
16
 
13
17
#include "logic.h"
14
18
#include "libraryitem.h"
15
19
 
16
 
#include <kiconloader.h>
17
 
#include <klocale.h>
18
 
 
19
20
Item* BinaryCounter::construct( ItemDocument *itemDocument, bool newItem, const char *id )
20
21
{
21
22
        return new BinaryCounter( (ICNDocument*)itemDocument, newItem, id );
39
40
        : Component( icnDocument, newItem, id ? id : "binary_counter" )
40
41
{
41
42
        m_name = i18n("Binary Counter");
42
 
        m_desc = i18n("Holds an internal count, which changes when the clock input <i>&gt;</i> pin is pulsed.<br><br>"
43
 
                                  "Normal operation: <i>en</i> (Enable) and <i>u/d</i> (Up/Down) are held high, <i>r</i> (Reset) is low.");
44
43
 
45
44
        enLogic = inLogic = rLogic = udLogic = 0L;
46
45
        
56
55
        
57
56
        createProperty( "trig", Variant::Type::Select );
58
57
        property("trig")->setCaption( i18n("Trigger Edge") );
59
 
        property("trig")->setAllowed( QStringList::split( ',', "Rising,Falling" ) );
60
 
        property("trig")->setValue("Rising");
 
58
        QStringMap allowed;
 
59
        allowed["Rising"] = i18n("Rising");
 
60
        allowed["Falling"] = i18n("Falling");
 
61
        property("trig")->setAllowed( allowed );
 
62
        property("trig")->setValue("Falling");
61
63
        
62
64
        createProperty( "bitcount", Variant::Type::Int );
63
65
        property("bitcount")->setCaption( i18n("Bit Count") );
88
90
        
89
91
        QStringList pins;
90
92
        pins << "en" << ">" << "u/d" << "r";
91
 
        
92
 
        for ( int i = 0; i < QABS(4-int(numBits)); i++ )
93
 
                pins << "";
 
93
 
 
94
        {
 
95
        int np = abs(4-int(numBits));
 
96
        for ( int i = 0; i < np; i++ )
 
97
                pins << " ";
 
98
        }
94
99
        
95
100
        for ( int i = numBits-1; i >= 0; i-- )
96
101
                pins << QChar('A'+i);