summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-04-28 12:55:08 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-04-28 12:55:08 -0500
commitbd0400a096268138037b3cfc129c298c961fc63d (patch)
treea25466faf5d4978056a700fe3ead37d132e005d3
parent9c98267db370d13a01d6135046061ce8a06dba07 (diff)
downloadulab-bd0400a096268138037b3cfc129c298c961fc63d.tar.gz
ulab-bd0400a096268138037b3cfc129c298c961fc63d.zip
Fix scope part crashes
Add server-provided caption support Properly brand client application
-rw-r--r--clients/tde/src/app/remotemdi.cpp23
-rw-r--r--clients/tde/src/define.h25
-rw-r--r--clients/tde/src/part/scope/layout.ui16
-rw-r--r--clients/tde/src/part/scope/part.cpp4
-rw-r--r--clients/tde/src/widgets/tracewidget.cpp26
-rw-r--r--clients/tde/src/widgets/tracewidget.h5
6 files changed, 92 insertions, 7 deletions
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("<qt>The remote server is not compatible with this client</qt>"), 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 <kb9vqf@pearsoncomputing.net>, (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 @@
<property name="title">
<string>Notes</string>
</property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
<grid>
<widget class="KTextEdit" row="0" column="0" colspan="1">
<property name="name">
@@ -171,6 +179,14 @@
<property name="text">
<string></string>
</property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
</widget>
</grid>
</widget>
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; i<m_maxNumberOfTraces;i++) {
- m_traceControlWidgetList[i]->setTriggerChannel(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("<qt><nobr>%1%2<br>%3/div,%4/div<br>%5,%6<br>%7,%8</qt>").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("<br>%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("<qt><nobr>%1%2<br>%3/div,%4/div<br>%5,%6<br>%7,%8%9</qt>").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("<qt><nobr>%1</qt>").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; i<m_traceArray[traceNumber]->sampleArray.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;