Add inital component analyzer part

Fix a couple of Kerberos socket class threading problems
Stop drawing garbage in trace viewer when trace data partially intialized
Add FloatSpinBox explicit data accessor
master
Timothy Pearson 9 years ago
parent a4eb3d14df
commit 5d4ae8c1ec

@ -1 +1 @@
SUBDIRS = scope logicanalyzer commanalyzer fpgaview fpgaprogram sensormonitor adminconsole adminusermgmt serialconsole prototerminal
SUBDIRS = scope logicanalyzer commanalyzer companalyzer fpgaview fpgaprogram sensormonitor adminconsole adminusermgmt serialconsole prototerminal

@ -0,0 +1,12 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/src -I$(top_srcdir)/src/widgets $(KDE_INCLUDES)/tde
KDE_CXXFLAGS = $(USE_EXCEPTIONS)
METASOURCES = AUTO
KDE_ICON = libremotelab_companalyzer
#Part
kde_module_LTLIBRARIES = libremotelab_companalyzer.la
libremotelab_companalyzer_la_LIBADD = ../../widgets/libtracewidget.la ../../widgets/libfloatspinbox.la ../../widgets/libsevensegment.la $(LIB_KFILE) $(LIB_TDEPARTS) $(LIB_TDEUI) $(LIB_QT)
libremotelab_companalyzer_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -ltdecore -ltdeui -ltdeio -ltdefx -ltdekrbsocket -ltqtrla
libremotelab_companalyzer_la_SOURCES = \
part.cpp layout.ui

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

