File: echograph.cpp

package info (click to toggle)
wsjtx-improved 3.0.0%2B250924%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 86,260 kB
  • sloc: cpp: 105,882; f90: 60,117; python: 27,241; ansic: 13,372; fortran: 2,382; makefile: 197; sh: 135
file content (126 lines) | stat: -rwxr-xr-x 3,532 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include "echograph.h"
#include "commons.h"
#include <QSettings>
#include <QApplication>
#include <QDebug>
#include "echoplot.h"
#include "ui_echograph.h"
#include "moc_echograph.cpp"

#define NSMAX2 1366

EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) :
  QDialog {parent, Qt::Window | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint},
  m_settings (settings),
  ui(new Ui::EchoGraph)
{
  ui->setupUi(this);
  setWindowTitle (QApplication::applicationName () + " - " + tr ("Echo Graph"));
  installEventFilter(parent);                   //Installing the filter
  ui->echoPlot->setCursor(Qt::CrossCursor);
  setMaximumWidth(2048);
  setMaximumHeight(880);
  ui->echoPlot->setMaximumHeight(800);

//Restore user's settings
  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());
  ui->zeroSlider->setValue(ui->echoPlot->getPlotZero());
  ui->gainSlider->setValue(ui->echoPlot->getPlotGain());
  int n=m_settings->value("Smooth",0).toInt();
  ui->echoPlot->m_smooth=n;
  ui->smoothSpinBox->setValue(n);
  n=m_settings->value("EchoBPP",1).toInt();
  ui->echoPlot->m_binsPerPixel=n;
  ui->binsPerPixelSpinBox->setValue(n);
  ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool();
  m_nColor=m_settings->value("EchoColors",0).toInt();
  ui->cbBaseline->setChecked(m_settings->value("Baseline",false).toBool());
  m_settings->endGroup();
  ui->echoPlot->setColors(m_nColor);
}

EchoGraph::~EchoGraph()
{
  saveSettings();
}

void EchoGraph::closeEvent (QCloseEvent * e)
{
  saveSettings ();
  QDialog::closeEvent (e);
}

void EchoGraph::saveSettings()
{
//Save user's settings
  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);
  m_settings->setValue("EchoBPP",ui->echoPlot->m_binsPerPixel);
  m_settings->setValue("BlueCurve",ui->echoPlot->m_blue);
  m_settings->setValue("EchoColors",m_nColor);
  m_settings->setValue("Baseline",ui->cbBaseline->isChecked());
  m_settings->endGroup();
}

void EchoGraph::plotSpec()
{
  ui->echoPlot->draw();
  ui->nsum_label->setText("N: " + QString::number(echocom_.nsum));
}

void EchoGraph::on_smoothSpinBox_valueChanged(int n)
{
  ui->echoPlot->setSmooth(n);
  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();
}

void EchoGraph::on_binsPerPixelSpinBox_valueChanged(int n)
{
  ui->echoPlot->m_binsPerPixel=n;
  ui->echoPlot->DrawOverlay();
  ui->echoPlot->draw();
}

void EchoGraph::on_pbColors_clicked()
{
  m_nColor = (m_nColor+1) % 6;
  ui->echoPlot->setColors(m_nColor);
}

void EchoGraph::on_cbBaseline_toggled(bool b)
{
  ui->echoPlot->setBaseline(b);
}

bool EchoGraph::baseline()
{
  return ui->cbBaseline->isChecked();
}

void EchoGraph::clearAvg()
{
  for(int i=0; i<4096; i++) {
    echocom_.blue[i]=0;
    echocom_.red[i]=0;
  }
  echocom_.nsum=0;
  plotSpec();
}