TimePlotWidget::TimePlotWidget(QWidget *parent, int xScaleType, int yScaleType) : PlotWidget(parent, xScaleType, yScaleType), m_freqPlot(NULL), m_enablePlotUpdate(true) { m_timePlotDelegate=new DataUiHandlerDelegate( dynamic_cast<DataUiHandlerProperty*>(new TimePlotParams((QObject*)parent)), dynamic_cast<DataUiHandlerUI*>(new TimePlotWidgetUI()), PROJECTTIMEPARAMS_DOCTYPE, PROJECTTIMEPARAMETERS_TAG, PROJECTTIMEPARAMS_DOCVERSION, (QObject*)parent); TimePlotParams *_params=dynamic_cast< TimePlotParams*> (getDataParameters()); Q_ASSERT(_params!=NULL); TimePlotWidgetUI *_ui=dynamic_cast< TimePlotWidgetUI*> (getControlWidget()); Q_ASSERT(_ui!=NULL); _params->setMaxDuration(TIMEDATA_DEFAULT_PROJECT_TIME); _params->setSampleRate(TIMEDATA_DEFAULT_SR); m_digestCurve=new DigestTimeData(&m_curveList,_params); m_digestCurve->getCurve()->attach(this); this->setRubberBandPosition(0); //connect show all and enable all _ui->addZMPControlWidget(m_zmp->getControlWidget()); connectSignals(); //set title this->setPlotTitle("Time curves plot"); }
BalloonsModule::BalloonsModule() { setTitle("Balloons"); setControlWidget(new BalloonsControl); setLiveWidget(new BalloonsLive); BaseControl *control = getControlWidget(); BaseLive *live = getLiveWidget(); //connect(control, SIGNAL(numberClicked(int)), live, SLOT(chooseNumber(int))); }
NumberChoiceModule::NumberChoiceModule() { setTitle("Number Choice"); setControlWidget(new NumberChoiceControl); setLiveWidget(new NumberChoiceLive); BaseControl *control = getControlWidget(); BaseLive *live = getLiveWidget(); connect(control, SIGNAL(numberClicked(int)), live, SLOT(chooseNumber(int))); connect(control, SIGNAL(resetAll(bool)), live, SIGNAL(resetAll(bool))); }
ScoresModule::ScoresModule() { setTitle("Scores"); setControlWidget(new ScoresControl); setLiveWidget(new ScoresLive); BaseControl *control = getControlWidget(); BaseLive *live = getLiveWidget(); connect(control, SIGNAL(updateGirlsScore(int)), live, SLOT(updateGirlsScore(int))); connect(control, SIGNAL(updateBoysScore(int)), live, SLOT(updateBoysScore(int))); connect(control, SIGNAL(showGirlsScore(bool)), live, SIGNAL(showGirlsScore(bool))); connect(control, SIGNAL(showBoysScore(bool)), live, SIGNAL(showBoysScore(bool))); }
void TimePlotWidget::connectSignals() { TimePlotParams *_params=dynamic_cast< TimePlotParams*> (getDataParameters()); Q_ASSERT(_params!=NULL); //Keep consitent duration and sample rate Q_ASSERT(connect(_params,SIGNAL(maxDurationChanged(qreal)),this,SLOT(setAllCurvesMaxDuration(qreal)))); Q_ASSERT(connect(_params,SIGNAL(sampleRateChanged(qreal)),this,SLOT(setAllCurvesSampleRate(qreal)))); //Signal arriving only from UI (show/hide all) TimePlotWidgetUI *_ui=dynamic_cast< TimePlotWidgetUI*> (getControlWidget()); Q_ASSERT(_ui!=NULL); Q_ASSERT(connect(_ui,SIGNAL(showAllCurvesToggled()),this,SLOT(showAllCurves()))); Q_ASSERT(connect(_ui,SIGNAL(hideAllCurvesToggled()),this,SLOT(hideAllCurves()))); Q_ASSERT(connect(this,SIGNAL(curveListChanged()),this,SLOT(recalcAndUpdatePlot()))); }
BuzzerModule::BuzzerModule() { setTitle("Buzzer"); setControlWidget(new BuzzerControl); setLiveWidget(new BuzzerLive); BaseControl *control = getControlWidget(); BaseLive *live = getLiveWidget(); serial = new QSerialPort(); teamLocked = false; connect(control, SIGNAL(sendTeamWin(QString)), live, SLOT(teamWin(QString))); connect(control, SIGNAL(openSerialPort(QString&)), this, SLOT(openSerialPort(QString&))); connect(control, SIGNAL(closeSerialPort()), this, SLOT(closeSerialPort())); connect(this, SIGNAL(teamWin(int)), control, SLOT(teamWin(int))); connect(serial, SIGNAL(readyRead()), this, SLOT(readSerialPort())); connect(live, SIGNAL(unlockTeam()), this, SLOT(unlockTeam())); connect(control, SIGNAL(setVideo(QString)), live, SLOT(setVideo(QString))); connect(control, SIGNAL(setVideoPlaying(bool)), live, SLOT(setVideoPlaying(bool))); connect(control, SIGNAL(toggleVideoPlaying()), live, SLOT(toggleVideoPlaying())); connect(live, SIGNAL(videoPlaying(bool)), control, SLOT(videoPlaying(bool))); connect(live, SIGNAL(videoFinished()), control, SLOT(videoFinished())); }