# HG changeset patch # User Alexis Jeandet # Date 2015-07-27 22:02:24 # Node ID 67168ff4b6e78a9cfcc652938253a073d1a13efc # Parent c92c4a05386ad7c8a9e230d2f64ed59bf0048313 SpwPlugin: -Fixed bug, when switching from one bridge to an other, the previous gui didn't disapear. -Some work on stardundee runtime driver loading, added some GUI helpers. diff --git a/spwplugin/StarDundee/fakestardundeespwusb_lib.cpp b/spwplugin/StarDundee/fakestardundeespwusb_lib.cpp --- a/spwplugin/StarDundee/fakestardundeespwusb_lib.cpp +++ b/spwplugin/StarDundee/fakestardundeespwusb_lib.cpp @@ -88,11 +88,7 @@ int (*resolved_CFGSpaceWire_GetTickEna int (*resolved_CFGSpaceWire_SetTickEnableStatus)(star_device_handle hDevice, U32 dwTickEnableStatus)=NULL; -typedef struct funcToresolve -{ - void (** function)(); - const char* symbolName; -}funcToresolve; + QList funcTable=QList() < &FakeStarDundeeSpwUSB_Lib::status() +{ + return funcTable; +} + char USBSpaceWire_Open(star_device_handle *phDevice, int nDeviceNum) diff --git a/spwplugin/StarDundee/fakestardundeespwusb_lib.h b/spwplugin/StarDundee/fakestardundeespwusb_lib.h --- a/spwplugin/StarDundee/fakestardundeespwusb_lib.h +++ b/spwplugin/StarDundee/fakestardundeespwusb_lib.h @@ -359,7 +359,11 @@ void CFGSpaceWire_RTGetOutputPorts(U32 int CFGSpaceWire_GetTickEnableStatus(star_device_handle hDevice, U32 *dwTickEnableStatus); int CFGSpaceWire_SetTickEnableStatus(star_device_handle hDevice, U32 dwTickEnableStatus); - +typedef struct funcToresolve +{ + void (** function)(); + const char* symbolName; +}funcToresolve; class FakeStarDundeeSpwUSB_Lib @@ -367,6 +371,8 @@ class FakeStarDundeeSpwUSB_Lib public: FakeStarDundeeSpwUSB_Lib(); static void resolve(); + static bool fullresolved(); + static const QList& status(); }; #endif // FAKESTARDUNDEESPWUSB_LIB_H diff --git a/spwplugin/StarDundee/fakestardundeespwusbgui.cpp b/spwplugin/StarDundee/fakestardundeespwusbgui.cpp new file mode 100644 --- /dev/null +++ b/spwplugin/StarDundee/fakestardundeespwusbgui.cpp @@ -0,0 +1,57 @@ +#include "fakestardundeespwusbgui.h" +#include "ui_fakestardundeespwusbgui.h" +#include "fakestardundeespwusb_lib.h" + +FakeStardundeeSpwUsbGui::FakeStardundeeSpwUsbGui(QWidget *parent) : + QWidget(parent), + ui(new Ui::FakeStardundeeSpwUsbGui) +{ + ui->setupUi(this); +} + +FakeStardundeeSpwUsbGui::~FakeStardundeeSpwUsbGui() +{ + delete ui; +} + +void FakeStardundeeSpwUsbGui::update() +{ + const QList stat=FakeStarDundeeSpwUSB_Lib::status(); + QTableWidgetItem* item; + this->ui->symbolsList->clear(); + this->ui->symbolsList->setHorizontalHeaderLabels(QStringList()<<"Symbol"<<"Status"); + this->ui->symbolsList->setRowCount(stat.count()); + for(int i=0;isetFlags(item->flags()^Qt::ItemIsEditable); + this->ui->symbolsList->setItem(i,0,item); + if(*(stat[i].function)==NULL) + { + item=new QTableWidgetItem("Not found"); + item->setForeground(Qt::red); + item->setFlags(item->flags()^Qt::ItemIsEditable); + this->ui->symbolsList->setItem(i,1,item); + } + else + { + item=new QTableWidgetItem("Loaded"); + item->setForeground(Qt::green); + item->setFlags(item->flags()^Qt::ItemIsEditable); + this->ui->symbolsList->setItem(i,1,item); + } + } + this->ui->symbolsList->resizeColumnsToContents(); +} + +void FakeStardundeeSpwUsbGui::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/spwplugin/StarDundee/fakestardundeespwusbgui.h b/spwplugin/StarDundee/fakestardundeespwusbgui.h new file mode 100644 --- /dev/null +++ b/spwplugin/StarDundee/fakestardundeespwusbgui.h @@ -0,0 +1,25 @@ +#ifndef FAKESTARDUNDEESPWUSBGUI_H +#define FAKESTARDUNDEESPWUSBGUI_H + +#include + +namespace Ui { +class FakeStardundeeSpwUsbGui; +} + +class FakeStardundeeSpwUsbGui : public QWidget +{ + Q_OBJECT + +public: + explicit FakeStardundeeSpwUsbGui(QWidget *parent = 0); + ~FakeStardundeeSpwUsbGui(); + void update(); +protected: + void changeEvent(QEvent *e); + +private: + Ui::FakeStardundeeSpwUsbGui *ui; +}; + +#endif // FAKESTARDUNDEESPWUSBGUI_H diff --git a/spwplugin/StarDundee/fakestardundeespwusbgui.ui b/spwplugin/StarDundee/fakestardundeespwusbgui.ui new file mode 100644 --- /dev/null +++ b/spwplugin/StarDundee/fakestardundeespwusbgui.ui @@ -0,0 +1,84 @@ + + + FakeStardundeeSpwUsbGui + + + + 0 + 0 + 612 + 300 + + + + Form + + + + + + close + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + true + + + true + + + false + + + + Symbol + + + + + Status + + + + + + + + + + closeQpb + clicked() + FakeStardundeeSpwUsbGui + close() + + + 560 + 275 + + + 305 + 149 + + + + + diff --git a/spwplugin/StarDundee/stardundeeGUI.ui b/spwplugin/StarDundee/stardundeeGUI.ui --- a/spwplugin/StarDundee/stardundeeGUI.ui +++ b/spwplugin/StarDundee/stardundeeGUI.ui @@ -6,22 +6,22 @@ 0 0 - 397 - 506 + 609 + 581 Form - + Select Brick - + <html><head/><body><p>Select the brick you want to use.</p></body></html> @@ -36,14 +36,14 @@ - + Select link number - + <html><head/><body><p>Select the link number you want to use.</p><p>The link number correspond to the numbers on the brick:</p><p><img src=":/imgs/stardundee.tif"/></p><p><br/></p></body></html> @@ -60,14 +60,14 @@ - + Link Speed - + <html><head/><body><p>Select the Space Wire link speed you want to use.</p></body></html> @@ -79,14 +79,14 @@ - + Source address - + <html><head/><body><p>Set the Space Wire Brick destination Key, the default value is 32 (0x20).</p></body></html> @@ -102,14 +102,14 @@ - + Destination address - + <html><head/><body><p>Set the RMAP target address, this address will be used as destination address for all the RMAP transfers.</p><p>This is you SOC spw address.</p></body></html> @@ -125,14 +125,14 @@ - + Destination key - + <html><head/><body><p>Set the RMAP target key, this key will be used for all the RMAP transfers.</p><p>This is you SOC spw key.</p></body></html> @@ -148,7 +148,7 @@ - + <html><head/><body><p>Set the RMAP timeout, when waiting for a RMAP answer the driver will give up after this time if it doesn't get any answer.</p></body></html> @@ -167,38 +167,38 @@ - + RMAP timeout(ms) - + Connect - + - interface mode + i&nterface mode true - + - router mode + router &mode - + @@ -277,27 +277,61 @@ - + timecode - + Timecode f (Hz) - + 1 + + + + Driver Status + + + + + + + 0 + + + 0 + + + + + <html><head/><body><p><span style=" color:#ff0000;">NotLoaded</span></p></body></html> + + + Qt::AlignCenter + + + + + + + Details + + + + + diff --git a/spwplugin/StarDundee/stardundeegui.cpp b/spwplugin/StarDundee/stardundeegui.cpp --- a/spwplugin/StarDundee/stardundeegui.cpp +++ b/spwplugin/StarDundee/stardundeegui.cpp @@ -23,8 +23,6 @@ #include "ui_stardundeeGUI.h" #include "fakestardundeespwusb_lib.h" -//#include -//#include StarDundeeGUI::StarDundeeGUI(QWidget *parent) : QWidget(parent),ui(new Ui::StarDundeeUI) @@ -45,6 +43,11 @@ StarDundeeGUI::StarDundeeGUI(QWidget *pa connect(this->ui->setInterfaceModeQrb, SIGNAL(toggled(bool)), this, SIGNAL(brickModeChanged(bool))); connect(this->ui->resetStatsQpb, SIGNAL(clicked()), this, SLOT(resetStatistics())); connect(this->ui->spwTimecodes, SIGNAL(toggled(bool)), this, SIGNAL(startSendingTimecode(bool))); + connect(this->ui->driverStatusQpb,SIGNAL(clicked(bool)),this,SLOT(showDriverStatus())); + if(FakeStarDundeeSpwUSB_Lib::fullresolved()) + this->ui->driverstatuslbl->setText("

