diff --git a/app/editor.cpp b/app/editor.cpp index a8bcea28..2f00034b 100644 --- a/app/editor.cpp +++ b/app/editor.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -697,12 +698,32 @@ bool Editor::eventFilter( QObject *obj, QEvent *evt ) { if( keyEvt && ( keyEvt->key( ) == Qt::Key_Control ) ) { mControlKeyPressed = true; } + else { + for( GraphicElement *elm : scene->getElements( ) ) { + if( elm->hasTrigger( ) && !elm->getTrigger( ).isEmpty( ) ) { + Input *in = dynamic_cast< Input* >( elm ); + if( in && elm->getTrigger( ).matches( keyEvt->key( ) ) ) { + in->setOn( true ); + } + } + } + } break; } case QEvent::KeyRelease: { if( keyEvt && ( keyEvt->key( ) == Qt::Key_Control ) ) { mControlKeyPressed = false; } + else { + for( GraphicElement *elm : scene->getElements( ) ) { + if( elm->hasTrigger( ) && !elm->getTrigger( ).isEmpty( ) ) { + Input *in = dynamic_cast< Input* >( elm ); + if( in && elm->getTrigger( ).matches( keyEvt->key( ) ) == QKeySequence::ExactMatch ) { + in->setOn( false ); + } + } + } + } break; } } diff --git a/app/element/display.cpp b/app/element/display.cpp index aa329f4b..ce6eefdc 100644 --- a/app/element/display.cpp +++ b/app/element/display.cpp @@ -10,6 +10,7 @@ Display::Display(QGraphicsItem * parent) : GraphicElement(8,8,0,0,parent) { updatePorts(); setBottomPosition(58); setTopPosition(6); + setHasLabel(true); setPixmap(QPixmap(":/output/counter/counter_off.png")); a = QPixmap(":/output/counter/counter_a.png"); diff --git a/app/element/input.h b/app/element/input.h new file mode 100644 index 00000000..f37e2d55 --- /dev/null +++ b/app/element/input.h @@ -0,0 +1,12 @@ +#ifndef INPUT_H +#define INPUT_H + + +class Input { +public: + virtual bool getOn( ) const = 0; + virtual void setOn( bool value ) = 0; + +}; + +#endif /* INPUT_H */ diff --git a/app/element/inputbutton.cpp b/app/element/inputbutton.cpp index c40b4506..947344c6 100644 --- a/app/element/inputbutton.cpp +++ b/app/element/inputbutton.cpp @@ -2,42 +2,57 @@ #include #include -InputButton::InputButton(QGraphicsItem * parent) : GraphicElement(0,0,1,1,parent) { - setOutputsOnTop(false); - setPixmap(QPixmap(":/input/buttonOff.png")); - setRotatable(false); - outputs().first()->setValue(0); - on = false; - setHasLabel(true); - setObjectName("Button"); +InputButton::InputButton( QGraphicsItem *parent ) : GraphicElement( 0, 0, 1, 1, parent ) { + setOutputsOnTop( false ); + setPixmap( QPixmap( ":/input/buttonOff.png" ) ); + setRotatable( false ); + outputs( ).first( )->setValue( 0 ); + setOn( false ); + setHasLabel( true ); + setHasTrigger( true ); + setObjectName( "Button" ); } -InputButton::~InputButton() { +InputButton::~InputButton( ) { } -void InputButton::mousePressEvent(QGraphicsSceneMouseEvent * event) { - if(event->button() == Qt::LeftButton) { - setPixmap(QPixmap(":/input/buttonOn.png")); - on = true; - setChanged(true); - event->accept(); +void InputButton::mousePressEvent( QGraphicsSceneMouseEvent *event ) { + if( event->button( ) == Qt::LeftButton ) { + setOn( true ); + setChanged( true ); + event->accept( ); } - QGraphicsItem::mousePressEvent(event); + QGraphicsItem::mousePressEvent( event ); } -void InputButton::mouseReleaseEvent(QGraphicsSceneMouseEvent * event) { - if(event->button() == Qt::LeftButton) { - setPixmap(QPixmap(":/input/buttonOff.png")); - on = false; - setChanged(true); - event->accept(); +void InputButton::mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) { + if( event->button( ) == Qt::LeftButton ) { + + setOn( false ); + setChanged( true ); + event->accept( ); + } + GraphicElement::mouseReleaseEvent( event ); +} + +void InputButton::updateLogic( ) { + if( !disabled( ) ) { + outputs( ).first( )->setValue( on ); } - GraphicElement::mouseReleaseEvent(event); } -void InputButton::updateLogic() { - if(!disabled()){ - outputs().first()->setValue(on); +bool InputButton::getOn( ) const { + return( on ); +} + +void InputButton::setOn( bool value ) { + on = value; + if( on ) { + setPixmap( QPixmap( ":/input/buttonOn.png" ) ); + } + else { + setPixmap( QPixmap( ":/input/buttonOff.png" ) ); } + updateLogic( ); } diff --git a/app/element/inputbutton.h b/app/element/inputbutton.h index 7621d23e..b60a075b 100644 --- a/app/element/inputbutton.h +++ b/app/element/inputbutton.h @@ -1,25 +1,31 @@ -#ifndef INPUT_H -#define INPUT_H +#ifndef INPUTBUTTON_H +#define INPUTBUTTON_H #include "graphicelement.h" +#include "input.h" -class InputButton : public GraphicElement { +class InputButton : public GraphicElement, public Input { public: - explicit InputButton(QGraphicsItem * parent); - virtual ~InputButton(); + explicit InputButton( QGraphicsItem *parent ); + virtual ~InputButton( ); bool on; - // QGraphicsItem interface + /* QGraphicsItem interface */ protected: - void mousePressEvent(QGraphicsSceneMouseEvent * event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent * event); + void mousePressEvent( QGraphicsSceneMouseEvent *event ); + void mouseReleaseEvent( QGraphicsSceneMouseEvent *event ); - // GraphicElement interface - public: - virtual ElementType elementType() { - return ElementType::BUTTON; + /* GraphicElement interface */ +public: + virtual ElementType elementType( ) { + return( ElementType::BUTTON ); } - void updateLogic(); + void updateLogic( ); + + // Input interface +public: + bool getOn() const; + void setOn(bool value); }; -#endif // INPUT_H +#endif /* INPUTBUTTON_H */ diff --git a/app/element/inputswitch.cpp b/app/element/inputswitch.cpp index 34f1a775..7907e27f 100644 --- a/app/element/inputswitch.cpp +++ b/app/element/inputswitch.cpp @@ -8,6 +8,7 @@ InputSwitch::InputSwitch( QGraphicsItem *parent ) : GraphicElement( 0, 0, 1, 1, setPixmap( QPixmap( ":/input/switchOff.png" ) ); on = false; setHasLabel( true ); + setHasTrigger( true ); setObjectName( "Switch" ); } @@ -21,6 +22,7 @@ bool InputSwitch::getOn( ) const { void InputSwitch::setOn( bool value ) { on = value; + updateLogic(); } void InputSwitch::mousePressEvent( QGraphicsSceneMouseEvent *event ) { diff --git a/app/element/inputswitch.h b/app/element/inputswitch.h index e67913de..da4d34b0 100644 --- a/app/element/inputswitch.h +++ b/app/element/inputswitch.h @@ -2,8 +2,9 @@ #define INPUTSWITCH_H #include "graphicelement.h" +#include "input.h" -class InputSwitch : public GraphicElement { +class InputSwitch : public GraphicElement, public Input { public: explicit InputSwitch( QGraphicsItem *parent = 0); virtual ~InputSwitch( ); @@ -25,8 +26,8 @@ class InputSwitch : public GraphicElement { public: void save( QDataStream &ds ); void load( QDataStream &ds, QMap< quint64, QNEPort* > &portMap, double version ); - bool getOn( ) const; - void setOn( bool value ); + virtual bool getOn( ) const; + virtual void setOn( bool value ); }; #endif /* INPUTSWITCH_H */ diff --git a/app/elementeditor.cpp b/app/elementeditor.cpp index 16847361..dd419403 100644 --- a/app/elementeditor.cpp +++ b/app/elementeditor.cpp @@ -7,6 +7,14 @@ ElementEditor::ElementEditor( QWidget *parent ) : QWidget( parent ), ui( new Ui: ui->setupUi( this ); setEnabled( false ); setVisible( false ); + + ui->trigger->addItem( QString( tr( "None" ) ) ); + for( int i = 0; i < 5; i++ ) { + ui->trigger->addItem( QKeySequence( QString( "%1" ).arg( i ) ).toString( ) ); + } + for( char i = 'A'; i < 'F'; i++ ) { + ui->trigger->addItem( QKeySequence( QString( "%1" ).arg( i ) ).toString( ) ); + } } ElementEditor::~ElementEditor( ) { @@ -52,10 +60,16 @@ void ElementEditor::setCurrentElement( GraphicElement *elm ) { ui->comboBoxInputSz->setCurrentText( inputSz ); hasSomething |= ( ui->comboBoxInputSz->count( ) >= 2 ); /* Trigger */ - ui->keySequenceEdit->setVisible( element->hasTrigger( ) ); + ui->trigger->setVisible( element->hasTrigger( ) ); ui->label_trigger->setVisible( element->hasTrigger( ) ); + + ui->trigger->setCurrentIndex( 0 ); + if( element->hasTrigger( ) ) { + ui->trigger->setCurrentText( element->getTrigger( ).toString( ) ); + } hasSomething |= ( element->hasTrigger( ) ); - setEnabled( true ); + setEnabled( hasSomething ); + setVisible( hasSomething ); } else { setVisible( false ); @@ -99,6 +113,9 @@ void ElementEditor::apply( ) { if( element->hasFrequency( ) ) { element->setFrequency( ui->doubleSpinBoxFrequency->value( ) ); } + if( element->hasTrigger( ) ) { + element->setTrigger( QKeySequence( ui->trigger->currentText() ) ); + } emit elementUpdated( element, itemData ); } @@ -119,3 +136,7 @@ void ElementEditor::on_comboBoxColor_currentIndexChanged( int index ) { Q_UNUSED( index ); apply( ); } + +void ElementEditor::on_trigger_currentIndexChanged(const QString &){ + apply(); +} diff --git a/app/elementeditor.h b/app/elementeditor.h index a81946fc..864e8a63 100644 --- a/app/elementeditor.h +++ b/app/elementeditor.h @@ -33,6 +33,8 @@ private slots: void on_comboBoxColor_currentIndexChanged(int index); + void on_trigger_currentIndexChanged(const QString &arg1); + private: void setCurrentElement( GraphicElement *element ); void apply(); diff --git a/app/elementeditor.ui b/app/elementeditor.ui index 1b44200f..4b02679d 100644 --- a/app/elementeditor.ui +++ b/app/elementeditor.ui @@ -14,13 +14,40 @@ Form - - + + + + 1 + + + 0.500000000000000 + + + 30.000000000000000 + + - - + + - Color: + Frequency: + + + + + + + + + + Trigger + + + + + + + Input Ports: @@ -31,12 +58,6 @@ - - - - - - @@ -96,39 +117,18 @@ - - - - 1 - - - 0.500000000000000 - - - 30.000000000000000 - - - - - - - Frequency: - - + + - - + + - Input Ports: + Color: - - - - Trigger - - + + diff --git a/app/graphicelement.cpp b/app/graphicelement.cpp index 72747083..78106738 100644 --- a/app/graphicelement.cpp +++ b/app/graphicelement.cpp @@ -37,6 +37,7 @@ GraphicElement::GraphicElement( int minInputSz, int maxInputSz, int minOutputSz, m_beingVisited = false; m_rotatable = true; m_hasColors = false; + m_hasTrigger = false; m_hasFrequency = false; m_hasLabel = false; m_disabled = false; @@ -101,7 +102,9 @@ void GraphicElement::save( QDataStream &ds ) { ds << m_minOutputSz; ds << m_maxOutputSz; /* <\Version1.3> */ - + /* */ + ds << m_trigger; + /* <\Version1.9> */ ds << ( quint64 ) m_inputs.size( ); foreach( QNEPort * port, m_inputs ) { ds << ( quint64 ) port; @@ -129,10 +132,8 @@ void GraphicElement::load( QDataStream &ds, QMap< quint64, QNEPort* > &portMap, ds >> label_text; setLabel( label_text ); } - /* - * <\Version1.2> - * - */ + /* <\Version1.2> */ + /* */ if( version >= 1.3 ) { ds >> m_minInputSz; ds >> m_maxInputSz; @@ -140,6 +141,12 @@ void GraphicElement::load( QDataStream &ds, QMap< quint64, QNEPort* > &portMap, ds >> m_maxOutputSz; } /* <\Version1.3> */ + /* */ + if( version >= 1.9 ) { + ds >> m_trigger; + } + /* <\Version1.9> */ + quint64 inputSz, outputSz; ds >> inputSz; if( inputSz > MAXIMUMVALIDINPUTSIZE ) { @@ -311,6 +318,14 @@ QVariant GraphicElement::itemChange( QGraphicsItem::GraphicsItemChange change, c return( QGraphicsItem::itemChange( change, value ) ); } +QKeySequence GraphicElement::getTrigger( ) const { + return( m_trigger ); +} + +void GraphicElement::setTrigger( const QKeySequence &trigger ) { + m_trigger = trigger; +} + /* * void GraphicElement::mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) { * / * Align to grid * / diff --git a/app/graphicelement.h b/app/graphicelement.h index df3982f7..45c8ea70 100644 --- a/app/graphicelement.h +++ b/app/graphicelement.h @@ -1,8 +1,9 @@ #ifndef GRAPHICELEMENT_H #define GRAPHICELEMENT_H -#include #include +#include +#include #include "nodes/qneport.h" @@ -20,125 +21,128 @@ class GraphicElement : public QGraphicsObject, public PriorityElement { public: enum { Type = QGraphicsItem::UserType + 3 }; - explicit GraphicElement(int minInputSz, int maxInputSz, int minOutputSz, int maxOutputSz, QGraphicsItem * parent = 0); - virtual ~GraphicElement(); + explicit GraphicElement( int minInputSz, int maxInputSz, int minOutputSz, int maxOutputSz, QGraphicsItem *parent = 0 ); + virtual ~GraphicElement( ); private: QPixmap pixmap; int m_id; - //GraphicElement interface. + /* GraphicElement interface. */ public: - virtual ElementType elementType() = 0; + virtual ElementType elementType( ) = 0; - virtual void save(QDataStream&ds); + virtual void save( QDataStream &ds ); - virtual void load(QDataStream&ds, QMap &portMap, double version); + virtual void load( QDataStream &ds, QMap< quint64, QNEPort* > &portMap, double version ); - virtual void updatePorts(); + virtual void updatePorts( ); - virtual void updateLogic() = 0; + virtual void updateLogic( ) = 0; - // QGraphicsItem interface + /* QGraphicsItem interface */ public: - int type() const { - return Type; + int type( ) const { + return( Type ); } - virtual QRectF boundingRect() const; + virtual QRectF boundingRect( ) const; + + virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ); - virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); + QNEPort* addPort( const QString &name, bool isOutput, int flags = 0, int ptr = 0 ); - QNEPort* addPort(const QString &name , bool isOutput, int flags = 0, int ptr = 0); + void addInputPort( const QString &name = QString( ) ); - void addInputPort(const QString &name = QString()); + void addOutputPort( const QString &name = QString( ) ); - void addOutputPort(const QString &name = QString()); + int topPosition( ) const; - int topPosition() const; + int bottomPosition( ) const; - int bottomPosition() const; + int maxInputSz( ) const; - int maxInputSz() const; + int maxOutputSz( ) const; - int maxOutputSz() const; + bool outputsOnTop( ) const; - bool outputsOnTop() const; + QVector< QNEPort* > inputs( ) const; + void setInputs( const QVector< QNEPort* > &inputs ); - QVector inputs() const; - void setInputs(const QVector & inputs); + QVector< QNEPort* > outputs( ) const; + void setOutputs( const QVector< QNEPort* > &outputs ); - QVector outputs() const; - void setOutputs(const QVector & outputs); + int minInputSz( ) const; - int minInputSz() const; + int minOutputSz( ) const; - int minOutputSz() const; + int inputSize( ); + void setInputSize( int size ); - int inputSize(); - void setInputSize(int size); + int outputSize( ); + void setOutputSize( int size ); - int outputSize(); - void setOutputSize(int size); + virtual float frequency( ); + virtual void setFrequency( float freq ); - virtual float frequency(); - virtual void setFrequency(float freq); + int id( ) const; + void setId( int value ); - int id() const; - void setId(int value); + void setPixmap( const QPixmap &pixmap ); - void setPixmap(const QPixmap &pixmap); + bool rotatable( ) const; - bool rotatable() const; + bool hasLabel( ) const; - bool hasLabel() const; + bool hasFrequency( ) const; - bool hasFrequency() const; + bool hasColors( ) const; - bool hasColors() const; + bool hasTrigger( ) const; - bool hasTrigger() const; + virtual void setColor( QString color ); + virtual QString color( ); - virtual void setColor(QString color ); - virtual QString color(); + bool changed( ) const; + void setChanged( bool changed ); - bool changed() const; - void setChanged(bool changed); + bool beingVisited( ) const; + void setBeingVisited( bool beingVisited ); - bool beingVisited() const; - void setBeingVisited(bool beingVisited); + bool visited( ) const; + void setVisited( bool visited ); - bool visited() const; - void setVisited(bool visited); + bool isValid( ); - bool isValid(); + void setLabel( QString label ); + QString getLabel( ); + void disable( ); + void enable( ); + bool disabled( ); - void setLabel(QString label); - QString getLabel(); - void disable(); - void enable(); - bool disabled(); + QPixmap getPixmap( ) const; - QPixmap getPixmap() const; + QKeySequence getTrigger( ) const; + void setTrigger( const QKeySequence &trigger ); protected: - void setRotatable(bool rotatable); - void setHasLabel(bool hasLabel); - void setHasFrequency(bool hasFrequency); - void setHasColors(bool hasColors); - void setHasTrigger(bool hasTrigger); - void setMinInputSz(int minInputSz); - void setMinOutputSz(int minOutputSz); - void setOutputsOnTop(bool outputsOnTop); - void setMaxOutputSz(int maxOutputSz); - void setMaxInputSz(int maxInputSz); - void setTopPosition(int topPosition); - void setBottomPosition(int bottomPosition); - -// virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e); - QVariant itemChange(GraphicsItemChange change, const QVariant &value); + void setRotatable( bool rotatable ); + void setHasLabel( bool hasLabel ); + void setHasFrequency( bool hasFrequency ); + void setHasColors( bool hasColors ); + void setHasTrigger( bool hasTrigger ); + void setMinInputSz( int minInputSz ); + void setMinOutputSz( int minOutputSz ); + void setOutputsOnTop( bool outputsOnTop ); + void setMaxOutputSz( int maxOutputSz ); + void setMaxInputSz( int maxInputSz ); + void setTopPosition( int topPosition ); + void setBottomPosition( int bottomPosition ); + +/* virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e); */ + QVariant itemChange( GraphicsItemChange change, const QVariant &value ); private: QGraphicsTextItem *label; int m_topPosition; @@ -157,15 +161,15 @@ class GraphicElement : public QGraphicsObject, public PriorityElement { bool m_beingVisited; bool m_visited; bool m_disabled; + QKeySequence m_trigger; protected: - QVector m_inputs; - QVector m_outputs; + QVector< QNEPort* > m_inputs; + QVector< QNEPort* > m_outputs; - // QGraphicsItem interface - protected: -// virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event); + /* QGraphicsItem interface */ +protected: +/* virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event); */ }; - -#endif // GRAPHICELEMENT_H +#endif /* GRAPHICELEMENT_H */ diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 16509272..40cd48d3 100755 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -44,6 +44,9 @@ MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::M ui->menuEdit->removeAction( ui->actionUndo ); ui->menuEdit->removeAction( ui->actionRedo ); + ui->actionZoom_in->setVisible( false ); + ui->actionZoom_out->setVisible( false ); + connect( editor, &Editor::scroll, this, &MainWindow::scrollView ); QShortcut *shortcut = new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_F ), this ); @@ -155,7 +158,7 @@ bool MainWindow::open( const QString &fname ) { QMessageBox::warning( this, "Error!", QString( "File \"%1\" does not exists!" ).arg( fname ), QMessageBox::Ok, QMessageBox::NoButton ); std::cerr << "Error: This file does not exists: " << fname.toStdString( ) << std::endl; - return false; + return( false ); } if( fl.open( QFile::ReadOnly ) ) { QDataStream ds( &fl ); @@ -168,16 +171,16 @@ bool MainWindow::open( const QString &fname ) { QMessageBox::warning( this, "Error!", "Could not open file.\nError: " + QString( e.what( ) ), QMessageBox::Ok, QMessageBox::NoButton ); clear( ); - return false; + return( false ); } } else { std::cerr << "Could not open file in ReadOnly mode : " << fname.toStdString( ) << "." << std::endl; - return false; + return( false ); } fl.close( ); ui->statusBar->showMessage( "File loaded successfully.", 2000 ); - return true; + return( true ); } void MainWindow::scrollView( int dx, int dy ) { @@ -201,7 +204,8 @@ void MainWindow::on_actionSave_triggered( ) { void MainWindow::on_actionAbout_triggered( ) { QMessageBox::about( this, "Wired Panda", tr( - "Wired Panda is a software built to help students to learn about logic circuits.\nVersion: %1\n\nCreators:\nDavi Morales\nHéctor Castelli\nLucas Lellis\nRodrigo Torres\nSupervised by: Fábio Cappabianco." ).arg( + "Wired Panda is a software built to help students to learn about logic circuits.\nVersion: %1\n\nCreators:\nDavi Morales\nHéctor Castelli\nLucas Lellis\nRodrigo Torres\nSupervised by: Fábio Cappabianco." ) + .arg( QApplication::applicationVersion( ) ) ); } @@ -470,40 +474,42 @@ void MainWindow::keyReleaseEvent( QKeyEvent *evt ) { } bool MainWindow::ExportToArduino( QString fname ) { - try{ - if( fname.isEmpty( ) ) { - return( false ); - } - QVector< GraphicElement* > elements = editor->getScene( )->getElements( ); - SimulationController *sc = editor->getSimulationController( ); - sc->stop( ); - if( elements.isEmpty( ) ) { - return( false ); - } - if( !fname.endsWith( ".ino" ) ) { - fname.append( ".ino" ); - } - for( GraphicElement *elm : elements ) { - elm->setChanged( false ); - elm->setBeingVisited( false ); - elm->setVisited( false ); - } - for( GraphicElement *elm : elements ) { - if( elm ) { - sc->calculatePriority( elm ); + try { + if( fname.isEmpty( ) ) { + return( false ); } - } - qSort( elements.begin( ), elements.end( ), PriorityElement::lessThan ); + QVector< GraphicElement* > elements = editor->getScene( )->getElements( ); + SimulationController *sc = editor->getSimulationController( ); + sc->stop( ); + if( elements.isEmpty( ) ) { + return( false ); + } + if( !fname.endsWith( ".ino" ) ) { + fname.append( ".ino" ); + } + for( GraphicElement *elm : elements ) { + elm->setChanged( false ); + elm->setBeingVisited( false ); + elm->setVisited( false ); + } + for( GraphicElement *elm : elements ) { + if( elm ) { + sc->calculatePriority( elm ); + } + } + qSort( elements.begin( ), elements.end( ), PriorityElement::lessThan ); - CodeGenerator arduino( QDir::home( ).absoluteFilePath( fname ), elements ); - arduino.generate( ); - sc->start( ); - ui->statusBar->showMessage( tr("Arduino code successfully generated."), 2000 ); + CodeGenerator arduino( QDir::home( ).absoluteFilePath( fname ), elements ); + arduino.generate( ); + sc->start( ); + ui->statusBar->showMessage( tr( "Arduino code successfully generated." ), 2000 ); - qDebug( ) << "Arduino code successfully generated."; - }catch(std::runtime_error e){ - QMessageBox::warning(this,tr("Error"),tr("Error while exporting to arduino code:
%1").arg(e.what())); - return false; + qDebug( ) << "Arduino code successfully generated."; + } + catch( std::runtime_error e ) { + QMessageBox::warning( this, tr( "Error" ), tr( + "Error while exporting to arduino code:
%1" ).arg( e.what( ) ) ); + return( false ); } return( true ); diff --git a/includes.pri b/includes.pri index 0376e7cb..2ea7ffe5 100644 --- a/includes.pri +++ b/includes.pri @@ -21,6 +21,8 @@ SOURCES += \ $$PWD/app/element/dflipflop.cpp \ $$PWD/app/element/display.cpp \ $$PWD/app/element/dlatch.cpp \ + $$PWD/app/elementeditor.cpp \ + $$PWD/app/elementfactory.cpp \ $$PWD/app/element/inputbutton.cpp \ $$PWD/app/element/inputgnd.cpp \ $$PWD/app/element/inputswitch.cpp \ @@ -39,8 +41,6 @@ SOURCES += \ $$PWD/app/element/tlatch.cpp \ $$PWD/app/element/xnor.cpp \ $$PWD/app/element/xor.cpp \ - $$PWD/app/elementeditor.cpp \ - $$PWD/app/elementfactory.cpp \ $$PWD/app/globalproperties.cpp \ $$PWD/app/graphicelement.cpp \ $$PWD/app/graphicsview.cpp \ @@ -54,7 +54,8 @@ SOURCES += \ $$PWD/app/priorityqueue.cpp \ $$PWD/app/scene.cpp \ $$PWD/app/serializationfunctions.cpp \ - $$PWD/app/simulationcontroller.cpp + $$PWD/app/simulationcontroller.cpp \ + @@ -70,8 +71,11 @@ HEADERS += \ $$PWD/app/element/dflipflop.h \ $$PWD/app/element/display.h \ $$PWD/app/element/dlatch.h \ + $$PWD/app/elementeditor.h \ + $$PWD/app/elementfactory.h \ $$PWD/app/element/inputbutton.h \ $$PWD/app/element/inputgnd.h \ + $$PWD/app/element/input.h \ $$PWD/app/element/inputswitch.h \ $$PWD/app/element/inputvcc.h \ $$PWD/app/element/jkflipflop.h \ @@ -88,8 +92,6 @@ HEADERS += \ $$PWD/app/element/tlatch.h \ $$PWD/app/element/xnor.h \ $$PWD/app/element/xor.h \ - $$PWD/app/elementeditor.h \ - $$PWD/app/elementfactory.h \ $$PWD/app/globalproperties.h \ $$PWD/app/graphicelement.h \ $$PWD/app/graphicsview.h \ @@ -103,7 +105,7 @@ HEADERS += \ $$PWD/app/priorityqueue.h \ $$PWD/app/scene.h \ $$PWD/app/serializationfunctions.h \ - $$PWD/app/simulationcontroller.h + $$PWD/app/simulationcontroller.h \ HEADERS += \