2015-06-09 10:30:23 -04:00
|
|
|
#include "echograph.h"
|
2015-06-08 15:42:20 -04:00
|
|
|
#include "commons.h"
|
2015-06-04 14:17:13 -04:00
|
|
|
#include <QSettings>
|
2015-06-04 12:42:38 -04:00
|
|
|
#include "echoplot.h"
|
|
|
|
#include "ui_echograph.h"
|
2015-06-09 10:30:23 -04:00
|
|
|
#include "moc_echograph.cpp"
|
2015-06-04 12:42:38 -04:00
|
|
|
|
|
|
|
#define NSMAX2 1366
|
|
|
|
|
2015-06-04 14:17:13 -04:00
|
|
|
EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) :
|
2015-06-04 12:42:38 -04:00
|
|
|
QDialog(parent),
|
2015-06-04 14:27:36 -04:00
|
|
|
m_settings (settings),
|
|
|
|
ui(new Ui::EchoGraph)
|
2015-06-04 12:42:38 -04:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
this->setWindowFlags(Qt::Dialog);
|
|
|
|
this->installEventFilter(parent); //Installing the filter
|
|
|
|
ui->echoPlot->setCursor(Qt::CrossCursor);
|
|
|
|
this->setMaximumWidth(2048);
|
|
|
|
this->setMaximumHeight(880);
|
|
|
|
ui->echoPlot->setMaximumHeight(800);
|
|
|
|
|
|
|
|
//Restore user's settings
|
2015-06-04 14:17:13 -04:00
|
|
|
m_settings->beginGroup("EchoGraph");
|
|
|
|
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
|
|
|
|
ui->echoPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
|
|
|
|
ui->echoPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
|
2015-06-04 12:42:38 -04:00
|
|
|
ui->zeroSlider->setValue(ui->echoPlot->getPlotZero());
|
|
|
|
ui->gainSlider->setValue(ui->echoPlot->getPlotGain());
|
2015-06-09 11:41:27 -04:00
|
|
|
int n=m_settings->value("Smooth",0).toInt();
|
|
|
|
ui->echoPlot->m_smooth=n;
|
|
|
|
ui->smoothSpinBox->setValue(n);
|
2015-06-10 08:58:59 -04:00
|
|
|
n=m_settings->value("EchoBPP",1).toInt();
|
2015-06-09 11:41:27 -04:00
|
|
|
ui->echoPlot->m_binsPerPixel=n;
|
|
|
|
ui->binsPerPixelSpinBox->setValue(n);
|
2015-06-04 14:17:13 -04:00
|
|
|
ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool();
|
2015-06-04 12:42:38 -04:00
|
|
|
ui->cbBlue->setChecked(ui->echoPlot->m_blue);
|
2015-06-04 14:17:13 -04:00
|
|
|
m_settings->endGroup();
|
2015-06-09 15:04:21 -04:00
|
|
|
|
|
|
|
ui->cbBlue->setVisible(false); //Not using "blue" (for now, at least)
|
2015-06-04 12:42:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
EchoGraph::~EchoGraph()
|
|
|
|
{
|
|
|
|
saveSettings();
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2015-06-04 13:16:55 -04:00
|
|
|
void EchoGraph::closeEvent (QCloseEvent * e)
|
|
|
|
{
|
|
|
|
saveSettings ();
|
|
|
|
QDialog::closeEvent (e);
|
|
|
|
}
|
|
|
|
|
2015-06-04 12:42:38 -04:00
|
|
|
void EchoGraph::saveSettings()
|
|
|
|
{
|
|
|
|
//Save user's settings
|
2015-06-04 14:17:13 -04:00
|
|
|
m_settings->beginGroup("EchoGraph");
|
|
|
|
m_settings->setValue ("geometry", saveGeometry ());
|
|
|
|
m_settings->setValue("PlotZero",ui->echoPlot->m_plotZero);
|
|
|
|
m_settings->setValue("PlotGain",ui->echoPlot->m_plotGain);
|
|
|
|
m_settings->setValue("Smooth",ui->echoPlot->m_smooth);
|
2015-06-08 15:42:20 -04:00
|
|
|
m_settings->setValue("EchoBPP",ui->echoPlot->m_binsPerPixel);
|
2015-06-04 14:17:13 -04:00
|
|
|
m_settings->setValue("BlueCurve",ui->echoPlot->m_blue);
|
|
|
|
m_settings->endGroup();
|
2015-06-04 12:42:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void EchoGraph::plotSpec()
|
|
|
|
{
|
|
|
|
ui->echoPlot->draw();
|
2015-06-09 15:04:21 -04:00
|
|
|
ui->nsum_label->setText("N: " + QString::number(echocom_.nsum));
|
2015-06-04 12:42:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void EchoGraph::on_smoothSpinBox_valueChanged(int n)
|
|
|
|
{
|
|
|
|
ui->echoPlot->setSmooth(n);
|
|
|
|
ui->echoPlot->draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EchoGraph::on_cbBlue_toggled(bool checked)
|
|
|
|
{
|
|
|
|
ui->echoPlot->m_blue=checked;
|
|
|
|
ui->echoPlot->draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EchoGraph::on_gainSlider_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->echoPlot->setPlotGain(value);
|
|
|
|
ui->echoPlot->draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EchoGraph::on_zeroSlider_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->echoPlot->setPlotZero(value);
|
|
|
|
ui->echoPlot->draw();
|
|
|
|
}
|
2015-06-08 15:42:20 -04:00
|
|
|
|
|
|
|
void EchoGraph::on_binsPerPixelSpinBox_valueChanged(int n)
|
|
|
|
{
|
|
|
|
ui->echoPlot->m_binsPerPixel=n;
|
|
|
|
ui->echoPlot->DrawOverlay();
|
|
|
|
ui->echoPlot->draw();
|
|
|
|
}
|