@ -0,0 +1,488 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>CompAnalyzerBase</class>
<widget class="TQWidget">
<property name="name">
<cstring>CompAnalyzerBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>519</width>
<height>356</height>
</rect>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLayoutWidget" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>unnamed_layout</cstring>
</property>
<grid>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupParameterADisplay</cstring>
</property>
<property name="title">
<string>Parameter A:</string>
</property>
<grid>
<property name="name">
<cstring>unnamed_grid</cstring>
</property>
<widget class="Display7SegmentArray" row="0" column="0">
<property name="name">
<cstring>parameterADisplay</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupParameterBDisplay</cstring>
</property>
<property name="title">
<string>Parameter B:</string>
</property>
<grid>
<property name="name">
<cstring>unnamed_grid</cstring>
</property>
<widget class="Display7SegmentArray" row="0" column="0">
<property name="name">
<cstring>parameterBDisplay</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="2">
<property name="name">
<cstring>groupFrequencyDisplay</cstring>
</property>
<property name="title">
<string>Frequency:</string>
</property>
<grid>
<property name="name">
<cstring>unnamed_grid</cstring>
</property>
<widget class="Display7SegmentArray" row="0" column="0">
<property name="name">
<cstring>frequencyDisplay</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<widget class="TQLayoutWidget" row="1" column="0" rowspan="1" colspan="1">
<property name="name">
<cstring>unnamed_layout</cstring>
</property>
<grid>
<widget class="TQGroupBox" row="1" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>groupMonitorView</cstring>
</property>
<property name="title">
<string>Trace Viewer</string>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name">
<cstring>splitter1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="TraceWidget" row="0" column="0" colspan="1">
<property name="name">
<cstring>traceWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
<widget class="TraceWidget" row="1" column="0" colspan="1">
<property name="name">
<cstring>traceZoomWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</widget>
</grid>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="1" column="1">
<property name="name">
<cstring>groupControl</cstring>
</property>
<property name="title">
<string>Controls</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupMonitorCaptureControls</cstring>
</property>
<property name="title">
<string>Capture Controls</string>
</property>
<grid>
<widget class="TQLabel" row="0" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Parameter A:</string>
</property>
</widget>
<widget class="TQComboBox" row="0" column="1" colspan="1">
<property name="name">
<cstring>parameterASourceCombo</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="TQLabel" row="1" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Parameter B:</string>
</property>
</widget>
<widget class="TQComboBox" row="1" column="1" colspan="1">
<property name="name">
<cstring>parameterBSourceCombo</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="TQLabel" row="2" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Frequency:</string>
</property>
<property name="textFormat">
<enum>PlainText</enum>
</property>
</widget>
<widget class="FloatSpinBox" row="2" column="1" colspan="1">
<property name="name">
<cstring>measurementFrequencyBox</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maxValue">
<number>1</number>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="1" column="1">
<property name="name">
<cstring>groupSweepControls</cstring>
</property>
<property name="title">
<string>Sweep Configuration</string>
</property>
<grid>
<widget class="TQLabel" row="0" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Start Frequency:</string>
</property>
<property name="textFormat">
<enum>PlainText</enum>
</property>
</widget>
<widget class="FloatSpinBox" row="0" column="1" colspan="1">
<property name="name">
<cstring>sweepStartFrequencyBox</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maxValue">
<number>1</number>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
<widget class="TQLabel" row="1" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>End Frequency:</string>
</property>
<property name="textFormat">
<enum>PlainText</enum>
</property>
</widget>
<widget class="FloatSpinBox" row="1" column="1" colspan="1">
<property name="name">
<cstring>sweepEndFrequencyBox</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maxValue">
<number>1</number>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
<widget class="TQLabel" row="2" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Step Frequency:</string>
</property>
<property name="textFormat">
<enum>PlainText</enum>
</property>
</widget>
<widget class="FloatSpinBox" row="2" column="1" colspan="1">
<property name="name">
<cstring>sweepStepFrequencyBox</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maxValue">
<number>1</number>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="2" column="1">
<property name="name">
<cstring>groupAcquisitionControls</cstring>
</property>
<property name="title">
<string>Acquisition Controls</string>
</property>
<grid>
<widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name">
<cstring>sweepStartButton</cstring>
</property>
<property name="text">
<string>Start Sweep</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name">
<cstring>sweepStopButton</cstring>
</property>
<property name="text">
<string>Stop Sweep</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="0" colspan="1">
<property name="name">
<cstring>waveformSave</cstring>
</property>
<property name="text">
<string>Save Waveforms</string>
</property>
</widget>
<widget class="TQPushButton" row="1" column="1" colspan="1">
<property name="name">
<cstring>waveformRecall</cstring>
</property>
<property name="text">
<string>Recall Waveforms</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0" colspan="2">
<property name="name">
<cstring>autoSave</cstring>
</property>
<property name="text">
<string>Enable Automatic Saving</string>
</property>
</widget>
<widget class="KURLRequester" row="3" column="0" colspan="2">
<property name="name">
<cstring>autoSaveFile</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.wfm|Waveform Files (*.wfm)</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="3" column="1">
<property name="name">
<cstring>groupTestNotes</cstring>
</property>
<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">
<cstring>userNotes</cstring>
</property>
<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>
</grid>
</widget>
</grid>
</widget>
<includes>
<include location="local" impldecl="in implementation">CompAnalyzerBase.ui.h</include>
</includes>
<includes>
<include location="local" impldecl="in implementation">tracewidget.h</include>
<include location="local" impldecl="in implementation">floatspinbox.h</include>
<include location="local" impldecl="in implementation">sevensegment.h</include>
</includes>
<layoutdefaults spacing="3" margin="6"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
</UI>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,260 @@
/*
* Remote Laboratory Component Analyzer Part
*
* 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) 2014 - 2015 Timothy Pearson
* Raptor Engineering
* http://www.raptorengineeringinc.com
*/
#ifndef REMOTELAB_COMPANALYZERPART_H
#define REMOTELAB_COMPANALYZERPART_H
#include <ntqthread.h>
#include <ntqeventloop.h>
#include <tqvariant.h>
#include <tqvaluevector.h>
#include <tdeparts/browserextension.h>
#include <tdeparts/statusbarextension.h>
#include <tdeparts/part.h>
#include <kurl.h>
#include <tqtrla.h>
#include <sevensegment.h>
#define MAXTRACES 255
class TDEAboutData;
using KParts::StatusBarExtension;
class TraceWidget;
class TQSocket;
class TQTimer;
class TQMutex;
class TQRectF;
class CompAnalyzerBase;
namespace RemoteLab
{
typedef enum CompAnalyzerEventType {
NoEvent = 0,
Initialize = 1,
TxRxSyncPoint = 2,
StateChanged = 3,
ExtendedErrorReceived = 4,
ConfigurationDataReceived = 5,
ChangeMeasurementSource = 6,
GetMeasurement = 7,
GetMaximumFrequency = 8,
GetMinimumFrequency = 9,
SetFrequency = 10,
MeasurementsReceived = 11,
SweepMeasurementsReceived = 12,
StartSweep = 13,
AbortSweep = 14,
OtherEvent = 15
} CompAnalyzerEventType;
typedef enum CompAnalyzerStartupState {
StartSelectInstrument = 0,
StartGetMaximumFrequency = 1,
StartGetMinimumFrequency = 2,
StartDone = 3
} CompAnalyzerStartupState;
typedef enum CompAnalyzerPartState {
Idle = 0,
Initializing = 1,
FreeRunning = 2,
FrequencySweepWrite = 3,
FrequencySweepRead = 4,
CommunicationFailure = 5
} CompAnalyzerPartState;
typedef struct CompAnalyzerMeasurement {
TQ_UINT32 status;
TQ_UINT32 parameter;
TQ_UINT32 type;
double value;
double frequency;
} CompAnalyzerMeasurement;
typedef TQPair<CompAnalyzerEventType, TQVariant> CompAnalyzerEvent;
typedef TQValueVector<CompAnalyzerEvent> CompAnalyzerEventQueue;
typedef TQValueList<CompAnalyzerMeasurement> CompAnalyzerMeasurementList;
typedef TQPair<unsigned int,TQString> AllowedMeasurementInfo;
typedef TQValueList<AllowedMeasurementInfo> AllowedMeasurementInfoList;
typedef struct CompAnalyzerInstrumentLimits {
TQValueList<AllowedMeasurementInfoList> allowedMeasurements;
double maxFrequency;
double minFrequency;
} CompAnalyzerInstrumentLimits;
#ifndef QT_NO_DATASTREAM
Q_EXPORT TQDataStream &operator<<(TQDataStream &, const CompAnalyzerMeasurement &);
Q_EXPORT TQDataStream &operator>>(TQDataStream &, CompAnalyzerMeasurement &);
#endif
class CompAnalyzerWorker : public TQObject
{
TQ_OBJECT
public:
CompAnalyzerWorker();
~CompAnalyzerWorker();
signals:
void outboundQueueUpdated();
public slots:
void run();
void wake();
void dataReceived();
public:
void resetInboundQueue();
void appendItemToInboundQueue(CompAnalyzerEvent item, bool syncPoint=false);
bool itemTypeInInboundQueue(CompAnalyzerEventType type);
bool syncPointActive();
void lockOutboundQueue();
void unlockOutboundQueue();
CompAnalyzerEventQueue* outboundQueue();
CompAnalyzerPartState currentState();
CompAnalyzerInstrumentLimits getInstrumentLimits();
void setNewParameterSourceList(TQValueList<TQ_UINT32>);
void setSweepStartFrequency(double hz);
void setSweepEndFrequency(double hz);
void setSweepStepFrequency(double hz);
double sweepStartFrequency();
double sweepEndFrequency();
unsigned int sweepStepNumber();
private:
CompAnalyzerEventType nextInboundQueueEvent();
void clearInboundQueueSyncPoint();
void eraseNextInboundQueueEvent(bool clearSyncPoint=false);
void setCurrentState(CompAnalyzerPartState state);
public:
TDEKerberosClientSocket* m_socket;
TQMutex* m_instrumentMutex;
private:
CompAnalyzerEventQueue m_outboundQueue;
CompAnalyzerEventQueue m_inboundQueue;
TQMutex* m_outboundQueueMutex;
TQMutex* m_inboundQueueMutex;
TQMutex* m_networkDataMutex;
TQMutex* m_currentStateMutex;
TQMutex* m_sweepStepMutex;
CompAnalyzerPartState m_currentState;
CompAnalyzerStartupState m_startupState;
CompAnalyzerEventType m_lastNetworkTransmissionEvent;
bool m_newData;
TQValueList<TQ_UINT32> m_sourceList;
CompAnalyzerInstrumentLimits m_instrumentLimits;
double m_sweepStart;
double m_sweepEnd;
double m_sweepStep;
double m_sweepCurrentFrequency;
TQ_UINT32 m_sweepStepNumber;
};
class CompAnalyzerPart : public KParts::RemoteInstrumentPart
{
Q_OBJECT
public:
CompAnalyzerPart( QWidget *, const char *, TQObject *, const char *, const TQStringList&);
~CompAnalyzerPart();
virtual bool openFile() { return false; } // pure virtual in the base class
virtual bool closeURL();
static TDEAboutData *createAboutData();
signals:
void wakeWorkerThread();
public slots:
virtual bool openURL(const KURL &url);
void processOutboundQueue();
void updateZoomWidgetLimits(const TQRectF& zoomRect);
private slots:
void postInit();
void processLockouts();
void connectionFinishedCallback();
void disconnectFromServerCallback();
void connectionStatusChangedCallback();
void setTickerMessage(TQString message);
void networkTick();
void networkTimeout();
void parameterASourceChanged(int);
void parameterBSourceChanged(int);
void frequencyInputChanged(double);
void startSweepClicked();
void stopSweepClicked();
void processAutosave();
void saveWaveforms();
void saveWaveforms(TQString fileName);
void recallWaveforms();
void updateGraticule();
private:
TQString parameterMeasurementUnits(TQ_UINT32 parameter);
TQString parameterNameToMeasurementUnits(TQString name, unsigned int parameter_index);
void requestNetworkOperation(CompAnalyzerEvent item, bool syncPoint=false);
void patWatchDog();
private:
int m_commHandlerState;
int m_commHandlerMode;
int m_commHandlerCommandState;
TQTimer* m_updateTimeoutTimer;
bool m_connectionActiveAndValid;
bool m_instrumentSettingsValid;
unsigned char m_tickerState;
CompAnalyzerBase* m_base;
TQMutex* m_instrumentMutex;
TQString m_TextToSend;
TQValueList<AllowedMeasurementInfoList> m_parameterSourceValues;
TraceWidget* m_traceWidget;
TQGridLayout* m_traceControlWidgetGrid;
SensorList m_sensorList;
TQ_INT16 m_maxNumberOfTraces;
TQ_INT16 m_hdivs;
TQ_INT16 m_vdivs;
TQ_INT32 m_samplesInTrace[MAXTRACES+1];
bool m_channelActive[MAXTRACES+1];
TQString m_traceUnits[MAXTRACES+1];
CompAnalyzerWorker* m_worker;
TQEventLoopThread* m_workerThread;
};
}
#endif

