##// END OF EJS Templates
spacecraft potential storage added to lfrsgse...
spacecraft potential storage added to lfrsgse entermode slightly modified

File last commit:

r76:c2ac69e28c43 default
r76:c2ac69e28c43 default
Show More
recordpage.cpp
183 lines | 7.1 KiB | text/x-c | CppLexer
#include "recordpage.h"
RecordPage::RecordPage(QWidget *parent) :
QWidget(parent)
{
logFileEn = false;
radiobutton_swf_f0 = new QRadioButton("swf_f0");
radiobutton_swf_f1 = new QRadioButton("swf_f1");
radiobutton_swf_f2 = new QRadioButton("swf_f2");
radiobutton_cwf_f1 = new QRadioButton("cwf_f1");
radiobutton_cwf_f2 = new QRadioButton("cwf_f2");
radiobutton_cwf_f3 = new QRadioButton("cwf_f3");
radiobutton_asm_f0 = new QRadioButton("asm_f0");
radiobutton_asm_f1 = new QRadioButton("asm_f1");
radiobutton_asm_f2 = new QRadioButton("asm_f2");
radiobutton_hk_spacecraft_potential = new QRadioButton("s/c potential");
radiobutton_swf_f0->setAutoExclusive(false);
radiobutton_swf_f1->setAutoExclusive(false);
radiobutton_swf_f2->setAutoExclusive(false);
radiobutton_cwf_f1->setAutoExclusive(false);
radiobutton_cwf_f2->setAutoExclusive(false);
radiobutton_cwf_f3->setAutoExclusive(false);
radiobutton_asm_f0->setAutoExclusive(false);
radiobutton_asm_f1->setAutoExclusive(false);
radiobutton_asm_f2->setAutoExclusive(false);
radiobutton_hk_spacecraft_potential->setAutoExclusive(false);
label_currentDir = new QLabel("Current Dir: -");
button_chooseDir = new QPushButton("choose dir");
button_storeWfrm = new QPushButton(tr("REC"));
groupbox_waveforms = new QGroupBox("waveforms");
groupbox_matrices = new QGroupBox("spectral matrices");
groupbox_hk = new QGroupBox("HK");
groupbox_directory = new QGroupBox("directory");
vboxlayout_waveforms = new QVBoxLayout();
vboxlayout_matrices = new QVBoxLayout();
vboxlayout_hk = new QVBoxLayout();
vboxlayout_directory = new QVBoxLayout();
mainLayout = new QGridLayout();
this->readSettings();
vboxlayout_waveforms->addWidget(radiobutton_swf_f0);
vboxlayout_waveforms->addWidget(radiobutton_swf_f1);
vboxlayout_waveforms->addWidget(radiobutton_swf_f2);
vboxlayout_waveforms->addWidget(radiobutton_cwf_f1);
vboxlayout_waveforms->addWidget(radiobutton_cwf_f2);
vboxlayout_waveforms->addWidget(radiobutton_cwf_f3);
vboxlayout_waveforms->addStretch();
vboxlayout_matrices->addWidget(radiobutton_asm_f0);
vboxlayout_matrices->addWidget(radiobutton_asm_f1);
vboxlayout_matrices->addWidget(radiobutton_asm_f2);
vboxlayout_matrices->addStretch();
vboxlayout_hk->addWidget(radiobutton_hk_spacecraft_potential);
vboxlayout_hk->addStretch();
vboxlayout_directory->addWidget(button_storeWfrm);
vboxlayout_directory->addWidget(button_chooseDir);
vboxlayout_directory->addWidget(label_currentDir);
vboxlayout_directory->addStretch();
groupbox_waveforms->setLayout(vboxlayout_waveforms);
groupbox_matrices->setLayout(vboxlayout_matrices);
groupbox_hk->setLayout(vboxlayout_hk);
groupbox_directory->setLayout(vboxlayout_directory);
mainLayout->addWidget(groupbox_directory, 0, 0, 1, 1);
mainLayout->addWidget(groupbox_waveforms, 0, 1, 1, 1);
mainLayout->addWidget(groupbox_matrices, 0, 2, 1, 1);
mainLayout->addWidget(groupbox_hk, 0, 3, 1, 1);
mainLayout->setRowStretch(1, 1);
mainLayout->setColumnStretch(4, 1);
this->setLayout(mainLayout);
connect(this->button_chooseDir, SIGNAL(clicked()), this, SLOT(chooseDir()));
connect(this->button_storeWfrm, SIGNAL(clicked()), this, SLOT(storeWfrm()));
}
RecordPage::~RecordPage()
{
this->writeSettings();
}
void RecordPage::chooseDir()
{
QString tmpDefaultStorageDirectory;
tmpDefaultStorageDirectory = QFileDialog::getExistingDirectory(this,
"choose the directory",
QDir::homePath(),
QFileDialog::ShowDirsOnly);
if( !tmpDefaultStorageDirectory.isEmpty() )
{
defaultStorageDirectory = tmpDefaultStorageDirectory;
}
label_currentDir->setText(defaultStorageDirectory);
emit signal_defaultStorageDirectoryUpdated( defaultStorageDirectory );
}
void RecordPage::storeWfrm()
{
if (logFileEn == false)
{
// enable storage
button_storeWfrm->setText(tr("STOP"));
logFileEn = true;
if (radiobutton_swf_f0->isChecked()) emit signal_store_swf_f0();
if (radiobutton_swf_f1->isChecked()) emit signal_store_swf_f1();
if (radiobutton_swf_f2->isChecked()) emit signal_store_swf_f2();
if (radiobutton_cwf_f1->isChecked()) emit signal_store_cwf_f1();
if (radiobutton_cwf_f2->isChecked()) emit signal_store_cwf_f2();
if (radiobutton_cwf_f3->isChecked()) emit signal_store_cwf_f3();
if (radiobutton_asm_f0->isChecked()) emit signal_store_asm_f0();
if (radiobutton_asm_f1->isChecked()) emit signal_store_asm_f0();
if (radiobutton_asm_f2->isChecked()) emit signal_store_asm_f0();
if (radiobutton_hk_spacecraft_potential->isChecked()) emit signal_store_hk_spacecraft_potential();
radiobutton_swf_f0->setEnabled(false);
radiobutton_swf_f1->setEnabled(false);
radiobutton_swf_f2->setEnabled(false);
radiobutton_cwf_f1->setEnabled(false);
radiobutton_cwf_f2->setEnabled(false);
radiobutton_cwf_f3->setEnabled(false);
radiobutton_asm_f0->setEnabled(false);
radiobutton_asm_f1->setEnabled(false);
radiobutton_asm_f2->setEnabled(false);
radiobutton_hk_spacecraft_potential->setEnabled(false);
}
else
{
// disable storage
button_storeWfrm->setText(tr("REC"));
logFileEn = false;
if (radiobutton_swf_f0->isChecked()) emit signal_store_swf_f0();
if (radiobutton_swf_f1->isChecked()) emit signal_store_swf_f1();
if (radiobutton_swf_f2->isChecked()) emit signal_store_swf_f2();
if (radiobutton_cwf_f1->isChecked()) emit signal_store_cwf_f1();
if (radiobutton_cwf_f2->isChecked()) emit signal_store_cwf_f2();
if (radiobutton_cwf_f3->isChecked()) emit signal_store_cwf_f3();
if (radiobutton_asm_f0->isChecked()) emit signal_store_asm_f0();
if (radiobutton_asm_f1->isChecked()) emit signal_store_asm_f1();
if (radiobutton_asm_f2->isChecked()) emit signal_store_asm_f2();
if (radiobutton_hk_spacecraft_potential->isChecked()) emit signal_store_hk_spacecraft_potential();
radiobutton_swf_f0->setEnabled(true);
radiobutton_swf_f1->setEnabled(true);
radiobutton_swf_f2->setEnabled(true);
radiobutton_cwf_f1->setEnabled(true);
radiobutton_cwf_f2->setEnabled(true);
radiobutton_cwf_f3->setEnabled(true);
radiobutton_asm_f0->setEnabled(true);
radiobutton_asm_f1->setEnabled(true);
radiobutton_asm_f2->setEnabled(true);
radiobutton_hk_spacecraft_potential->setEnabled(true);
}
}
void RecordPage::readSettings()
{
QSettings settings("lpp", "lfrsgse");
defaultStorageDirectory = settings.value( "storageDirectory", QDir::homePath() ).toString();
label_currentDir->setText( defaultStorageDirectory );
emit signal_defaultStorageDirectoryUpdated( defaultStorageDirectory );
}
void RecordPage::writeSettings()
{
QSettings settings("lpp", "lfrsgse");
settings.setValue("storageDirectory", defaultStorageDirectory);
}
void RecordPage::closeEvent(QCloseEvent *event)
{
event->accept();
}