BoardHardware::BoardHardware(QWidget *parent, SubteStatus * subte, EventHandler *eventHandler) : BaseBoard(parent,subte,eventHandler), ui(new Ui::BoardHardware) { ui->setupUi(this); connect(m_eventHandler,SIGNAL(controlReady()),this,SLOT(startBoard())); connect(m_eventHandler,SIGNAL(controlDisable()),this,SLOT(disableScreen())); connect(m_eventHandler,SIGNAL(controlEnable()),this,SLOT(enableScreen())); connect(m_eventHandler,SIGNAL(controlReset()),this,SLOT(resetControls())); connect(m_eventHandler,SIGNAL(cargarEstado(int)),this,SLOT(loadState(int))); connect(m_eventHandler,SIGNAL(bPressed()),this,SLOT(bocinaON())); connect(m_eventHandler,SIGNAL(bReleased()),this,SLOT(bocinaOFF())); // connect(m_eventHandler,SIGNAL(aPressed()),this,SLOT(ranaAD())); // connect(m_eventHandler,SIGNAL(ceroPressed()),this,SLOT(ranaCERO())); // connect(m_eventHandler,SIGNAL(rPressed()),this,SLOT(ranaAT())); connect(m_eventHandler,SIGNAL(fPressed()),this,SLOT(setaON())); connect(m_eventHandler,SIGNAL(tPressed()),this,SLOT(setaOFF())); m_horn = NULL; // m_tractionLever = NULL; // m_rana = NULL; // m_hombreMuerto = NULL; m_setaButton = NULL; m_tractionHardware = NULL; }
ProgramWidget::ProgramWidget(Program *program, Device *device, QWidget *parent) : StandardWidget(device, parent), ui(new Ui::ProgramWidget), m_program(program) { ui->setupUi(this); performStandardSetup(tr("Program")); // QAction *lock = menuBar()->addAction(UiStandards::lockString()); // connect(lock, SIGNAL(triggered()), SLOT(lock())); ui->extra->setVisible(false); connect(m_program, SIGNAL(started()), SLOT(started())); connect(m_program, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(finished(int, QProcess::ExitStatus))); ui->console->setProcess(m_program->process()); ButtonProvider *buttonProvider = device->buttonProvider(); ui->normal->setEnabled(buttonProvider); ui->normal->setVisible(buttonProvider); ui->extra->setEnabled(buttonProvider); ui->extra->setVisible(buttonProvider); if(buttonProvider) { ui->extra->setVisible(buttonProvider->isExtraShown()); ui->a->setText(buttonProvider->text(ButtonProvider::A)); ui->b->setText(buttonProvider->text(ButtonProvider::B)); ui->c->setText(buttonProvider->text(ButtonProvider::C)); ui->x->setText(buttonProvider->text(ButtonProvider::X)); ui->y->setText(buttonProvider->text(ButtonProvider::Y)); ui->z->setText(buttonProvider->text(ButtonProvider::Z)); connect(ui->a, SIGNAL(pressed()), SLOT(aPressed())); connect(ui->b, SIGNAL(pressed()), SLOT(bPressed())); connect(ui->c, SIGNAL(pressed()), SLOT(cPressed())); connect(ui->x, SIGNAL(pressed()), SLOT(xPressed())); connect(ui->y, SIGNAL(pressed()), SLOT(yPressed())); connect(ui->z, SIGNAL(pressed()), SLOT(zPressed())); connect(ui->a, SIGNAL(released()), SLOT(aReleased())); connect(ui->b, SIGNAL(released()), SLOT(bReleased())); connect(ui->c, SIGNAL(released()), SLOT(cReleased())); connect(ui->x, SIGNAL(released()), SLOT(xReleased())); connect(ui->y, SIGNAL(released()), SLOT(yReleased())); connect(ui->z, SIGNAL(released()), SLOT(zReleased())); connect(buttonProvider, SIGNAL(buttonTextChanged(ButtonProvider::ButtonId, QString)), SLOT(buttonTextChanged(ButtonProvider::ButtonId, QString))); connect(buttonProvider, SIGNAL(extraShownChanged(bool)), SLOT(extraShownChanged(bool))); QTimer *timer = new QTimer(this); timer->start(100); buttonProvider->connect(timer, SIGNAL(timeout()), SLOT(refresh())); buttonProvider->reset(); } }
void ProgramWidget::extraShownChanged(const bool& shown) { ui->extra->setVisible(shown); update(); aReleased(); bReleased(); cReleased(); xReleased(); yReleased(); zReleased(); }