Labrador/Desktop_Interface/daqloadprompt.cpp

47 lines
1.6 KiB
C++
Raw Normal View History

2017-12-27 23:17:32 +00:00
#include "daqloadprompt.h"
#include "ui_daqloadprompt.h"
#include <QDebug>
2017-12-28 02:23:33 +00:00
#include "siprint.h"
2017-12-27 23:17:32 +00:00
daqLoadPrompt::daqLoadPrompt(QWidget *parent, double minTime, double maxTime) :
QDialog(parent),
ui(new Ui::daqLoadPrompt)
{
ui->setupUi(this);
min_interval = minTime;
ui->startTimeDoubleSpinBox->setMinimum(minTime);
ui->endTimeDoubleSpinBox->setMinimum(minTime);
ui->startTimeDoubleSpinBox->setMaximum(maxTime);
ui->endTimeDoubleSpinBox->setMaximum(maxTime);
2017-12-28 02:23:33 +00:00
ui->startTimeDoubleSpinBox->setValue(minTime);
ui->endTimeDoubleSpinBox->setValue(maxTime);
2017-12-27 23:17:32 +00:00
//Internal signals
connect(ui->startTimeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(valueChange()));
connect(ui->endTimeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(valueChange()));
2017-12-28 02:23:33 +00:00
valueChange();
2017-12-27 23:17:32 +00:00
}
daqLoadPrompt::~daqLoadPrompt()
{
delete ui;
}
void daqLoadPrompt::valueChange(){
ui->startTimeDoubleSpinBox->setMaximum(ui->endTimeDoubleSpinBox->value() - min_interval);
ui->endTimeDoubleSpinBox->setMinimum(ui->startTimeDoubleSpinBox->value() + min_interval);
startTime(ui->startTimeDoubleSpinBox->value());
endTime(ui->endTimeDoubleSpinBox->value());
2017-12-28 02:23:33 +00:00
2017-12-30 01:44:08 +00:00
char units[2] = "B";
2017-12-28 02:23:33 +00:00
double contig_ram_required = ((ui->endTimeDoubleSpinBox->value() - ui->startTimeDoubleSpinBox->value()) / min_interval) * 4 + 512; //4 bytes per sample (float), each sample is stored only once. 512 is just a bullshit value to represent the overhead required to store the other variables in the buffer object
2017-12-30 01:44:08 +00:00
siprint cotig_print(&units[0],contig_ram_required);
2017-12-28 02:23:33 +00:00
ui->contigRamLabel_Value->setText(cotig_print.printVal());
2017-12-27 23:17:32 +00:00
}