##// END OF EJS Templates
tmstatistics updated
tmstatistics updated

File last commit:

r69:d8815b251eb0 default
r74:98a2ff79bb0a default
Show More
mainwindowui.cpp
203 lines | 8.3 KiB | text/x-c | CppLexer
#include "mainwindowui.h"
MainWindowUI::MainWindowUI(QWidget *parent) :
QWidget(parent)
{
label_serverTMEcho = new QLabel(tr("TM Echo Server address"));
label_serverTMEchoPort = new QLabel(tr("TM Echo Server Port"));
label_TMServerPort = new QLabel(tr("TM Server Port:"));
label_TCServerPort = new QLabel(tr("TC Server Port:"));
label_currentTCTMServer = new QLabel(tr("Current IP address:"));
label_currentTCTMServerIP = new QLabel(tr("-"));
label_totalOfBytes = new QLabel(tr("Received Bytes: -"));
label_totalOfPackets = new QLabel(tr("Received Packets: -"));
console = new QTextEdit();
spwTabWidget = new QTabWidget();
spwTabWidgetPage0 = new QWidget();
spwTabWidgetPage1 = new QWidget();
spwTabWidgetPage2 = new QWidget();
spwTabWidgetPage3 = new QWidget();
tmStatistics = new TMStatistics;
wfDisplay = new WFDisplay(0, 2048, 2048, 15000);
wfPage_CWF_F1 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
wfPage_CWF_F2 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
wfPage_CWF_F3 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
asmPage_F0 = new ASMPage(0, NB_BINS_PER_ASM_F0, NB_BINS_PER_ASM_F0, 15000);
wfPage_CWF_F1->pageTitle = "SBM1_CWF_F1";
wfPage_CWF_F2->pageTitle = "SBM2_CWF_F2";
wfPage_CWF_F3->pageTitle = "NORM_CWF_F3";
asmPage_F0->pageTitle = "ASM_F0";
hkDisplay = new HKDisplay();
recordPage = new RecordPage;
spinbox_TMServerPort = new QSpinBox();
spinbox_TCServerPort = new QSpinBox();
spinbox_serverTMEchoPort = new QSpinBox();
spinbox_TMServerPort->setRange(59000, 65535);
spinbox_TCServerPort->setRange(59001, 65535);
spinbox_serverTMEchoPort->setRange(59002, 65535);
button_openServerTCTM = new QPushButton(tr("Open TC / TM Ports"));
button_testServerTCTM = new QPushButton(tr("Test TC / TM Ports"));
button_openSocketEchoServer = new QPushButton(tr("Open Echo Server"));
button_TCAcknowledgement = new QPushButton(tr("send TC Acknowledgement"));
button_TCRejection = new QPushButton(tr("send TC rejection"));
button_GSEHK = new QPushButton(tr("send GSE HK"));
button_clearConsole = new QPushButton(tr("Clear console"));
button_resetStatistics = new QPushButton(tr("Reset statistics"));
serverTMEchoDialogBox = new QIPDialogBox();
serverTMEchoDialogBox->setIP(127, 0, 0, 1);
groupbox_TMEcho = new QGroupBox(tr("TM Echo Server"));
groupbox_ports = new QGroupBox(tr("Ports for the TM and TC Servers"));
groupbox_TMToForeignGSETester = new QGroupBox(tr("Send TM to the foreign GSE tester"));
layout_TMEcho = new QVBoxLayout();
layout_overallLayout = new QVBoxLayout();
layout_ports = new QGridLayout();
layout_TMToForeignGSETester = new QVBoxLayout();
mainLayout = new QGridLayout();
parameterDump = new ParameterDump();
layout_TMEcho->addWidget(label_serverTMEcho);
layout_TMEcho->addWidget(serverTMEchoDialogBox);
layout_TMEcho->addWidget(label_serverTMEchoPort);
layout_TMEcho->addWidget(spinbox_serverTMEchoPort);
layout_TMEcho->addWidget(button_openSocketEchoServer);
layout_TMEcho->addWidget(label_totalOfPackets);
layout_TMEcho->addWidget(label_totalOfBytes);
layout_TMEcho->addWidget(button_resetStatistics);
groupbox_TMEcho->setLayout(layout_TMEcho);
layout_ports->addWidget(label_TMServerPort, 0, 0, 1, 1);
layout_ports->addWidget(spinbox_TMServerPort, 0, 1, 1, 1);
layout_ports->addWidget(label_TCServerPort, 1, 0, 1, 1);
layout_ports->addWidget(spinbox_TCServerPort, 1, 1, 1, 1);
layout_ports->addWidget(button_openServerTCTM, 2, 0, 1, 2);
layout_ports->addWidget(button_testServerTCTM, 3, 0, 1, 2);
groupbox_ports->setLayout(layout_ports);
layout_TMToForeignGSETester->addWidget(button_TCAcknowledgement);
layout_TMToForeignGSETester->addWidget(button_TCRejection);
layout_TMToForeignGSETester->addWidget(button_GSEHK);
groupbox_TMToForeignGSETester->setLayout(layout_TMToForeignGSETester);
mainLayout->addWidget(groupbox_TMEcho, 0, 0, 1, 1);
mainLayout->addWidget(button_clearConsole, 1, 0, 1, 1);
mainLayout->addWidget(console, 0, 1, 2, 1);
mainLayout->addWidget(groupbox_ports, 2, 0, 1, 1);
mainLayout->addWidget(groupbox_TMToForeignGSETester, 2, 1, 1, 1);
mainLayout->setColumnStretch(2, 1);
mainLayout->setRowStretch(3, 1);
spwTabWidget->addTab(spwTabWidgetPage0, tr("Connection"));
spwTabWidget->addTab(spwTabWidgetPage1, tr("TM Statistics"));
spwTabWidget->addTab(spwTabWidgetPage3, tr("HK"));
spwTabWidget->addTab(parameterDump, tr("DUMP"));
spwTabWidget->addTab(recordPage, tr("REC"));
spwTabWidget->addTab(spwTabWidgetPage2, tr("WFRM NORM"));
spwTabWidget->addTab( wfPage_CWF_F1, tr("CWF_F1"));
spwTabWidget->addTab( wfPage_CWF_F2, tr("CWF_F2"));
spwTabWidget->addTab( wfPage_CWF_F3, tr("CWF_F3"));
spwTabWidget->addTab( asmPage_F0, tr("ASM_F0"));
spwTabWidgetPage0->setLayout(mainLayout);
spwTabWidgetPage1->setLayout(tmStatistics->layout());
spwTabWidgetPage2->setLayout(wfDisplay->layout());
spwTabWidgetPage3->setLayout(hkDisplay->layout());
layout_overallLayout->addWidget(spwTabWidget);
this->setLayout(layout_overallLayout);
connect(this->button_clearConsole, SIGNAL(clicked()), this, SLOT(clearConsole()));
// SWF_F0
connect(this->recordPage, SIGNAL(signal_store_swf_f0()),
this->wfDisplay->page_f0, SLOT(storeWfrm()));
connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
this->wfDisplay->page_f0, SLOT(setDefaultStorageDirectory(QString)));
// SWF_F1
connect(this->recordPage, SIGNAL(signal_store_swf_f1()),
this->wfDisplay->page_f1, SLOT(storeWfrm()));
connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
this->wfDisplay->page_f1, SLOT(setDefaultStorageDirectory(QString)));
// SWF_F2
connect(this->recordPage, SIGNAL(signal_store_swf_f2()),
this->wfDisplay->page_f2, SLOT(storeWfrm()));
connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
this->wfDisplay->page_f2, SLOT(setDefaultStorageDirectory(QString)));
// CWF_F1
connect(this->recordPage, SIGNAL(signal_store_cwf_f1()),
this->wfPage_CWF_F1, SLOT(storeWfrm()));
connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
this->wfPage_CWF_F1, SLOT(setDefaultStorageDirectory(QString)));
// CWF_F2
connect(this->recordPage, SIGNAL(signal_store_cwf_f2()),
this->wfPage_CWF_F2, SLOT(storeWfrm()));
connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
this->wfPage_CWF_F2, SLOT(setDefaultStorageDirectory(QString)));
// CWF_F3
connect(this->recordPage, SIGNAL(signal_store_cwf_f3()),
this->wfPage_CWF_F3, SLOT(storeWfrm()));
connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
this->wfPage_CWF_F3, SLOT(setDefaultStorageDirectory(QString)));
// ASM_F0
connect(this->recordPage, SIGNAL(signal_store_asm_f0()),
this->asmPage_F0, SLOT(storeWfrm()));
connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
this->asmPage_F0, SLOT(setDefaultStorageDirectory(QString)));
emit this->recordPage->signal_defaultStorageDirectoryUpdated(this->recordPage->defaultStorageDirectory);
}
QString MainWindowUI::getTMEchoServerAddress()
{
return(serverTMEchoDialogBox->getIP());
}
void MainWindowUI::setTCTMServerAddressIP(QString address)
{
label_currentTCTMServerIP->setText(address);
}
int MainWindowUI::getTMPort()
{
return spinbox_TMServerPort->value();
}
int MainWindowUI::getTCPort()
{
return spinbox_TCServerPort->value();
}
void MainWindowUI::displayOnConsole(QString message)
{
console->append(message);
}
void MainWindowUI::clearConsole()
{
console->clear();
}
void MainWindowUI::totalOfBytesHasChanged(unsigned int nbBytes)
{
label_totalOfBytes->setText(
"Received Bytes: "
+ QString::number(nbBytes));
}
void MainWindowUI::totalOfPacketsHasChanged(unsigned int nbPackets)
{
label_totalOfPackets->setText(
"Received Packets: "
+ QString::number(nbPackets));
}