@ -100,6 +100,16 @@ void FloatSpinBox::setFloatValue(double d) {
setValue( ROUND( (value - min) * pow( 10, dec )) );
}
double FloatSpinBox::floatValue() {
return value;
}
void FloatSpinBox::setEnabled(bool enable) {
if (enable != isEnabled()) {
TQSpinBox::setEnabled(enable);
}
}
void FloatSpinBox::acceptValueChanged(int ival) {
Q_UNUSED(ival);
emit floatValueChanged( value );

@ -44,6 +44,8 @@ class FloatSpinBox : public TQSpinBox
void setFloatMax(double max);
void setPrecision(int precision);
double floatValue();
private:
int dec;
virtual TQString mapValueToText(int value);
@ -51,6 +53,7 @@ class FloatSpinBox : public TQSpinBox
public slots:
void setFloatValue(double d);
virtual void setEnabled(bool);
private slots:
void acceptValueChanged(int value);

@ -77,16 +77,23 @@ void Display7Segment::setLitSegments(unsigned char segs) {
unsigned char Display7Segment::segmentsForNumericDigit(unsigned char val, bool dp) {
unsigned char ret = 0;
if (val == 0) { ret = 0x7e; }
else if (val == 1) { ret = 0x30; }
else if (val == 2) { ret = 0x6d; }
else if (val == 3) { ret = 0x79; }
else if (val == 4) { ret = 0x33; }
else if (val == 5) { ret = 0x5b; }
else if (val == 6) { ret = 0x5f; }
else if (val == 7) { ret = 0x70; }
else if (val == 8) { ret = 0x7f; }
else if (val == 9) { ret = 0x73; }
if (val == 0x0) { ret = 0x7e; }
else if (val == 0x1) { ret = 0x30; }
else if (val == 0x2) { ret = 0x6d; }
else if (val == 0x3) { ret = 0x79; }
else if (val == 0x4) { ret = 0x33; }
else if (val == 0x5) { ret = 0x5b; }
else if (val == 0x6) { ret = 0x5f; }
else if (val == 0x7) { ret = 0x70; }
else if (val == 0x8) { ret = 0x7f; }
else if (val == 0x9) { ret = 0x73; }
else if (val == 0xa) { ret = 0x7d; }
else if (val == 0xb) { ret = 0x1f; }
else if (val == 0xc) { ret = 0x0d; }
else if (val == 0xd) { ret = 0x3d; }
else if (val == 0xe) { ret = 0x4f; }
else if (val == 0xf) { ret = 0x67; }
else if (val == 0x10) { ret = 0x01; } // "-"
if (dp) {
ret |= 0x80;
@ -496,7 +503,9 @@ void Display7SegmentArray::init() {
unsigned int i;
// Set up grid layout
m_layout = new TQGridLayout(this, 1, m_numberOfDigits);
m_layout = new TQGridLayout(this, 1, m_numberOfDigits + 1);
TQSpacerItem *spacerItem = new TQSpacerItem(0, 0, TQSizePolicy::Expanding, TQSizePolicy::Fixed);
m_layout->addItem(spacerItem);
m_layout->setAutoAdd(true);
// Allocate display array
@ -528,7 +537,7 @@ void Display7SegmentArray::init() {
m_displayArray[i]->setFrameStyle(TQFrame::NoFrame);
}
setBackgroundColor(TQt::black);
setFrameStyle(TQFrame::Box | TQFrame::Raised);
setFrameStyle(TQFrame::Box);
#endif
}
@ -575,6 +584,9 @@ void Display7SegmentArray::setValue(double value, int maxDecimalLength, bool for
bool dp;
unsigned int i;
TQString displayString = TQString("%1").arg(value);
if (displayString.contains("e")) {
maxDecimalLength = -1;
}
if (maxDecimalLength >= 0) {
int decPos = displayString.find(".");
if (decPos >= 0) {
@ -598,23 +610,39 @@ void Display7SegmentArray::setValue(double value, int maxDecimalLength, bool for
if (displayString.contains(".")) {
current_char--;
}
for (i=0; i < m_numberOfDigits; i++) {
if (current_char < 0) {
m_displayArray[i]->setLitSegments(0x0);
if (displayString.length() > m_numberOfDigits) {
// String is too large to display on the specified number of 7-segment digits
for (i=0; i < m_numberOfDigits; i++) {
m_displayArray[i]->setLitSegments(Display7Segment::segmentsForNumericDigit(0x10, false));
}
else {
dp = false;
if (current_char < (displayString.length() - 1)) {
if (displayString[current_char + 1] == '.') {
dp = true;
}
}
else {
for (i=0; i < m_numberOfDigits; i++) {
if (current_char < 0) {
m_displayArray[i]->setLitSegments(0x0);
}
if (displayString[current_char] == '.') {
current_char++;
else {
dp = false;
if (current_char < (displayString.length() - 1)) {
if (displayString[current_char + 1] == '.') {
dp = true;
}
}
if (displayString[current_char] == '.') {
current_char++;
}
if (displayString[current_char] == '-') {
m_displayArray[i]->setLitSegments(Display7Segment::segmentsForNumericDigit(0x10, dp));
}
else if (displayString[current_char] == 'e') {
m_displayArray[i]->setLitSegments(Display7Segment::segmentsForNumericDigit(0xe, dp));
}
else {
m_displayArray[i]->setLitSegments(Display7Segment::segmentsForNumericDigit(TQString(displayString[current_char]).toInt(NULL, 10), dp));
}
}
m_displayArray[i]->setLitSegments(Display7Segment::segmentsForNumericDigit(TQString(displayString[current_char]).toInt(NULL, 10), dp));
current_char++;
}
current_char++;
}
}

@ -695,6 +695,15 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
activeSamples = abs(rightEdgeIndex-leftEdgeIndex);
incr = (activeSamples/virtual_width)+1;
for (n=leftEdgeIndex; n<numberOfSamples-incr; n=n+incr) {
// Detect invalid samples and skip drawing of those samples
// This avoids ugly drawing artifacts when not all sample data is available
if ( isnan(positionArray[n]) || isinf(positionArray[n])
|| isnan(positionArray[n+incr]) || isinf(positionArray[n+incr])
|| isnan(sampleArray[n]) || isinf(sampleArray[n])
|| isnan(sampleArray[n+incr]) || isinf(sampleArray[n+incr])) {
continue;
}
x = (((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(virtual_width))-horizoffset;
y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
x2 = (((positionArray[n+incr]-leftEdge)/(rightEdge-leftEdge))*(virtual_width))-horizoffset;

@ -763,8 +763,10 @@ int TDEKerberosClientSocket::writeEndOfFrame() {
return ret;
}
bool TDEKerberosClientSocket::canReadFrame() {
processPendingData();
bool TDEKerberosClientSocket::canReadFrame(bool callProcessPendingData) {
if (callProcessPendingData) {
processPendingData();
}
if (m_readBufferLength > 0) {
if (m_readBuffer->buffer().find(255, m_readBufferReadPointer) >= 0) {
return true;

@ -75,7 +75,7 @@ class TDEKerberosClientSocket : public TQSocket
void clearIncomingData();
int writeEndOfFrame();
bool canReadFrame();
bool canReadFrame(bool processPendingData=true);
void clearFrameTail();
void writeBufferedData();

@ -760,8 +760,10 @@ int TDEKerberosServerSocket::writeEndOfFrame() {
return ret;
}
bool TDEKerberosServerSocket::canReadFrame() {
processPendingData();
bool TDEKerberosServerSocket::canReadFrame(bool callProcessPendingData) {
if (callProcessPendingData) {
processPendingData();
}
if (m_readBufferLength > 0) {
if (m_readBuffer->buffer().find(255, m_readBufferReadPointer) >= 0) {
return true;

@ -74,7 +74,7 @@ class TDEKerberosServerSocket : public TQSocket
void clearIncomingData();
int writeEndOfFrame();
bool canReadFrame();
bool canReadFrame(bool processPendingData=true);
void clearFrameTail();
void writeBufferedData();

Loading…
Cancel
Save