Driver loaded

"); + else + this->ui->driverstatuslbl->setText("

Driver not loaded(error!)

"); } int StarDundeeGUI::getBrickSelection() @@ -97,6 +100,12 @@ bool StarDundeeGUI::isBrickSetAsAnInterf return ui->setInterfaceModeQrb->isChecked(); } +void StarDundeeGUI::showDriverStatus() +{ + this->driverStatus.update(); + this->driverStatus.show(); +} + void StarDundeeGUI::setBrickAsAnInterface( bool interfaceMode ) { if (interfaceMode == true) diff --git a/spwplugin/StarDundee/stardundeegui.h b/spwplugin/StarDundee/stardundeegui.h --- a/spwplugin/StarDundee/stardundeegui.h +++ b/spwplugin/StarDundee/stardundeegui.h @@ -24,6 +24,8 @@ #include +#include "fakestardundeespwusbgui.h" + namespace Ui { class StarDundeeUI; } @@ -57,6 +59,7 @@ signals: void brickModeChanged(bool); void startSendingTimecode(bool); public slots: + void showDriverStatus(); void lock(bool lock); void updateAvailableBrickCount(int count); void selectBrick(int brickIndex); @@ -85,6 +88,7 @@ private: unsigned int nbPacketsReceivedFromSpw; unsigned int nbPacketsTransmittedToSpw; unsigned int nbCCSDSPacketsTransmittedToSpw; + FakeStardundeeSpwUsbGui driverStatus; }; #endif // STARDUNDEEGUI_H diff --git a/spwplugin/spwRessources.qrc b/spwplugin/spwRessources.qrc --- a/spwplugin/spwRessources.qrc +++ b/spwplugin/spwRessources.qrc @@ -1,5 +1,5 @@ - StarDundee/stardundee.tif + StarDundee/stardundee.tif diff --git a/spwplugin/spwplugin.cpp b/spwplugin/spwplugin.cpp --- a/spwplugin/spwplugin.cpp +++ b/spwplugin/spwplugin.cpp @@ -80,6 +80,7 @@ void spwplugin::bridgeSelectionChanged(c if(this->bridge!=NULL) { this->mainLayout->removeWidget(this->bridge->getGUI()); + this->bridge->getGUI()->hide(); this->disconnect(this,SLOT(setConnected(bool))); delete this->bridge; this->bridge= NULL; @@ -90,6 +91,7 @@ void spwplugin::bridgeSelectionChanged(c if(this->bridge!=NULL) { this->mainLayout->removeWidget(this->bridge->getGUI()); + this->bridge->getGUI()->hide(); this->disconnect(this,SLOT(setConnected(bool))); delete this->bridge; } @@ -130,6 +132,7 @@ void spwplugin::bridgeSelectionChanged(c if(this->bridge!=NULL) { this->mainLayout->removeWidget(this->bridge->getGUI()); + this->bridge->getGUI()->hide(); this->disconnect(this,SLOT(setConnected(bool))); delete this->bridge; } diff --git a/spwplugin/spwplugin.pro b/spwplugin/spwplugin.pro --- a/spwplugin/spwplugin.pro +++ b/spwplugin/spwplugin.pro @@ -12,7 +12,7 @@ QMAKE_CFLAGS += -std=c++11 win32:CONFIG += dll win32:CONFIG -= static -VERSION=0.6.0 +VERSION=0.6.1 TARGET = spwplugin DEFINES += PLUGIN=spwplugin DEFINES += PLUGINHEADER="\"\\\"spwplugin.h"\\\"\" @@ -46,7 +46,8 @@ HEADERS += \ GR-ESB/gr_esb_bridge.h \ GR-ESB/gr_esb_ui.h \ SpwTcpPacketServer/incomingpacketparser.h \ - StarDundee/fakestardundeespwusb_lib.h + StarDundee/fakestardundeespwusb_lib.h \ + StarDundee/fakestardundeespwusbgui.h SOURCES += \ @@ -58,12 +59,14 @@ SOURCES += \ GR-ESB/gr_esb_bridge.cpp \ GR-ESB/gr_esb_ui.cpp \ SpwTcpPacketServer/incomingpacketparser.cpp \ - StarDundee/fakestardundeespwusb_lib.cpp + StarDundee/fakestardundeespwusb_lib.cpp \ + StarDundee/fakestardundeespwusbgui.cpp FORMS += \ StarDundee/stardundeeGUI.ui \ SpwTcpPacketServer/spwtcppacketserver.ui \ - GR-ESB/gr_esb_ui.ui + GR-ESB/gr_esb_ui.ui \ + StarDundee/fakestardundeespwusbgui.ui RESOURCES += \ spwRessources.qrc