mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-17 17:42:02 -05:00
c1d5531603
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7218 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
108 lines
2.8 KiB
C++
108 lines
2.8 KiB
C++
#include "fastgraph.h"
|
|
#include "commons.h"
|
|
#include <QSettings>
|
|
#include <QApplication>
|
|
#include "fastplot.h"
|
|
#include "ui_fastgraph.h"
|
|
#include "moc_fastgraph.cpp"
|
|
|
|
#define NSMAX2 1366
|
|
|
|
FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
|
|
QDialog {parent, Qt::Window | Qt::WindowTitleHint |
|
|
Qt::WindowCloseButtonHint |
|
|
Qt::WindowMinimizeButtonHint},
|
|
m_settings (settings),
|
|
ui(new Ui::FastGraph)
|
|
{
|
|
ui->setupUi(this);
|
|
setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph"));
|
|
installEventFilter(parent); //Installing the filter
|
|
ui->fastPlot->setCursor(Qt::CrossCursor);
|
|
m_ave=40;
|
|
|
|
//Restore user's settings
|
|
m_settings->beginGroup("FastGraph");
|
|
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
|
|
ui->fastPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
|
|
ui->fastPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
|
|
ui->zeroSlider->setValue(ui->fastPlot->m_plotZero);
|
|
ui->gainSlider->setValue(ui->fastPlot->m_plotGain);
|
|
ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt());
|
|
ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero);
|
|
m_settings->endGroup();
|
|
|
|
connect (ui->fastPlot, &FPlotter::fastPick, this, &FastGraph::fastPick);
|
|
}
|
|
|
|
FastGraph::~FastGraph()
|
|
{
|
|
saveSettings();
|
|
}
|
|
|
|
void FastGraph::closeEvent (QCloseEvent * e)
|
|
{
|
|
saveSettings ();
|
|
QDialog::closeEvent (e);
|
|
}
|
|
|
|
void FastGraph::saveSettings()
|
|
{
|
|
//Save user's settings
|
|
m_settings->beginGroup("FastGraph");
|
|
m_settings->setValue ("geometry", saveGeometry ());
|
|
m_settings->setValue("PlotZero",ui->fastPlot->m_plotZero);
|
|
m_settings->setValue("PlotGain",ui->fastPlot->m_plotGain);
|
|
m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero);
|
|
m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain);
|
|
m_settings->endGroup();
|
|
}
|
|
|
|
void FastGraph::plotSpec(bool diskData, int UTCdisk)
|
|
{
|
|
ui->fastPlot->m_diskData=diskData;
|
|
ui->fastPlot->m_UTCdisk=UTCdisk;
|
|
ui->fastPlot->draw();
|
|
}
|
|
|
|
void FastGraph::on_gainSlider_valueChanged(int value)
|
|
{
|
|
ui->fastPlot->setPlotGain(value);
|
|
ui->fastPlot->draw();
|
|
}
|
|
|
|
void FastGraph::on_zeroSlider_valueChanged(int value)
|
|
{
|
|
ui->fastPlot->setPlotZero(value);
|
|
ui->fastPlot->draw();
|
|
}
|
|
|
|
void FastGraph::on_greenZeroSlider_valueChanged(int value)
|
|
{
|
|
ui->fastPlot->setGreenZero(value);
|
|
ui->fastPlot->draw();
|
|
}
|
|
|
|
void FastGraph::setTRperiod(int n)
|
|
{
|
|
m_TRperiod=n;
|
|
ui->fastPlot->setTRperiod(m_TRperiod);
|
|
}
|
|
|
|
void FastGraph::on_pbAutoLevel_clicked()
|
|
{
|
|
float sum=0.0;
|
|
for(int i=0; i<=fast_jh; i++) {
|
|
sum += fast_green[i];
|
|
}
|
|
m_ave=sum/fast_jh;
|
|
ui->gainSlider->setValue(127-int(2.2*m_ave));
|
|
ui->zeroSlider->setValue(int(m_ave)+20);
|
|
ui->greenZeroSlider->setValue(160-int(3.3*m_ave));
|
|
}
|
|
|
|
void FastGraph::setMode(QString mode) //setMode
|
|
{
|
|
ui->fastPlot->setMode(mode);
|
|
}
|