From 4afde2a39966ee1e63302c0a17467206f389ada0 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 24 Jun 2025 12:32:42 +0100 Subject: [PATCH] Radio Astronomy: Add option to auto save data to .csv. For #2435 --- .../radioastronomy/radioastronomygui.cpp | 221 ++++++++++++----- .../radioastronomy/radioastronomygui.h | 12 +- .../radioastronomy/radioastronomygui.ui | 228 +++++++++--------- .../radioastronomy/radioastronomysettings.cpp | 9 + .../radioastronomy/radioastronomysettings.h | 3 + plugins/channelrx/radioastronomy/readme.md | 6 +- 6 files changed, 307 insertions(+), 172 deletions(-) diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.cpp b/plugins/channelrx/radioastronomy/radioastronomygui.cpp index 470b91cfd..e45e7a4eb 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomygui.cpp @@ -49,6 +49,7 @@ #include "gui/timedelegate.h" #include "gui/decimaldelegate.h" #include "gui/dialogpositioner.h" +#include "gui/crightclickenabler.h" #include "channel/channelwebapiutils.h" #include "maincore.h" #include "feature/feature.h" @@ -1476,41 +1477,78 @@ void RadioAstronomyGUI::on_clearCal_clicked() clearCalData(); } -// Save power data in table to a CSV file -void RadioAstronomyGUI::on_savePowerData_clicked() +void RadioAstronomyGUI::savePowerData(const QString& filename) { + QFile file(filename); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QMessageBox::critical(this, "Radio Astronomy", QString("Failed to open file %1").arg(filename)); + return; + } + QTextStream out(&file); + + // Create a CSV file from the values in the table + for (int i = 0; i < ui->powerTable->horizontalHeader()->count(); i++) + { + QString text = ui->powerTable->horizontalHeaderItem(i)->text(); + out << text << ","; + } + out << "\n"; + for (int i = 0; i < ui->powerTable->rowCount(); i++) + { + for (int j = 0; j < ui->powerTable->horizontalHeader()->count(); j++) + { + out << ui->powerTable->item(i,j)->data(Qt::DisplayRole).toString() << ","; + } + out << "\n"; + } +} + +// Save power data in table to a CSV file +void RadioAstronomyGUI::on_savePowerData_clicked(bool checked) +{ + ui->savePowerData->setChecked(!m_settings.m_powerAutoSaveCSVFilename.isEmpty()); + // Get filename to save to QFileDialog fileDialog(nullptr, "Select file to save data to", "", "*.csv"); fileDialog.setAcceptMode(QFileDialog::AcceptSave); if (fileDialog.exec()) { QStringList fileNames = fileDialog.selectedFiles(); - if (fileNames.size() > 0) - { - QFile file(fileNames[0]); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - QMessageBox::critical(this, "Radio Astronomy", QString("Failed to open file %1").arg(fileNames[0])); - return; - } - QTextStream out(&file); + if (fileNames.size() > 0) { + savePowerData(fileNames[0]); + } + } +} - // Create a CSV file from the values in the table - for (int i = 0; i < ui->powerTable->horizontalHeader()->count(); i++) +void RadioAstronomyGUI::on_savePowerData_rightClicked(const QPoint& point) +{ + (void) point; + + if (!ui->savePowerData->isChecked()) + { + // Get filename to save to + QFileDialog fileDialog(nullptr, "Select file to auto save data to", "", "*.csv"); + fileDialog.setAcceptMode(QFileDialog::AcceptSave); + if (fileDialog.exec()) + { + QStringList fileNames = fileDialog.selectedFiles(); + if (fileNames.size() > 0) { - QString text = ui->powerTable->horizontalHeaderItem(i)->text(); - out << text << ","; - } - out << "\n"; - for (int i = 0; i < ui->powerTable->rowCount(); i++) - { - for (int j = 0; j < ui->powerTable->horizontalHeader()->count(); j++) - { - out << ui->powerTable->item(i,j)->data(Qt::DisplayRole).toString() << ","; - } - out << "\n"; + m_settings.m_powerAutoSaveCSVFilename = fileNames[0]; + ui->savePowerData->setChecked(true); + ui->savePowerData->setToolTip(QString("Left click to save data to a .csv file.\nRight click to disable auto save.\nAuto saving to %1").arg(m_settings.m_powerAutoSaveCSVFilename)); + applySettings(); + savePowerData(m_settings.m_powerAutoSaveCSVFilename); } } } + else + { + ui->savePowerData->setChecked(false); + ui->savePowerData->setToolTip("Left click to save data to a .csv file.\nRight click to auto-save data to a .csv file"); + m_settings.m_powerAutoSaveCSVFilename = ""; + applySettings(); + } } // Create a hash mapping from column name to array index @@ -1719,52 +1757,89 @@ RadioAstronomyGUI::FFTMeasurement* RadioAstronomyGUI::loadFFT(QHash } } -void RadioAstronomyGUI::on_saveSpectrumData_clicked() +void RadioAstronomyGUI::saveSpectrumData(const QString& filename) { + QFile file(filename); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QMessageBox::critical(this, "Radio Astronomy", QString("Failed to open file %1").arg(filename)); + return; + } + QTextStream out(&file); + + if (ui->spectrumChartSelect->currentIndex() == 0) + { + // Create a CSV file for all the spectrum data + out << "Date Time,Centre Freq,Sample Rate,Integration,Bandwidth,OmegaA,OmegaS,Power (FFT),Power (dBFS),Power (dBm),Power (Watts),Tsys,Tsys0,Tsource,Sv,SigmaTsys,SigmaSsys,Min Temp,Baseline,RA,Dec,Azimuth,Elevation,l,b,vBCRS,vLSR,Solar Flux,Air Temp,Sky Temp,Sensor 1,Sensor 2,FFT Size,Data\n"; + for (int i = 0; i < m_fftMeasurements.size(); i++) { + saveFFT(out, m_fftMeasurements[i]); + } + } + else + { + // Create a CSV file for calibration data + out << "Cal,Cal Temp,Date Time,Centre Freq,Sample Rate,Integration,Bandwidth,OmegaA,OmegaS,Power (FFT),Power (dBFS),Power (dBm),Power (Watts),Tsys,Tsys0,Tsource,Sv,SigmaTsys,SigmaSsys,Min Temp,Baseline,RA,Dec,Azimuth,Elevation,l,b,vBCRS,vLSR,Solar Flux,Air Temp,Sky Temp,Sensor 1,Sensor 2,FFT Size,Data\n"; + if (m_calHot) + { + out << "Hot,"; + out << m_settings.m_tCalHot; + out << ","; + saveFFT(out, m_calHot); + } + if (m_calCold) + { + out << "Cold,"; + out << m_settings.m_tCalCold; + out << ","; + saveFFT(out, m_calCold); + } + } +} + +void RadioAstronomyGUI::on_saveSpectrumData_clicked(bool checked) +{ + ui->saveSpectrumData->setChecked(!m_settings.m_spectrumAutoSaveCSVFilename.isEmpty()); + // Get filename to save to QFileDialog fileDialog(nullptr, "Select file to save data to", "", "*.csv"); fileDialog.setAcceptMode(QFileDialog::AcceptSave); if (fileDialog.exec()) { QStringList fileNames = fileDialog.selectedFiles(); - if (fileNames.size() > 0) - { - QFile file(fileNames[0]); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - QMessageBox::critical(this, "Radio Astronomy", QString("Failed to open file %1").arg(fileNames[0])); - return; - } - QTextStream out(&file); + if (fileNames.size() > 0) { + saveSpectrumData(fileNames[0]); + } + } +} - if (ui->spectrumChartSelect->currentIndex() == 0) +void RadioAstronomyGUI::on_saveSpectrumData_rightClicked(const QPoint &point) +{ + (void) point; + + if (!ui->saveSpectrumData->isChecked()) + { + // Get filename to save to + QFileDialog fileDialog(nullptr, "Select file to auto save data to", "", "*.csv"); + fileDialog.setAcceptMode(QFileDialog::AcceptSave); + if (fileDialog.exec()) + { + QStringList fileNames = fileDialog.selectedFiles(); + if (fileNames.size() > 0) { - // Create a CSV file for all the spectrum data - out << "Date Time,Centre Freq,Sample Rate,Integration,Bandwidth,OmegaA,OmegaS,Power (FFT),Power (dBFS),Power (dBm),Power (Watts),Tsys,Tsys0,Tsource,Sv,SigmaTsys,SigmaSsys,Min Temp,Baseline,RA,Dec,Azimuth,Elevation,l,b,vBCRS,vLSR,Solar Flux,Air Temp,Sky Temp,Sensor 1,Sensor 2,FFT Size,Data\n"; - for (int i = 0; i < m_fftMeasurements.size(); i++) { - saveFFT(out, m_fftMeasurements[i]); - } - } - else - { - // Create a CSV file for calibration data - out << "Cal,Cal Temp,Date Time,Centre Freq,Sample Rate,Integration,Bandwidth,OmegaA,OmegaS,Power (FFT),Power (dBFS),Power (dBm),Power (Watts),Tsys,Tsys0,Tsource,Sv,SigmaTsys,SigmaSsys,Min Temp,Baseline,RA,Dec,Azimuth,Elevation,l,b,vBCRS,vLSR,Solar Flux,Air Temp,Sky Temp,Sensor 1,Sensor 2,FFT Size,Data\n"; - if (m_calHot) - { - out << "Hot,"; - out << m_settings.m_tCalHot; - out << ","; - saveFFT(out, m_calHot); - } - if (m_calCold) - { - out << "Cold,"; - out << m_settings.m_tCalCold; - out << ","; - saveFFT(out, m_calCold); - } + m_settings.m_spectrumAutoSaveCSVFilename = fileNames[0]; + ui->saveSpectrumData->setChecked(true); + ui->saveSpectrumData->setToolTip(QString("Left click to save data to a .csv file.\nRight click to disable auto save.\nAuto saving to %1").arg(m_settings.m_spectrumAutoSaveCSVFilename)); + applySettings(); + saveSpectrumData(m_settings.m_spectrumAutoSaveCSVFilename); } } } + else + { + ui->saveSpectrumData->setChecked(false); + ui->saveSpectrumData->setToolTip("Left click to save data to a .csv file.\nRight click to auto-save data to a .csv file"); + m_settings.m_spectrumAutoSaveCSVFilename = ""; + applySettings(); + } } void RadioAstronomyGUI::on_loadSpectrumData_clicked() @@ -2067,6 +2142,17 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms + CRightClickEnabler *saveSpectrumDataClickEnabler = new CRightClickEnabler(ui->saveSpectrumData); + connect(saveSpectrumDataClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(on_saveSpectrumData_rightClicked(const QPoint &))); + + CRightClickEnabler *savePowerDataClickEnabler = new CRightClickEnabler(ui->savePowerData); + connect(savePowerDataClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(on_savePowerData_rightClicked(const QPoint &))); + + connect(&m_autoSaveTimer, &QTimer::timeout, this, &RadioAstronomyGUI::autosave); + m_autoSaveTimer.setInterval(5 * 60 * 1000); + m_autoSaveTimer.setSingleShot(false); + m_autoSaveTimer.start(); + m_networkManager = new QNetworkAccessManager(); QObject::connect( m_networkManager, @@ -2306,6 +2392,7 @@ void RadioAstronomyGUI::customContextMenuRequested(QPoint pos) RadioAstronomyGUI::~RadioAstronomyGUI() { + m_autoSaveTimer.stop(); delete m_networkManager; delete ui; delete m_calHot; @@ -2530,6 +2617,8 @@ void RadioAstronomyGUI::displaySettings() m_calChart->legend()->setVisible(m_settings.m_spectrumLegend); } + ui->savePowerData->setChecked(!m_settings.m_powerAutoSaveCSVFilename.isEmpty()); + ui->saveSpectrumData->setChecked(!m_settings.m_spectrumAutoSaveCSVFilename.isEmpty()); ui->refFrame->setCurrentIndex((int)m_settings.m_refFrame); ui->spectrumLine->setCurrentIndex((int)m_settings.m_line); @@ -6265,6 +6354,20 @@ void RadioAstronomyGUI::calcSpectrumChartTickCount(QValueAxis *axis, int width) } } +void RadioAstronomyGUI::autosave() +{ + if (!m_settings.m_powerAutoSaveCSVFilename.isEmpty()) + { + qDebug() << "RadioAstronomyGUI: Autosaving power data to" << m_settings.m_powerAutoSaveCSVFilename; + savePowerData(m_settings.m_powerAutoSaveCSVFilename); + } + if (!m_settings.m_spectrumAutoSaveCSVFilename.isEmpty()) + { + qDebug() << "RadioAstronomyGUI: Autosaving spectrum data to" << m_settings.m_spectrumAutoSaveCSVFilename; + saveSpectrumData(m_settings.m_spectrumAutoSaveCSVFilename); + } +} + void RadioAstronomyGUI::resizeEvent(QResizeEvent* size) { int width = size->size().width(); @@ -6316,9 +6419,9 @@ void RadioAstronomyGUI::makeUIConnections() QObject::connect(ui->spectrumMarker, &ButtonSwitch::toggled, this, &RadioAstronomyGUI::on_spectrumMarker_toggled); QObject::connect(ui->spectrumPeak, &ButtonSwitch::toggled, this, &RadioAstronomyGUI::on_spectrumPeak_toggled); QObject::connect(ui->spectrumReverseXAxis, &ButtonSwitch::toggled, this, &RadioAstronomyGUI::on_spectrumReverseXAxis_toggled); - QObject::connect(ui->savePowerData, &QToolButton::clicked, this, &RadioAstronomyGUI::on_savePowerData_clicked); + QObject::connect(ui->savePowerData, &ButtonSwitch::clicked, this, &RadioAstronomyGUI::on_savePowerData_clicked); QObject::connect(ui->savePowerChartImage, &QToolButton::clicked, this, &RadioAstronomyGUI::on_savePowerChartImage_clicked); - QObject::connect(ui->saveSpectrumData, &QToolButton::clicked, this, &RadioAstronomyGUI::on_saveSpectrumData_clicked); + QObject::connect(ui->saveSpectrumData, &ButtonSwitch::clicked, this, &RadioAstronomyGUI::on_saveSpectrumData_clicked); QObject::connect(ui->loadSpectrumData, &QToolButton::clicked, this, &RadioAstronomyGUI::on_loadSpectrumData_clicked); QObject::connect(ui->saveSpectrumChartImage, &QToolButton::clicked, this, &RadioAstronomyGUI::on_saveSpectrumChartImage_clicked); QObject::connect(ui->saveSpectrumChartImages, &QToolButton::clicked, this, &RadioAstronomyGUI::on_saveSpectrumChartImages_clicked); diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.h b/plugins/channelrx/radioastronomy/radioastronomygui.h index a391a9eb1..fb5c3f7e6 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.h +++ b/plugins/channelrx/radioastronomy/radioastronomygui.h @@ -338,6 +338,8 @@ private: int m_windowIdx; int m_windowCount; + QTimer m_autoSaveTimer; + QNetworkAccessManager *m_networkManager; QNetworkRequest m_networkRequest; HttpDownloadManager m_dlm; @@ -462,6 +464,9 @@ private: void setColumnPrecisionFromRotator(); void getRotatorData(FFTMeasurement *fft); + void saveSpectrumData(const QString& filename); + void savePowerData(const QString& filename); + void leaveEvent(QEvent*); void enterEvent(EnterEventType*); @@ -593,9 +598,11 @@ private slots: void on_spectrumMarker_toggled(bool checked); void on_spectrumPeak_toggled(bool checked); void on_spectrumReverseXAxis_toggled(bool checked); - void on_savePowerData_clicked(); + void on_savePowerData_clicked(bool checked); + void on_savePowerData_rightClicked(const QPoint& point); void on_savePowerChartImage_clicked(); - void on_saveSpectrumData_clicked(); + void on_saveSpectrumData_clicked(bool checked); + void on_saveSpectrumData_rightClicked(const QPoint &point); void on_loadSpectrumData_clicked(); void on_saveSpectrumChartImage_clicked(); void on_saveSpectrumChartImages_clicked(); @@ -704,6 +711,7 @@ private slots: void powerTableColumnSelectMenuChecked(bool checked = false); void on_powerTable_cellDoubleClicked(int row, int column); + void autosave(); void plotPowerChart(); void plotPowerVsTimeChart(); void plot2DChart(); diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.ui b/plugins/channelrx/radioastronomy/radioastronomygui.ui index 59b55cda7..586101742 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.ui +++ b/plugins/channelrx/radioastronomy/radioastronomygui.ui @@ -29,7 +29,7 @@ - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus Radio Astronomy @@ -110,7 +110,7 @@ PointingHandCursor - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus Shift frequency from center in Hz @@ -127,7 +127,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -162,7 +162,7 @@ PointingHandCursor - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus Sample rate in samples per second @@ -179,7 +179,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -214,7 +214,7 @@ PointingHandCursor - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus RF bandwidth in Hertz @@ -231,7 +231,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -249,7 +249,7 @@ Channel power - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft 0.0 @@ -270,7 +270,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -286,7 +286,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -321,7 +321,7 @@ PointingHandCursor - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus FFT integration count per measurement @@ -331,7 +331,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -403,7 +403,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -440,7 +440,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -461,7 +461,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -493,7 +493,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -522,7 +522,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -554,7 +554,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -582,7 +582,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -597,7 +597,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -654,7 +654,7 @@ This is the combined noise of LNA, feed and SDR - Qt::Vertical + Qt::Orientation::Vertical @@ -690,7 +690,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -747,7 +747,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -781,7 +781,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -875,7 +875,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -932,7 +932,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -965,7 +965,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -1022,7 +1022,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1061,7 +1061,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1105,7 +1105,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -1135,7 +1135,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -1185,7 +1185,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -1288,7 +1288,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1677,7 +1677,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1704,7 +1704,7 @@ This should be 2.73K when pointing at the sky 0 - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter @@ -1717,7 +1717,7 @@ This should be 2.73K when pointing at the sky - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -1825,7 +1825,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1872,7 +1872,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/hot.png:/radioastronomy/icons/hot.png @@ -1886,7 +1886,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/cold.png:/radioastronomy/icons/cold.png @@ -1920,7 +1920,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/legend.png:/radioastronomy/icons/legend.png @@ -1940,7 +1940,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/lab.png:/radioastronomy/icons/lab.png @@ -1960,7 +1960,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/galactictriangle.png:/radioastronomy/icons/galactictriangle.png @@ -1980,7 +1980,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/refline.png:/radioastronomy/icons/refline.png @@ -2000,7 +2000,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/gaussian.png:/radioastronomy/icons/gaussian.png @@ -2020,7 +2020,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/marker.png:/radioastronomy/icons/marker.png @@ -2040,7 +2040,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/peak.png:/radioastronomy/icons/peak.png @@ -2060,7 +2060,7 @@ This should be 2.73K when pointing at the sky - + :/radioastronomy/icons/reverse.png:/radioastronomy/icons/reverse.png @@ -2114,9 +2114,10 @@ This should be 2.73K when pointing at the sky - + - Save data to a .csv file + Left click to save data to a .csv file. +Right click to auto-save data to a .csv file @@ -2125,6 +2126,12 @@ This should be 2.73K when pointing at the sky :/save.png:/save.png + + true + + + false + @@ -2341,7 +2348,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2388,7 +2395,7 @@ This should be 2.73K when pointing at the sky 1 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2404,7 +2411,7 @@ This should be 2.73K when pointing at the sky true - QAbstractSpinBox::NoButtons + QAbstractSpinBox::ButtonSymbols::NoButtons dd/MM/yyyy HH:mm:ss @@ -2432,7 +2439,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2511,7 +2518,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -2547,7 +2554,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -2590,7 +2597,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -2630,7 +2637,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2664,7 +2671,7 @@ This should be 2.73K when pointing at the sky - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2719,7 +2726,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -2775,7 +2782,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -2815,7 +2822,7 @@ This should be 2.73K when pointing at the sky - Qt::Vertical + Qt::Orientation::Vertical @@ -2858,7 +2865,7 @@ WNM 5000-10000 - Qt::Vertical + Qt::Orientation::Vertical @@ -2895,7 +2902,7 @@ WNM 5000-10000 - Qt::Vertical + Qt::Orientation::Vertical @@ -2926,7 +2933,7 @@ WNM 5000-10000 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -3015,7 +3022,7 @@ WNM 5000-10000 - Qt::Vertical + Qt::Orientation::Vertical @@ -3062,7 +3069,7 @@ WNM 5000-10000 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -3078,7 +3085,7 @@ WNM 5000-10000 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -3126,7 +3133,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -3147,7 +3154,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -3178,7 +3185,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -3206,7 +3213,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -3237,7 +3244,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -3271,7 +3278,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -3296,10 +3303,10 @@ This should be close to the expected difference in power between hot and cold ca - QAbstractScrollArea::AdjustToContents + QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents - QAbstractItemView::NoEditTriggers + QAbstractItemView::EditTrigger::NoEditTriggers true @@ -3503,7 +3510,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -3522,7 +3529,7 @@ This should be close to the expected difference in power between hot and cold ca - + :/radioastronomy/icons/legend.png:/radioastronomy/icons/legend.png @@ -3582,7 +3589,7 @@ This should be close to the expected difference in power between hot and cold ca - + :/radioastronomy/icons/temperature.png:/radioastronomy/icons/temperature.png @@ -3602,7 +3609,7 @@ This should be close to the expected difference in power between hot and cold ca - + :/radioastronomy/icons/noise.png:/radioastronomy/icons/noise.png @@ -3678,7 +3685,7 @@ This should be close to the expected difference in power between hot and cold ca - + :/radioastronomy/icons/gaussian.png:/radioastronomy/icons/gaussian.png @@ -3698,7 +3705,7 @@ This should be close to the expected difference in power between hot and cold ca - + :/radioastronomy/icons/marker.png:/radioastronomy/icons/marker.png @@ -3718,7 +3725,7 @@ This should be close to the expected difference in power between hot and cold ca - + :/radioastronomy/icons/peak.png:/radioastronomy/icons/peak.png @@ -3744,9 +3751,10 @@ This should be close to the expected difference in power between hot and cold ca - + - Save data to a .csv file + Left click to save data to a .csv file. +Right click to auto-save data to a .csv file @@ -3755,6 +3763,12 @@ This should be close to the expected difference in power between hot and cold ca :/save.png:/save.png + + true + + + false + @@ -3950,7 +3964,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -3984,7 +3998,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -4023,7 +4037,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -4079,7 +4093,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -4122,7 +4136,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -4165,7 +4179,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -4202,7 +4216,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -4261,7 +4275,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -4317,7 +4331,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -4426,14 +4440,14 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical - Qt::Vertical + Qt::Orientation::Vertical @@ -4555,7 +4569,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -4596,7 +4610,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -4630,7 +4644,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -4664,7 +4678,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Vertical + Qt::Orientation::Vertical @@ -4685,7 +4699,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -4716,7 +4730,7 @@ This should be close to the expected difference in power between hot and cold ca - Qt::Horizontal + Qt::Orientation::Horizontal @@ -4741,10 +4755,10 @@ This should be close to the expected difference in power between hot and cold ca - QAbstractScrollArea::AdjustToContents + QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents - QAbstractItemView::NoEditTriggers + QAbstractItemView::EditTrigger::NoEditTriggers true @@ -4918,10 +4932,10 @@ This should be close to the expected difference in power between hot and cold ca Power table - QAbstractItemView::NoEditTriggers + QAbstractItemView::EditTrigger::NoEditTriggers - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows @@ -5277,7 +5291,6 @@ This should be close to the expected difference in power between hot and cold ca saveSpectrumChartImages saveSpectrumChartImage loadSpectrumData - saveSpectrumData spectrumChart spectrumAutoscale sampleRate @@ -5324,7 +5337,6 @@ This should be close to the expected difference in power between hot and cold ca powerShowMarker powerShowPeak savePowerChartImage - savePowerData powerAutoscale powerAutoscaleX powerAutoscaleY @@ -5355,7 +5367,7 @@ This should be close to the expected difference in power between hot and cold ca - + diff --git a/plugins/channelrx/radioastronomy/radioastronomysettings.cpp b/plugins/channelrx/radioastronomy/radioastronomysettings.cpp index db2a41311..bc3f280d6 100644 --- a/plugins/channelrx/radioastronomy/radioastronomysettings.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomysettings.cpp @@ -150,6 +150,9 @@ void RadioAstronomySettings::resetToDefaults() m_stopCalCommand = ""; m_calCommandDelay = 1.0f; + m_spectrumAutoSaveCSVFilename = ""; + m_powerAutoSaveCSVFilename = ""; + m_rgbColor = QColor(102, 0, 0).rgb(); m_title = "Radio Astronomy"; m_streamIndex = 0; @@ -295,6 +298,9 @@ QByteArray RadioAstronomySettings::serialize() const s.writeString(168, m_stopCalCommand); s.writeFloat(169, m_calCommandDelay); + s.writeString(170, m_spectrumAutoSaveCSVFilename); + s.writeString(171, m_powerAutoSaveCSVFilename); + s.writeU32(180, m_rgbColor); s.writeString(181, m_title); if (m_channelMarker) { @@ -461,6 +467,9 @@ bool RadioAstronomySettings::deserialize(const QByteArray& data) d.readString(168, &m_stopCalCommand, ""); d.readFloat(169, &m_calCommandDelay, 1.0f); + d.readString(170, &m_spectrumAutoSaveCSVFilename, ""); + d.readString(171, &m_powerAutoSaveCSVFilename, ""); + d.readU32(180, &m_rgbColor, QColor(102, 0, 0).rgb()); d.readString(181, &m_title, "Radio Astronomy"); d.readBlob(182, &bytetmp); diff --git a/plugins/channelrx/radioastronomy/radioastronomysettings.h b/plugins/channelrx/radioastronomy/radioastronomysettings.h index a18bcc181..a85587de0 100644 --- a/plugins/channelrx/radioastronomy/radioastronomysettings.h +++ b/plugins/channelrx/radioastronomy/radioastronomysettings.h @@ -205,6 +205,9 @@ struct RadioAstronomySettings QString m_stopCalCommand; float m_calCommandDelay; //!< Delay in seconds after command before starting cal + QString m_spectrumAutoSaveCSVFilename; + QString m_powerAutoSaveCSVFilename; + quint32 m_rgbColor; QString m_title; Serializable *m_channelMarker; diff --git a/plugins/channelrx/radioastronomy/readme.md b/plugins/channelrx/radioastronomy/readme.md index 8ca7e4f85..2919cd315 100644 --- a/plugins/channelrx/radioastronomy/readme.md +++ b/plugins/channelrx/radioastronomy/readme.md @@ -458,9 +458,9 @@ Click to save the current chart to an image file. Click to restore data that had been saved to a .csv file. All existing data will be cleared. -

3.14: Save Data from a .csv File

+

3.14: Save Data to a .csv File

-Click to save all data to a .csv file. +Left click to save all data to a .csv file. Right click to select a .csv file to auto save data to every 5 minutes.

3.15: Autoscale

@@ -635,7 +635,7 @@ Click to save the current chart to an image file.

4.15: Save Data to a .csv File

-Click to save data from the Radiometer Data table to a .csv file. +Left click to save data from the Radiometer Data table to a .csv file. Right click to select a .csv file to auto save data to every 5 minutes.

4.16: Autoscale