Add client image display windows to remotefpga viewer

master
Timothy Pearson 13 years ago
parent a3e28da8e9
commit 58cefd2d01

@ -1,5 +1,4 @@
INCLUDES = -I$(top_srcdir)/src/part $(all_includes) $(KDE_INCLUDES)/tde INCLUDES = -I$(top_srcdir)/src/part $(all_includes) $(KDE_INCLUDES)/tde
METASOURCES = AUTO METASOURCES = AUTO
noinst_LTLIBRARIES = libinstrumentview.la noinst_LTLIBRARIES = libinstrumentview.la
libinstrumentview_la_SOURCES = instrumentview.cpp libinstrumentview_la_SOURCES = instrumentview.cpp

@ -9,6 +9,7 @@
#include <kiconloader.h> #include <kiconloader.h>
#include <klocale.h> #include <klocale.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <kmdimainfrm.h>
namespace RemoteLab { namespace RemoteLab {
@ -19,6 +20,7 @@ InstrumentView::InstrumentView(const TQString &library, TQWidget *parentWidget,
, m_fixedSize( false ) , m_fixedSize( false )
, m_canary( NULL ) , m_canary( NULL )
{ {
m_mainForm = dynamic_cast<KMdiMainFrm*>(parentWidget);
init(); init();
} }
@ -29,6 +31,7 @@ InstrumentView::InstrumentView(const TQString &library, const TQString &caption,
, m_fixedSize( false ) , m_fixedSize( false )
, m_canary( NULL ) , m_canary( NULL )
{ {
m_mainForm = dynamic_cast<KMdiMainFrm*>(parentWidget);
init(); init();
} }
@ -47,6 +50,7 @@ void InstrumentView::init() {
} }
else { else {
m_instrumentPart = (InstrumentPart *)factory->create(TQT_TQOBJECT(this), "part", "KParts::RemoteInstrumentPart"); m_instrumentPart = (InstrumentPart *)factory->create(TQT_TQOBJECT(this), "part", "KParts::RemoteInstrumentPart");
m_instrumentPart->setMDIMainForm(m_mainForm);
setIcon(SmallIcon(m_libraryName)); setIcon(SmallIcon(m_libraryName));
connect(m_instrumentPart, SIGNAL(statusMessageSet(const TQString&)), this, SLOT(setStatusMessage(const TQString&))); connect(m_instrumentPart, SIGNAL(statusMessageSet(const TQString&)), this, SLOT(setStatusMessage(const TQString&)));
connect(m_instrumentPart, SIGNAL(usingFixedSizeChanged(bool)), this, SLOT(setUsingFixedSize(bool))); connect(m_instrumentPart, SIGNAL(usingFixedSizeChanged(bool)), this, SLOT(setUsingFixedSize(bool)));

@ -46,6 +46,7 @@ class InstrumentView : public KMdiChildView
private: private:
void init(); void init();
KMdiMainFrm* m_mainForm;
TQString m_libraryName; TQString m_libraryName;
RemoteLab::InstrumentPart *m_instrumentPart; RemoteLab::InstrumentPart *m_instrumentPart;
bool m_fixedSize; bool m_fixedSize;

@ -7,5 +7,5 @@ KDE_ICON = libremotelab_fpgaviewer
# Part # Part
kde_module_LTLIBRARIES = libremotelab_fpgaviewer.la kde_module_LTLIBRARIES = libremotelab_fpgaviewer.la
libremotelab_fpgaviewer_la_LIBADD = ../../widgets/libtracewidget.la ../../widgets/libfloatspinbox.la $(LIB_KFILE) $(LIB_KPARTS) $(LIB_TDEUI) $(LIB_QT) -ltdekrbsocket -ltqtrla libremotelab_fpgaviewer_la_LIBADD = ../../widgets/libtracewidget.la ../../widgets/libfloatspinbox.la $(LIB_KFILE) $(LIB_KPARTS) $(LIB_TDEUI) $(LIB_QT) -ltdekrbsocket -ltqtrla
libremotelab_fpgaviewer_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(LIB_TDECORE) $(LIB_TDEUI) -lkio -ltdefx libremotelab_fpgaviewer_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(LIB_TDECORE) $(LIB_TDEUI) -lkio -ltdefx -lkmdi
libremotelab_fpgaviewer_la_SOURCES = part.cpp layout.ui libremotelab_fpgaviewer_la_SOURCES = part.cpp layout.ui

@ -28,6 +28,7 @@
#include <klocale.h> #include <klocale.h>
#include <kmessagebox.h> //::start() #include <kmessagebox.h> //::start()
#include <kparts/genericfactory.h> #include <kparts/genericfactory.h>
#include <kmdimainfrm.h>
#include <kstatusbar.h> #include <kstatusbar.h>
#include <kstdaction.h> #include <kstdaction.h>
#include <knuminput.h> #include <knuminput.h>
@ -53,10 +54,7 @@
#include "floatspinbox.h" #include "floatspinbox.h"
#include "layout.h" #include "layout.h"
// RAJA UNCOMMENT ME #define SERVER_TIMEOUT_MS 10000
//#define SERVER_TIMEOUT_MS 10000
// RAJA DEBUG ONLY
#define SERVER_TIMEOUT_MS 100000
#define FPGA_COMM_TIMEOUT_MS 500 #define FPGA_COMM_TIMEOUT_MS 500
#define FPGA_DATA_PROCESSING_TIMEOUT_MS 2500 #define FPGA_DATA_PROCESSING_TIMEOUT_MS 2500
@ -553,6 +551,22 @@ void FPGA7Segment::drawSegment(const TQPoint &pos, char segmentNo, TQPainter &p,
#undef DARK #undef DARK
} }
ImageViewerWindow::ImageViewerWindow(TQString caption, TQWidget *parent, const char *name)
: KMdiChildView(caption, parent, name)
{
TQGridLayout* layout = new TQGridLayout(this);
m_label = new TQLabel(this);
layout->addWidget(m_label, 0, 0);
}
ImageViewerWindow::~ImageViewerWindow() {
//
}
void ImageViewerWindow::setPixmap(TQPixmap pixmap) {
m_label->setPixmap(pixmap);
}
namespace RemoteLab { namespace RemoteLab {
typedef KParts::GenericFactory<RemoteLab::FPGAViewPart> Factory; typedef KParts::GenericFactory<RemoteLab::FPGAViewPart> Factory;
@ -567,7 +581,8 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj
m_commHandlerState(0), m_commHandlerMode(0), m_connectionActiveAndValid(false), m_tickerState(0), m_remoteInputModeEnabled(false), m_4bitInputValue(0), m_4bitOutputValue(0), m_commHandlerState(0), m_commHandlerMode(0), m_connectionActiveAndValid(false), m_tickerState(0), m_remoteInputModeEnabled(false), m_4bitInputValue(0), m_4bitOutputValue(0),
m_8bitInputValue(0), m_8bitOutputValue(0), m_16bitInputValue(0), m_16bitOutputValue(0), m_7segDigit3OutputValue(0xffffffff), m_8bitInputValue(0), m_8bitOutputValue(0), m_16bitInputValue(0), m_16bitOutputValue(0), m_7segDigit3OutputValue(0xffffffff),
m_7segDigit2OutputValue(0xffffffff), m_7segDigit1OutputValue(0xffffffff), m_7segDigit0OutputValue(0xffffffff), m_7segDigit2OutputValue(0xffffffff), m_7segDigit1OutputValue(0xffffffff), m_7segDigit0OutputValue(0xffffffff),
m_batchOutputFile(NULL), m_dataOutputFile(NULL) m_batchOutputFile(NULL), m_dataOutputFile(NULL),
m_inputImageViewer(NULL), m_outputImageViewer(NULL)
{ {
// Initialize important base class variables // Initialize important base class variables
m_clientLibraryName = CLIENT_LIBRARY; m_clientLibraryName = CLIENT_LIBRARY;
@ -718,6 +733,17 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj
} }
FPGAViewPart::~FPGAViewPart() { FPGAViewPart::~FPGAViewPart() {
// Close any active image display windows
m_interfaceMode = BasicInterfaceMode;
if (m_inputImageViewer) {
mdiMainForm()->closeWindow(m_inputImageViewer);
m_inputImageViewer = NULL;
}
if (m_outputImageViewer) {
mdiMainForm()->closeWindow(m_outputImageViewer);
m_outputImageViewer = NULL;
}
if (m_connectionMutex->locked()) { if (m_connectionMutex->locked()) {
printf("[WARNING] Exiting when data transfer still in progress!\n\r"); fflush(stdout); printf("[WARNING] Exiting when data transfer still in progress!\n\r"); fflush(stdout);
} }
@ -877,6 +903,15 @@ void FPGAViewPart::processLockouts() {
m_base->groupDataProcessing->hide(); m_base->groupDataProcessing->hide();
m_base->groupInputImage->hide(); m_base->groupInputImage->hide();
m_base->groupOutputImage->hide(); m_base->groupOutputImage->hide();
if (m_inputImageViewer) {
mdiMainForm()->closeWindow(m_inputImageViewer);
m_inputImageViewer = NULL;
}
if (m_outputImageViewer) {
mdiMainForm()->closeWindow(m_outputImageViewer);
m_outputImageViewer = NULL;
}
} }
if (m_interfaceMode == IntermediateInterfaceMode) { if (m_interfaceMode == IntermediateInterfaceMode) {
m_modeBasicEnabled->setChecked(false); m_modeBasicEnabled->setChecked(false);
@ -889,6 +924,15 @@ void FPGAViewPart::processLockouts() {
m_base->groupDataProcessing->hide(); m_base->groupDataProcessing->hide();
m_base->groupInputImage->hide(); m_base->groupInputImage->hide();
m_base->groupOutputImage->hide(); m_base->groupOutputImage->hide();
if (m_inputImageViewer) {
mdiMainForm()->closeWindow(m_inputImageViewer);
m_inputImageViewer = NULL;
}
if (m_outputImageViewer) {
mdiMainForm()->closeWindow(m_outputImageViewer);
m_outputImageViewer = NULL;
}
} }
if (m_interfaceMode == AdvancedInterfaceMode) { if (m_interfaceMode == AdvancedInterfaceMode) {
m_modeBasicEnabled->setChecked(false); m_modeBasicEnabled->setChecked(false);
@ -901,6 +945,17 @@ void FPGAViewPart::processLockouts() {
m_base->groupDataProcessing->show(); m_base->groupDataProcessing->show();
m_base->groupInputImage->show(); m_base->groupInputImage->show();
m_base->groupOutputImage->show(); m_base->groupOutputImage->show();
if (!m_inputImageViewer) {
m_inputImageViewer = new ImageViewerWindow(i18n("Remote FPGA Input Image"));
mdiMainForm()->addWindow(m_inputImageViewer);
m_inputImageViewer->resize(m_base->ImageInputLabel->size());
}
if (!m_outputImageViewer) {
m_outputImageViewer = new ImageViewerWindow(i18n("Remote FPGA Output Image"));
mdiMainForm()->addWindow(m_outputImageViewer);
m_outputImageViewer->resize(m_base->ImageOutputLabel->size());
}
} }
if ((m_base->batchTestInputFile->url() != "") && (m_base->batchTestOutputFile->url() != "") && (m_commHandlerMode == 0) && (m_connectionActiveAndValid == true)) { if ((m_base->batchTestInputFile->url() != "") && (m_base->batchTestOutputFile->url() != "") && (m_commHandlerMode == 0) && (m_connectionActiveAndValid == true)) {
@ -1320,6 +1375,7 @@ void FPGAViewPart::updateDisplay() {
// Show image in GUI // Show image in GUI
TQPixmap inputImagePixmap(m_dataInputImage); TQPixmap inputImagePixmap(m_dataInputImage);
m_base->ImageInputLabel->setPixmap(inputImagePixmap); m_base->ImageInputLabel->setPixmap(inputImagePixmap);
m_inputImageViewer->setPixmap(inputImagePixmap);
// Populate m_dataByteArray with image data // Populate m_dataByteArray with image data
int x; int x;
int y; int y;
@ -1388,6 +1444,7 @@ void FPGAViewPart::updateDisplay() {
// Write data straight to file // Write data straight to file
m_dataOutputFile->writeBlock(recData); m_dataOutputFile->writeBlock(recData);
m_base->ImageOutputLabel->setPixmap(TQPixmap()); m_base->ImageOutputLabel->setPixmap(TQPixmap());
m_outputImageViewer->setPixmap(TQPixmap());
} }
else { else {
// Write data to image, then write image to file // Write data to image, then write image to file
@ -1403,6 +1460,7 @@ void FPGAViewPart::updateDisplay() {
} }
TQPixmap outputImagePixmap(outputImage); TQPixmap outputImagePixmap(outputImage);
m_base->ImageOutputLabel->setPixmap(outputImagePixmap); m_base->ImageOutputLabel->setPixmap(outputImagePixmap);
m_outputImageViewer->setPixmap(outputImagePixmap);
outputImage.save(m_dataOutputFile, "PNG"); outputImage.save(m_dataOutputFile, "PNG");
} }

@ -35,6 +35,8 @@
#include <kurl.h> #include <kurl.h>
#include <kled.h> #include <kled.h>
#include <kmdichildview.h>
#include <tqtrla.h> #include <tqtrla.h>
class KAboutData; class KAboutData;
@ -125,6 +127,21 @@ class Q_EXPORT FPGA7Segment : public TQFrame
FPGA7SegmentPrivate *d; FPGA7SegmentPrivate *d;
}; };
class ImageViewerWindow : public KMdiChildView
{
Q_OBJECT
public:
ImageViewerWindow(TQString caption, TQWidget* parent=0, const char* name=0);
~ImageViewerWindow();
public:
void setPixmap(TQPixmap);
private:
TQLabel* m_label;
};
typedef TQValueList<unsigned int> UnsignedIntegerList; typedef TQValueList<unsigned int> UnsignedIntegerList;
namespace RemoteLab namespace RemoteLab
@ -222,6 +239,9 @@ namespace RemoteLab
TQImage m_dataInputImage; TQImage m_dataInputImage;
TQFile* m_dataOutputFile; TQFile* m_dataOutputFile;
TQByteArray m_dataByteArray; TQByteArray m_dataByteArray;
ImageViewerWindow* m_inputImageViewer;
ImageViewerWindow* m_outputImageViewer;
}; };
} }

@ -48,7 +48,7 @@ namespace KParts
RemoteInstrumentPart::RemoteInstrumentPart(TQObject *parent, const char *name) RemoteInstrumentPart::RemoteInstrumentPart(TQObject *parent, const char *name)
: Part( parent, name ), : Part( parent, name ),
m_socket(NULL), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL), m_fixedSize(false) m_socket(NULL), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL), m_fixedSize(false), m_mdiMainForm(NULL)
{ {
d = new RemoteInstrumentPartPrivate; d = new RemoteInstrumentPartPrivate;
@ -309,6 +309,14 @@ namespace KParts
} }
} }
void RemoteInstrumentPart::setMDIMainForm(KMdiMainFrm* form) {
m_mdiMainForm = form;
}
KMdiMainFrm* RemoteInstrumentPart::mdiMainForm() {
return m_mdiMainForm;
}
void RemoteInstrumentPart::connectionFinishedCallback() { void RemoteInstrumentPart::connectionFinishedCallback() {
// //
} }

@ -40,6 +40,8 @@ typedef TQValueList<TQ_INT16> TQInt16List;
// ============================================================================= // =============================================================================
class KMdiMainFrm;
namespace KParts namespace KParts
{ {
class RemoteInstrumentPartPrivate; class RemoteInstrumentPartPrivate;
@ -68,6 +70,8 @@ namespace KParts
public: public:
int connectToServer(TQString server); int connectToServer(TQString server);
void disconnectFromServer(); void disconnectFromServer();
void setMDIMainForm(KMdiMainFrm* form);
KMdiMainFrm* mdiMainForm();
private slots: private slots:
void finishConnectingToServer(); void finishConnectingToServer();
@ -96,6 +100,7 @@ namespace KParts
int connToServerState; int connToServerState;
TQTimer *connToServerTimeoutTimer; TQTimer *connToServerTimeoutTimer;
bool m_fixedSize; bool m_fixedSize;
KMdiMainFrm* m_mdiMainForm;
private: private:
RemoteInstrumentPartPrivate *d; RemoteInstrumentPartPrivate *d;

Loading…
Cancel
Save