|
|
|
@ -28,6 +28,7 @@
|
|
|
|
|
#include <klocale.h>
|
|
|
|
|
#include <kmessagebox.h> //::start()
|
|
|
|
|
#include <kparts/genericfactory.h>
|
|
|
|
|
#include <kmdimainfrm.h>
|
|
|
|
|
#include <kstatusbar.h>
|
|
|
|
|
#include <kstdaction.h>
|
|
|
|
|
#include <knuminput.h>
|
|
|
|
@ -53,10 +54,7 @@
|
|
|
|
|
#include "floatspinbox.h"
|
|
|
|
|
#include "layout.h"
|
|
|
|
|
|
|
|
|
|
// RAJA UNCOMMENT ME
|
|
|
|
|
//#define SERVER_TIMEOUT_MS 10000
|
|
|
|
|
// RAJA DEBUG ONLY
|
|
|
|
|
#define SERVER_TIMEOUT_MS 100000
|
|
|
|
|
#define SERVER_TIMEOUT_MS 10000
|
|
|
|
|
#define FPGA_COMM_TIMEOUT_MS 500
|
|
|
|
|
#define FPGA_DATA_PROCESSING_TIMEOUT_MS 2500
|
|
|
|
|
|
|
|
|
@ -553,6 +551,22 @@ void FPGA7Segment::drawSegment(const TQPoint &pos, char segmentNo, TQPainter &p,
|
|
|
|
|
#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 {
|
|
|
|
|
|
|
|
|
|
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_8bitInputValue(0), m_8bitOutputValue(0), m_16bitInputValue(0), m_16bitOutputValue(0), m_7segDigit3OutputValue(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
|
|
|
|
|
m_clientLibraryName = CLIENT_LIBRARY;
|
|
|
|
@ -718,6 +733,17 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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()) {
|
|
|
|
|
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->groupInputImage->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) {
|
|
|
|
|
m_modeBasicEnabled->setChecked(false);
|
|
|
|
@ -889,6 +924,15 @@ void FPGAViewPart::processLockouts() {
|
|
|
|
|
m_base->groupDataProcessing->hide();
|
|
|
|
|
m_base->groupInputImage->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) {
|
|
|
|
|
m_modeBasicEnabled->setChecked(false);
|
|
|
|
@ -901,6 +945,17 @@ void FPGAViewPart::processLockouts() {
|
|
|
|
|
m_base->groupDataProcessing->show();
|
|
|
|
|
m_base->groupInputImage->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)) {
|
|
|
|
@ -1320,6 +1375,7 @@ void FPGAViewPart::updateDisplay() {
|
|
|
|
|
// Show image in GUI
|
|
|
|
|
TQPixmap inputImagePixmap(m_dataInputImage);
|
|
|
|
|
m_base->ImageInputLabel->setPixmap(inputImagePixmap);
|
|
|
|
|
m_inputImageViewer->setPixmap(inputImagePixmap);
|
|
|
|
|
// Populate m_dataByteArray with image data
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
@ -1388,6 +1444,7 @@ void FPGAViewPart::updateDisplay() {
|
|
|
|
|
// Write data straight to file
|
|
|
|
|
m_dataOutputFile->writeBlock(recData);
|
|
|
|
|
m_base->ImageOutputLabel->setPixmap(TQPixmap());
|
|
|
|
|
m_outputImageViewer->setPixmap(TQPixmap());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Write data to image, then write image to file
|
|
|
|
@ -1403,6 +1460,7 @@ void FPGAViewPart::updateDisplay() {
|
|
|
|
|
}
|
|
|
|
|
TQPixmap outputImagePixmap(outputImage);
|
|
|
|
|
m_base->ImageOutputLabel->setPixmap(outputImagePixmap);
|
|
|
|
|
m_outputImageViewer->setPixmap(outputImagePixmap);
|
|
|
|
|
outputImage.save(m_dataOutputFile, "PNG");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|