diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-14 21:08:12 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-14 21:08:12 -0500 |
commit | 47f193b7dea740d95b0827855d0d4d3faefe3b72 (patch) | |
tree | f352d6bd7a680919a388cc6596c8b1189431790e /clients/tde | |
parent | 663e2f7a3d1ae0a40f45e760c3ae6998d79c1a2f (diff) | |
download | ulab-47f193b7dea740d95b0827855d0d4d3faefe3b72.tar.gz ulab-47f193b7dea740d95b0827855d0d4d3faefe3b72.zip |
Fix scope
Diffstat (limited to 'clients/tde')
-rw-r--r-- | clients/tde/src/part/scope/layout.ui | 26 | ||||
-rw-r--r-- | clients/tde/src/part/scope/part.cpp | 32 | ||||
-rw-r--r-- | clients/tde/src/part/scope/part.h | 2 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.cpp | 55 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.h | 4 |
5 files changed, 98 insertions, 21 deletions
diff --git a/clients/tde/src/part/scope/layout.ui b/clients/tde/src/part/scope/layout.ui index 9b69b57..6a28939 100644 --- a/clients/tde/src/part/scope/layout.ui +++ b/clients/tde/src/part/scope/layout.ui @@ -159,6 +159,32 @@ </widget> </grid> </widget> + <widget class="TQGroupBox" row="0" column="1"> + <property name="name"> + <cstring>groupOscilloscopeAcquisitionControls</cstring> + </property> + <property name="title"> + <string>Acquisition Controls</string> + </property> + <grid> + <widget class="TQPushButton" row="0" column="0" colspan="1"> + <property name="name"> + <cstring>acqStart</cstring> + </property> + <property name="text"> + <string>Start Acquisition</string> + </property> + </widget> + <widget class="TQPushButton" row="0" column="1" colspan="1"> + <property name="name"> + <cstring>acqStop</cstring> + </property> + <property name="text"> + <string>Stop Acquisition</string> + </property> + </widget> + </grid> + </widget> </grid> </widget> </grid> diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp index d12fd32..aefaa20 100644 --- a/clients/tde/src/part/scope/part.cpp +++ b/clients/tde/src/part/scope/part.cpp @@ -16,6 +16,7 @@ #include <tqvbox.h> #include <tqsocket.h> #include <tqmutex.h> +#include <tqpushbutton.h> #include <tqeventloop.h> #include <tqapplication.h> #include <unistd.h> //access() @@ -93,6 +94,9 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject * m_base->saRefLevel->setFloatMax(128); m_base->saRefLevel->setLineStep(1); + connect(m_base->acqStart, SIGNAL(clicked()), this, SLOT(startDAQ())); + connect(m_base->acqStop, SIGNAL(clicked()), this, SLOT(stopDAQ())); + connect(m_base->saRefLevel, SIGNAL(floatValueChanged(double)), this, SLOT(saRefLevelChanged(double))); TQTimer::singleShot(0, this, TQT_SLOT(postInit())); @@ -711,6 +715,15 @@ void ScopePart::mainEventLoop() { } } } + else if (m_commHandlerCommandState == 3) { + if (stopTraceUpdate == false) { + m_commHandlerCommandState = 0; + EXEC_NEXT_STATE_IMMEDIATELY + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } + } } } else { @@ -727,8 +740,25 @@ void ScopePart::postProcessTrace() { return; } +void ScopePart::startDAQ() { + // RAJA FIXME + // Also process lockouts... +} + +void ScopePart::stopDAQ() { + // RAJA FIXME + // Also process lockouts... + + if (m_commHandlerMode < 2) { + stopTraceUpdate = true; + m_commHandlerMode = 1; + m_commHandlerCommandState = 3; + mainEventLoop(); + } +} + void ScopePart::updateZoomWidgetLimits(const TQRectF& zoomRect) { - for (int traceno=1; traceno<=m_maxNumberOfTraces; traceno++) { + for (int traceno=0; traceno<m_maxNumberOfTraces; traceno++) { TQRectF fullZoomRect = m_traceWidget->displayLimits(traceno); double widthSpan = fullZoomRect.width()-fullZoomRect.x(); double heightSpan = fullZoomRect.height()-fullZoomRect.y(); diff --git a/clients/tde/src/part/scope/part.h b/clients/tde/src/part/scope/part.h index 55c20c0..7034300 100644 --- a/clients/tde/src/part/scope/part.h +++ b/clients/tde/src/part/scope/part.h @@ -49,6 +49,8 @@ namespace RemoteLab void connectionStatusChangedCallback(); void setTickerMessage(TQString message); void mainEventLoop(); + void startDAQ(); + void stopDAQ(); virtual void postProcessTrace(); void saRefLevelChanged(double); diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index 2d44afc..eda2c53 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -115,11 +115,20 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p graphStatusLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); graphStatusLabel->setPaletteForegroundColor(color); graphStatusLabel->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine); + TQFont font; + font = graphStatusLabel->font(); + font.setPointSize(font.pointSize()-1); + graphStatusLabel->setFont(font); + graphStatusLabel->setText("<qt></qt>"); graphStatusLabel->hide(); graphStatusLabelInner = new TQLabel(labelParent); graphStatusLabelInner->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); graphStatusLabelInner->setPaletteForegroundColor(color); graphStatusLabelInner->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine); + font = graphStatusLabelInner->font(); + font.setPointSize(font.pointSize()-1); + graphStatusLabelInner->setFont(font); + graphStatusLabelInner->setText("<qt></qt>"); graphStatusLabelInner->hide(); singleIncrBtn = new TQToolButton(TQt::UpArrow, labelParent); singleDecrBtn = new TQToolButton(TQt::DownArrow, labelParent); @@ -173,9 +182,17 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height)); x2 = (((positionArray[n+1]-leftEdge)/(rightEdge-leftEdge))*(graticule_width)); y2 = ((((sampleArray[n+1]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height)); - if ((x > 0) && (x < graticule_width) && (y > 0) && (y < graticule_height) && (x2 > 0) && (x2 < graticule_width) && (y2 > 0) && (y2 < graticule_height)) { - p->drawLine(x, y, x2, y2); - } + + if (x < 0) x = 0; + if (x > graticule_width) x = graticule_width; + if (y < 0) y = 0; + if (y > graticule_width) y = graticule_height; + if (x2 < 0) x2 = 0; + if (x2 > graticule_width) x2 = graticule_width; + if (y2 < 0) y2 = 0; + if (y2 > graticule_width) y2 = graticule_height; + + p->drawLine(x, y, x2, y2); } } } @@ -541,7 +558,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) { } else { for (uint trace=0;trace<m_base->m_traceArray.count();trace++) { - m_base->m_traceArray[trace]->graphStatusLabel->setText(""); + m_base->m_traceArray[trace]->graphStatusLabel->setText("<qt></qt>"); m_base->m_traceArray[trace]->graphStatusLabelInner->setText(m_base->m_traceArray[trace]->graphStatusLabel->text()); } } @@ -572,7 +589,7 @@ void GraticuleWidget::enterEvent(TQEvent *) { void GraticuleWidget::leaveEvent(TQEvent *) { for (uint trace=0;trace<m_base->m_traceArray.count();trace++) { - m_base->m_traceArray[trace]->graphStatusLabel->setText(""); + m_base->m_traceArray[trace]->graphStatusLabel->setText("<qt></qt>"); m_base->m_traceArray[trace]->graphStatusLabelInner->setText(m_base->m_traceArray[trace]->graphStatusLabel->text()); } } @@ -592,8 +609,8 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent, m_traceLabelLayout = new TQGridLayout; m_infoLabelLayout = new TQGridLayout; m_cursorLabelLayout = new TQGridLayout; - m_statusLabelLayout = new TQGridLayout; - m_statusLabelLayoutInner = new TQGridLayout; + m_statusLabelLayout = new TQVBoxLayout; + m_statusLabelLayoutInner = new TQVBoxLayout; m_primaryLayout->addLayout(m_traceLabelLayout, 255, 0); m_primaryLayout->addLayout(m_rightPaneLayout, 0, 255); m_primaryLayout->addLayout(m_statusLabelLayout, 255, 255); @@ -720,16 +737,18 @@ void TraceWidget::updateCursorText() { // If this is a horizontal cursor, list all vertical positions for all channels // If this is a vertical cursor, list the horizontal positions for all channels for (uint trace=0;trace<m_traceArray.count();trace++) { - double horizontal_range = (m_traceArray[trace]->rightEdge-m_traceArray[trace]->leftEdge); - double vertical_range = (m_traceArray[trace]->bottomEdge-m_traceArray[trace]->topEdge); + if (m_traceArray[trace]->enabled) { + double horizontal_range = (m_traceArray[trace]->rightEdge-m_traceArray[trace]->leftEdge); + double vertical_range = (m_traceArray[trace]->bottomEdge-m_traceArray[trace]->topEdge); - if (m_cursorArray[cursor]->orientation == TQt::Horizontal) { - double realCursorPosition = (m_traceArray[trace]->topEdge+((m_cursorArray[cursor]->position/100.0)*vertical_range)); - cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, vertical_range, m_traceArray[trace]->verticalUnits))); - } - else { - double realCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor]->position/100.0)*horizontal_range)); - cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, horizontal_range, m_traceArray[trace]->horizontalUnits))); + if (m_cursorArray[cursor]->orientation == TQt::Horizontal) { + double realCursorPosition = (m_traceArray[trace]->topEdge+((m_cursorArray[cursor]->position/100.0)*vertical_range)); + cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, vertical_range, m_traceArray[trace]->verticalUnits))); + } + else { + double realCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor]->position/100.0)*horizontal_range)); + cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, horizontal_range, m_traceArray[trace]->horizontalUnits))); + } } } @@ -1212,8 +1231,8 @@ void TraceWidget::resizeTraceArray(uint newsize) { m_traceLabelLayout->addWidget(m_traceArray[i]->singleIncrBtn, 0, (i*2)+1); m_traceLabelLayout->addWidget(m_traceArray[i]->posResetBtn, 1, (i*2)+1); m_traceLabelLayout->addWidget(m_traceArray[i]->singleDecrBtn, 2, (i*2)+1); - m_statusLabelLayout->addWidget(m_traceArray[i]->graphStatusLabel, i, 0); - m_statusLabelLayoutInner->addWidget(m_traceArray[i]->graphStatusLabelInner, i, 0); + m_statusLabelLayout->insertWidget(i, m_traceArray[i]->graphStatusLabel); + m_statusLabelLayoutInner->insertWidget(i, m_traceArray[i]->graphStatusLabelInner); } } } diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h index 0536ee9..0dfaead 100644 --- a/clients/tde/src/widgets/tracewidget.h +++ b/clients/tde/src/widgets/tracewidget.h @@ -234,8 +234,8 @@ class TraceWidget : public TQWidget TQGridLayout* m_traceLabelLayout; TQGridLayout* m_infoLabelLayout; TQGridLayout* m_cursorLabelLayout; - TQGridLayout* m_statusLabelLayout; - TQGridLayout* m_statusLabelLayoutInner; + TQVBoxLayout* m_statusLabelLayout; + TQVBoxLayout* m_statusLabelLayoutInner; GraticuleWidget* m_graticuleWidget; friend class GraticuleWidget; |