File indexing completed on 2024-05-05 05:46:10

0001 /***************************************************************************
0002  *   Copyright (C) 2006 by William Hillerby - william.hillerby@ntlworld.com*
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #include "voltageregulator.h"
0011 
0012 #include "canvasitemparts.h"
0013 #include "ecnode.h"
0014 #include "libraryitem.h"
0015 
0016 #include <KLocalizedString>
0017 
0018 #include <QDebug>
0019 #include <QPainter>
0020 #include <QStyle>
0021 
0022 Item *VoltageRegulator::construct(ItemDocument *itemDocument, bool newItem, const char *id)
0023 {
0024     return new VoltageRegulator(static_cast<ICNDocument *>(itemDocument), newItem, id);
0025 }
0026 
0027 LibraryItem *VoltageRegulator::libraryItem()
0028 {
0029     return new LibraryItem(QStringList(QString("ec/voltageregulator")), i18n("Voltage Regulator"), i18n("Passive"), "voltage_regulator.png", LibraryItem::lit_component, VoltageRegulator::construct);
0030 }
0031 
0032 VoltageRegulator::VoltageRegulator(ICNDocument *icnDocument, bool newItem, const QString &id)
0033     : Component(icnDocument, newItem, (!id.isEmpty()) ? id : "voltageregulator")
0034 {
0035     createProperty("voltageout", Variant::Type::Double);
0036     property("voltageout")->setCaption(i18n("Voltage Out"));
0037     property("voltageout")->setMinValue(2);
0038     property("voltageout")->setMaxValue(maxVoltageOut);
0039     property("voltageout")->setValue(5);
0040 }
0041 
0042 VoltageRegulator::~VoltageRegulator()
0043 {
0044 }
0045 
0046 void VoltageRegulator::dataChanged()
0047 {
0048 }
0049 
0050 void VoltageRegulator::drawShape(QPainter &p)
0051 {
0052     initPainter(p);
0053 
0054     // Get centre point of component.
0055     // int _y = int(y());
0056     // int _x = int(x());
0057 
0058     deinitPainter(p);
0059 }