diff --git a/clients/tde/src/app/remotemdi.cpp b/clients/tde/src/app/remotemdi.cpp index e6a2d7f..b595d84 100644 --- a/clients/tde/src/app/remotemdi.cpp +++ b/clients/tde/src/app/remotemdi.cpp @@ -69,7 +69,7 @@ RemoteMDI::RemoteMDI() // When we change view, change the status bar text connect(this, SIGNAL(viewActivated(KMdiChildView*)), this, SLOT(currentChanged(KMdiChildView*))); - ac->setHighlightingEnabled(true); + ac->setHighlightingEnabled(true); connect(ac, TQT_SIGNAL(actionStatusText(const TQString&)), this, TQT_SLOT(updateStatusBarMainMessage(const TQString&) )); connect(ac, TQT_SIGNAL(clearStatusText()), statusBar(), TQT_SLOT(clear())); @@ -304,12 +304,31 @@ void RemoteMDI::finishConnectingToServer() { *ds >> protover; m_rsvSvrSocket->clearFrameTail(); printf("[DEBUG] Got magic number %d and protocol version %d\n\r", magicnum, protover); fflush(stdout); - delete ds; if ((magicnum == MAGIC_NUMBER) && (protover == PROTOCOL_VERSION)) { + // Request server name + TQString serverName; + *ds << TQString("NAME"); + m_rsvSvrSocket->writeEndOfFrame(); + while (!m_rsvSvrSocket->canReadFrame()) { + tqApp->processEvents(); + if (!m_rsvSvrSocket) { + return; + } + } + *ds >> serverName; + m_rsvSvrSocket->clearFrameTail(); + + // Set caption if a valid server name was received + if ((serverName != "") && (serverName != "ERRINVCMD")) { + setCaption(TQString("%1 - %2").arg(serverName).arg(kapp->caption())); + } + + delete ds; disconnect_action->setEnabled(true); promptForStationType(); } else { + delete ds; disconnectFromServer(); KMessageBox::error(this, i18n("The remote server is not compatible with this client"), i18n("Connection Failed")); } diff --git a/clients/tde/src/define.h b/clients/tde/src/define.h index e652aaf..3e95031 100644 --- a/clients/tde/src/define.h +++ b/clients/tde/src/define.h @@ -1,5 +1,24 @@ -//Author: Timothy Pearson , (C) 2012 -//Copyright: See COPYING file that comes with this distribution +/* + * Remote Laboratory Workspaces Client + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (c) 2012-2014 Timothy Pearson + * Raptor Engineering + * http://www.raptorengineeringinc.com + */ #ifndef DEFINE_H #define DEFINE_H @@ -12,6 +31,6 @@ #define APP_NAME "remote_laboratory_client" #define APP_VERSION "1.0" -#define APP_PRETTYNAME "Remote Laboratory Client" +#define APP_PRETTYNAME "uLab Workspaces Client" #endif diff --git a/clients/tde/src/part/scope/layout.ui b/clients/tde/src/part/scope/layout.ui index f680d86..2a94997 100644 --- a/clients/tde/src/part/scope/layout.ui +++ b/clients/tde/src/part/scope/layout.ui @@ -163,6 +163,14 @@ Notes + + + 5 + 3 + 0 + 1 + + @@ -171,6 +179,14 @@ + + + 5 + 3 + 0 + 1 + + diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp index a909397..fed1726 100644 --- a/clients/tde/src/part/scope/part.cpp +++ b/clients/tde/src/part/scope/part.cpp @@ -1972,7 +1972,9 @@ void ScopePart::processTriggerButtons() { } for (int i=0; isetTriggerChannel(i == (m_triggerChannel-1)); + if (m_traceControlWidgetList[i]) { + m_traceControlWidgetList[i]->setTriggerChannel(i == (m_triggerChannel-1)); + } } } diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index 90e3977..9edab59 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -1661,7 +1661,8 @@ void TraceWidget::updateTraceText() { offsetText = TQString(" +%1").arg(prettyFormat(fabs(offset), vertical_range, m_traceArray[trace]->verticalUnits)); } } - m_traceArray[trace]->paramLabel->setText(TQString("%1%2
%3/div,%4/div
%5,%6
%7,%8
").arg(m_traceArray[trace]->traceName).arg(offsetText).arg(prettyFormat(horizontal_units_per_division, horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(vertical_units_per_division, vertical_range, m_traceArray[trace]->verticalUnits)).arg(prettyFormat(m_traceArray[trace]->leftEdge, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(m_traceArray[trace]->topEdge, vertical_range, m_traceArray[trace]->verticalUnits)).arg(prettyFormat(m_traceArray[trace]->rightEdge, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(m_traceArray[trace]->bottomEdge, vertical_range, m_traceArray[trace]->verticalUnits))); + TQString traceDataString = TQString("
%1,%2,%3").arg(prettyFormat(m_traceArray[trace]->sampleMin, vertical_range, m_traceArray[trace]->verticalUnits)).arg(prettyFormat(m_traceArray[trace]->sampleMax, vertical_range, m_traceArray[trace]->verticalUnits)).arg(prettyFormat(m_traceArray[trace]->sampleAverage, vertical_range, m_traceArray[trace]->verticalUnits)); + m_traceArray[trace]->paramLabel->setText(TQString("
%1%2
%3/div,%4/div
%5,%6
%7,%8%9").arg(m_traceArray[trace]->traceName).arg(offsetText).arg(prettyFormat(horizontal_units_per_division, horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(vertical_units_per_division, vertical_range, m_traceArray[trace]->verticalUnits)).arg(prettyFormat(m_traceArray[trace]->leftEdge, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(m_traceArray[trace]->topEdge, vertical_range, m_traceArray[trace]->verticalUnits)).arg(prettyFormat(m_traceArray[trace]->rightEdge, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(m_traceArray[trace]->bottomEdge, vertical_range, m_traceArray[trace]->verticalUnits)).arg(traceDataString)); m_traceArray[trace]->leftLabel->setText(TQString("
%1").arg(m_traceArray[trace]->traceName)); } } @@ -1795,9 +1796,32 @@ TQDoubleArray& TraceWidget::samples(uint traceNumber) { void TraceWidget::setSamples(uint traceNumber, TQDoubleArray& tqda, bool deferUpdate) { VERIFY_TRACE_ARRAY_SIZE + unsigned int i; + double curValue; + m_traceArray[traceNumber]->sampleArray = tqda; m_traceArray[traceNumber]->numberOfSamples = tqda.size(); + // Calculate trace minimum, maximum, and average + m_traceArray[traceNumber]->sampleMin = DBL_MAX; + m_traceArray[traceNumber]->sampleMax = DBL_MIN; + m_traceArray[traceNumber]->sampleAverage = 0; + m_traceArray[traceNumber]->minIndex = 0; + m_traceArray[traceNumber]->maxIndex = 0; + for (i=0; isampleArray.size(); i++) { + curValue = m_traceArray[traceNumber]->sampleArray[i]; + if (curValue < m_traceArray[traceNumber]->sampleMin) { + m_traceArray[traceNumber]->sampleMin = curValue; + m_traceArray[traceNumber]->minIndex = i; + } + if (curValue > m_traceArray[traceNumber]->sampleMax) { + m_traceArray[traceNumber]->sampleMax = curValue; + m_traceArray[traceNumber]->maxIndex = i; + } + m_traceArray[traceNumber]->sampleAverage = m_traceArray[traceNumber]->sampleAverage + curValue; + } + m_traceArray[traceNumber]->sampleAverage = m_traceArray[traceNumber]->sampleAverage / m_traceArray[traceNumber]->numberOfSamples; + if (!deferUpdate) { updateCursorText(); m_graticuleWidget->repaint(false); diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h index 9cf1d17..281f002 100644 --- a/clients/tde/src/widgets/tracewidget.h +++ b/clients/tde/src/widgets/tracewidget.h @@ -104,6 +104,11 @@ class TraceData : public TQObject TQDoubleArray sampleArray; TQDoubleArray positionArray; unsigned int numberOfSamples; + double sampleMax; + double sampleMin; + double sampleAverage; + double minIndex; + double maxIndex; long leftEdgeIndex; long rightEdgeIndex; double offset;