##// END OF EJS Templates
Minor updates to the rmapplugin...
Minor updates to the rmapplugin ASM display abilities added to the lfrsgse

File last commit:

r45:bff3fdf42776 default
r45:bff3fdf42776 default
Show More
wfpage.cpp
597 lines | 16.4 KiB | text/x-c | CppLexer
First version of the gse-lesia module...
r23 #include "wfpage.h"
Minor updates to the rmapplugin...
r45 #include <stdio.h>
First version of the gse-lesia module...
r23
WFPage::WFPage(QWidget *parent) :
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 QMainWindow(parent)
First version of the gse-lesia module...
r23 {
Minor updates to the rmapplugin...
r45 unsigned int i = 0;
for (i = 0; i<6; i++)
{
localIndex[i] = 0;
}
pageTitle = "default";
wfPlot_v = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
wfPlot_e1 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
wfPlot_e2 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
wfPlot_b1 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
wfPlot_b2 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
wfPlot_b3 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
First version of the gse-lesia module...
r23 //
Minor upgrade on rmapplugin...
r27 wfPlot_v->customPlot->setTitle("v");
wfPlot_e1->customPlot->setTitle("e1");
First version of the gse-lesia module...
r23 wfPlot_e2->customPlot->setTitle("e2");
wfPlot_b1->customPlot->setTitle("b1");
wfPlot_b2->customPlot->setTitle("b2");
wfPlot_b3->customPlot->setTitle("b3");
//
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 /*mainLayout = new QGridLayout;
First version of the gse-lesia module...
r23 mainLayout->addWidget(wfPlot_v, 0, 0, 1, 1);
mainLayout->addWidget(wfPlot_e1, 0, 1, 1, 1);
mainLayout->addWidget(wfPlot_e2, 0, 2, 1, 1);
mainLayout->addWidget(wfPlot_b1, 1, 0, 1, 1);
mainLayout->addWidget(wfPlot_b2, 1, 1, 1, 1);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 mainLayout->addWidget(wfPlot_b3, 1, 2, 1, 1);*/
First version of the gse-lesia module...
r23 //
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 dockV = NULL;
dockE1 = NULL;
dockE2 = NULL;
dockB1 = NULL;
dockB2 = NULL;
dockB3 = NULL;
title of the dockwidgets removed
r40 titleWidgetV = new QWidget();
titleWidgetE1 = new QWidget();
titleWidgetE2 = new QWidget();
titleWidgetB1 = new QWidget();
titleWidgetB2 = new QWidget();
titleWidgetB3 = new QWidget();
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 logFileName = new QLabel();
Minor bugs corrected in wfdisplay
r43 logFile = new QFile();
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 logFileV = new QFile();
logFileE1 = new QFile();
logFileE2 = new QFile();
logFileB1 = new QFile();
logFileB2 = new QFile();
logFileB3 = new QFile();
Minor updates to the rmapplugin...
r45
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 logFileEn = false;
Minor updates to the rmapplugin...
r45 storageEnabledV = false;
storageEnabledE1 = false;
storageEnabledE2 = false;
storageEnabledB1 = false;
storageEnabledB2 = false;
storageEnabledB3 = false;
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 createToolBar();
Minor updates to the rmapplugin...
r45 readSettings();
First version of the gse-lesia module...
r23 }
void WFPage::displayOnPlot(short *data, unsigned char num)
{
Minor updates to the rmapplugin...
r45 QByteArray dataByteArray;
unsigned int i;
First version of the gse-lesia module...
r23 switch(num){
case 0:
wfPlot_v->displayOnPlot(data, DEFAULT_SIZE);
Minor updates to the rmapplugin...
r45 if ( (storageEnabledV == true) && (logFileV->isOpen()) )
{
for (i=0; i<DEFAULT_SIZE; i++)
{
dataByteArray.clear();
dataByteArray.append(QByteArray::number(localIndex[0]));
dataByteArray.append(' ');
dataByteArray.append(QByteArray::number(data[i]));
*(this->logFileStrmV) << dataByteArray << endl;
localIndex[0]++;
}
}
First version of the gse-lesia module...
r23 break;
case 1:
wfPlot_e1->displayOnPlot(data, DEFAULT_SIZE);
break;
case 2:
wfPlot_e2->displayOnPlot(data, DEFAULT_SIZE);
break;
case 3:
wfPlot_b1->displayOnPlot(data, DEFAULT_SIZE);
break;
case 4:
wfPlot_b2->displayOnPlot(data, DEFAULT_SIZE);
break;
case 5:
wfPlot_b3->displayOnPlot(data, DEFAULT_SIZE);
break;
}
}
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34
void WFPage::createToolBar()
{
radio_v = new QRadioButton(tr("v"));
radio_e1 = new QRadioButton(tr("e1"));
radio_e2 = new QRadioButton(tr("e2"));
radio_b1 = new QRadioButton(tr("b1"));
radio_b2 = new QRadioButton(tr("b2"));
radio_b3 = new QRadioButton(tr("b3"));
radio_tabify = new QRadioButton(tr("tabify"));
radio_v->setAutoExclusive(false);
radio_e1->setAutoExclusive(false);
radio_e2->setAutoExclusive(false);
radio_b1->setAutoExclusive(false);
radio_b2->setAutoExclusive(false);
radio_b3->setAutoExclusive(false);
radio_tabify->setAutoExclusive(false);
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 button_selectAll = new QPushButton(tr("select all"));
button_storeWfrm = new QPushButton(tr("REC"));
Minor updates to the rmapplugin...
r45 button_chooseDir = new QPushButton(tr("choose dir"));
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 myToolBar = new QToolBar("select");
myToolBar->addWidget(radio_v);
myToolBar->addWidget(radio_e1);
myToolBar->addWidget(radio_e2);
myToolBar->addWidget(radio_b1);
myToolBar->addWidget(radio_b2);
myToolBar->addWidget(radio_b3);
myToolBar->addSeparator();
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 myToolBar->addWidget(button_selectAll);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 myToolBar->addWidget(radio_tabify);
Minor updates to the rmapplugin...
r45 myToolBar->addSeparator();
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 myToolBar->addWidget(button_storeWfrm);
Minor updates to the rmapplugin...
r45 myToolBar->addWidget(button_chooseDir);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34
addToolBar(Qt::LeftToolBarArea, myToolBar);
radio_tabify->setChecked(true);
connect(this->radio_v, SIGNAL(clicked(bool)), this, SLOT(actionRadioV(bool)));
connect(this->radio_e1, SIGNAL(clicked(bool)), this, SLOT(actionRadioE1(bool)));
connect(this->radio_e2, SIGNAL(clicked(bool)), this, SLOT(actionRadioE2(bool)));
connect(this->radio_b1, SIGNAL(clicked(bool)), this, SLOT(actionRadioB1(bool)));
connect(this->radio_b2, SIGNAL(clicked(bool)), this, SLOT(actionRadioB2(bool)));
connect(this->radio_b3, SIGNAL(clicked(bool)), this, SLOT(actionRadioB3(bool)));
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 connect(this->button_selectAll, SIGNAL(clicked()), this, SLOT(selectAll()));
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 connect(this->radio_tabify, SIGNAL(clicked(bool)), this, SLOT(organizeDocks()));
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 connect(this->button_storeWfrm, SIGNAL(clicked()), this, SLOT(storeWfrm()));
Minor updates to the rmapplugin...
r45 connect(this->button_chooseDir, SIGNAL(clicked()), this, SLOT(chooseDir()));
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 }
void WFPage::actionRadioV(bool state)
{
if (state == true)
{
if (dockV == NULL)
{
dockV = new QDockWidget("V", this);
dockV->setWidget(wfPlot_v);
title of the dockwidgets removed
r40 dockV->setTitleBarWidget(titleWidgetV);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 }
}
else
{
this->removeDockWidget(dockV);
}
organizeDocks();
}
void WFPage::actionRadioE1(bool state)
{
if (state == true)
{
if (dockE1 == NULL)
{
dockE1 = new QDockWidget("E1", this);
dockE1->setWidget(wfPlot_e1);
title of the dockwidgets removed
r40 dockE1->setTitleBarWidget(titleWidgetE1);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 }
}
else
{
this->removeDockWidget(dockE1);
}
organizeDocks();
}
void WFPage::actionRadioE2(bool state)
{
if (state == true)
{
if (dockE2 == NULL)
{
dockE2 = new QDockWidget("E2", this);
dockE2->setWidget(wfPlot_e2);
title of the dockwidgets removed
r40 dockE2->setTitleBarWidget(titleWidgetE2);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 }
}
else
{
this->removeDockWidget(dockE2);
}
organizeDocks();
}
void WFPage::actionRadioB1(bool state)
{
if (state == true)
{
if (dockB1 == NULL)
{
dockB1 = new QDockWidget("B1", this);
dockB1->setWidget(wfPlot_b1);
title of the dockwidgets removed
r40 dockB1->setTitleBarWidget(titleWidgetB1);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 }
}
else
{
this->removeDockWidget(dockB1);
}
organizeDocks();
}
void WFPage::actionRadioB2(bool state)
{
if (state == true)
{
if (dockB2 == NULL)
{
dockB2 = new QDockWidget("B2", this);
dockB2->setWidget(wfPlot_b2);
title of the dockwidgets removed
r40 dockB2->setTitleBarWidget(titleWidgetB2);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 }
}
else
{
this->removeDockWidget(dockB2);
}
organizeDocks();
}
void WFPage::actionRadioB3(bool state)
{
if (state == true)
{
if (dockB3 == NULL)
{
dockB3 = new QDockWidget("B3", this);
dockB3->setWidget(wfPlot_b3);
title of the dockwidgets removed
r40 dockB3->setTitleBarWidget(titleWidgetB3);
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 }
}
else
{
this->removeDockWidget(dockB3);
}
organizeDocks();
}
void WFPage::buildDockList()
{
dockList.clear();
if (radio_v->isChecked())
{
dockList.append(dockV);
removeDockWidget(dockV);
}
if (radio_e1->isChecked())
{
dockList.append(dockE1);
removeDockWidget(dockE1);
}
if (radio_e2->isChecked())
{
dockList.append(dockE2);
removeDockWidget(dockE2);
}
if (radio_b1->isChecked())
{
dockList.append(dockB1);
removeDockWidget(dockB1);
}
if (radio_b2->isChecked())
{
dockList.append(dockB2);
removeDockWidget(dockB2);
}
if (radio_b3->isChecked())
{
dockList.append(dockB3);
removeDockWidget(dockB3);
}
}
void WFPage::organizeDocks()
{
if (radio_tabify->isChecked())
{
tabify();
}
else
{
unTabify();
}
lfrsgse is a QMainWindow...
r39 wfPlot_v->resize(wfPlot_v->minimumSizeHint());
wfPlot_e1->resize(wfPlot_e1->minimumSizeHint());
wfPlot_e2->resize(wfPlot_e2->minimumSizeHint());
wfPlot_b1->resize(wfPlot_b1->minimumSizeHint());
wfPlot_b2->resize(wfPlot_b2->minimumSizeHint());
wfPlot_b3->resize(wfPlot_b3->minimumSizeHint());
this->resize(this->minimumSizeHint());
admin@pc-p-leroy3.LAB-LPP.LOCAL
QDockWidgets used for the waveform displays...
r34 }
void WFPage::unTabify()
{
buildDockList();
switch(dockList.size())
{
case 0:
break;
case 1:
addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
dockList.at(0)->show();
break;
case 2:
addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
dockList.at(0)->show();
dockList.at(1)->show();
break;
case 3:
addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(2));
dockList.at(0)->show();
dockList.at(1)->show();
dockList.at(2)->show();
break;
case 4:
addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(2));
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
dockList.at(0)->show();
dockList.at(1)->show();
dockList.at(2)->show();
dockList.at(3)->show();
break;
case 5:
addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
addDockWidget(Qt::TopDockWidgetArea, dockList.at(2));
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(4));
dockList.at(0)->show();
dockList.at(1)->show();
dockList.at(2)->show();
dockList.at(3)->show();
dockList.at(4)->show();
break;
case 6:
addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
addDockWidget(Qt::TopDockWidgetArea, dockList.at(2));
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(4));
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(5));
dockList.at(0)->show();
dockList.at(1)->show();
dockList.at(2)->show();
dockList.at(3)->show();
dockList.at(4)->show();
dockList.at(5)->show();
break;
default:
break;
}
}
void WFPage::tabify()
{
buildDockList();
switch(dockList.size())
{
case 0:
break;
case 1:
addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
dockList.at(0)->show();
break;
case 2:
addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
tabifyDockWidget(dockList.at(0), dockList.at(1));
dockList.at(0)->show();
dockList.at(1)->show();
break;
case 3:
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
tabifyDockWidget(dockList.at(0), dockList.at(1));
tabifyDockWidget(dockList.at(1), dockList.at(2));
dockList.at(0)->show();
dockList.at(1)->show();
dockList.at(2)->show();
break;
case 4:
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
tabifyDockWidget(dockList.at(0), dockList.at(1));
tabifyDockWidget(dockList.at(1), dockList.at(2));
tabifyDockWidget(dockList.at(2), dockList.at(3));
dockList.at(0)->show();
dockList.at(1)->show();
dockList.at(2)->show();
dockList.at(3)->show();
break;
case 5:
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
tabifyDockWidget(dockList.at(0), dockList.at(1));
tabifyDockWidget(dockList.at(1), dockList.at(2));
tabifyDockWidget(dockList.at(2), dockList.at(3));
tabifyDockWidget(dockList.at(3), dockList.at(4));
dockList.at(0)->show();
dockList.at(1)->show();
dockList.at(2)->show();
dockList.at(3)->show();
dockList.at(4)->show();
break;
case 6:
addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
tabifyDockWidget(dockList.at(0), dockList.at(1));
tabifyDockWidget(dockList.at(1), dockList.at(2));
tabifyDockWidget(dockList.at(2), dockList.at(3));
tabifyDockWidget(dockList.at(3), dockList.at(4));
tabifyDockWidget(dockList.at(4), dockList.at(5));
dockList.at(0)->show();
dockList.at(1)->show();
dockList.at(2)->show();
dockList.at(3)->show();
dockList.at(4)->show();
dockList.at(5)->show();
break;
default:
break;
}
}
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 void WFPage::selectAll()
{
radio_v->click();
radio_e1->click();
radio_e2->click();
radio_b1->click();
radio_b2->click();
radio_b3->click();
}
void WFPage::storeWfrm()
{
if (logFileEn == false)
{
Minor updates to the rmapplugin...
r45 buildFileNames();
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 button_storeWfrm->setText(tr("STOP"));
logFileEn = true;
}
else
{
Minor updates to the rmapplugin...
r45 if(this->logFileV->isOpen()) this->logFileV->close();
if(this->logFileE1->isOpen()) this->logFileE1->close();
if(this->logFileE2->isOpen()) this->logFileE2->close();
// disable all storage
storageEnabledV = false;
storageEnabledE1 = false;
storageEnabledE2 = false;
storageEnabledB1 = false;
storageEnabledB2 = false;
storageEnabledB3 = false;
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 button_storeWfrm->setText(tr("REC"));
logFileEn = false;
}
}
void WFPage::buildFileNames()
{
QString date;
QString time;
Minor updates to the rmapplugin...
r45 QString prefix;
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42
date = QDate::currentDate().toString();
time = QTime::currentTime().toString();
Minor updates to the rmapplugin...
r45 prefix = defaultStorageDirectory + "/" + date + "_" + time + "_" + pageTitle ;
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42
if (radio_v->isChecked())
{
Minor updates to the rmapplugin...
r45 if(this->logFileV->isOpen()) this->logFileV->close();
this->logFileV->setFileName( prefix + "_V.data");
if(this->logFileV->open(QIODevice::WriteOnly)) this->logFileStrmV = new QTextStream(this->logFileV);
storageEnabledV = true;
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 }
if (radio_e1->isChecked())
{
Minor updates to the rmapplugin...
r45 if(this->logFileE1->isOpen()) this->logFileE1->close();
this->logFileE1->setFileName( prefix + "_E1.data");
if(this->logFileE1->open(QIODevice::WriteOnly)) this->logFileStrmE1 = new QTextStream(this->logFileE1);
storageEnabledE1 = true;
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 }
if (radio_e2->isChecked())
{
Minor updates to the rmapplugin...
r45 if(this->logFileE2->isOpen()) this->logFileE2->close();
this->logFileE2->setFileName( prefix + "_E2.data");
if(this->logFileE2->open(QIODevice::WriteOnly)) this->logFileStrmE2 = new QTextStream(this->logFileE2);
storageEnabledE2 = true;
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 }
if (radio_b1->isChecked())
{
}
if (radio_b2->isChecked())
{
}
if (radio_b3->isChecked())
{
}
}
void WFPage::logFileEnDisable(bool state)
{
if(state==true)
{
this->logFileEn = true;
}
else if(state==false)
{
this->logFileEn = false;
}
}
bool WFPage::islogfileenable()
{
return this->logFileEn;
}
void WFPage::appendToLogFile(const QString & text)
{
if(this->logFileEn && this->logFile->isOpen())
{
*(this->logFileStrm) << text << endl;
}
}
void WFPage::closeEvent(QCloseEvent *event)
{
if(this->logFile->isOpen())
{
this->logFileStrm->flush();
this->logFile->waitForBytesWritten(3000);
this->logFile->close();
}
Minor updates to the rmapplugin...
r45 writeSettings();
admin@pc-p-leroy3.LAB-LPP.LOCAL
Development of the waveform storage ability of the lfrgse
r42 event->accept();
}
Minor updates to the rmapplugin...
r45
void WFPage::readSettings()
{
QSettings settings("lpp", "lfrsgse");
defaultStorageDirectory = settings.value("defaultStorageDirectory", QDir::homePath()).toString();
}
void WFPage::writeSettings()
{
QSettings settings("lpp", "lfrsgse");
settings.setValue("defaultStorageDirectory", defaultStorageDirectory);
}
void WFPage::chooseDir()
{
defaultStorageDirectory = QFileDialog::getExistingDirectory(this,
"choose the directory",
QDir::homePath(),
QFileDialog::ShowDirsOnly);
}