Skip to content

Commit

Permalink
Remove the "save waterfall" feature
Browse files Browse the repository at this point in the history
It has been buggy since shortly after it was created.
  • Loading branch information
argilo committed Sep 30, 2023
1 parent 0262cde commit 8fc9dad
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 116 deletions.
2 changes: 1 addition & 1 deletion resources/news.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
FIXED: Time on waterfall is calculated correctly.
FIXED: Frequency is correctly rounded in I/Q filenames.
FIXED: Crash in AFSK1200 decoder.
FIXED: Y axis in saved waterfall is too narrow.
FIXED: Hang when setting a very narrow filter width.
FIXED: Inconsistent 1-2-5 scaling of amplitude axis.
REMOVED: "Save waterfall" feature.


2.16: Released April 28, 2023
Expand Down
27 changes: 0 additions & 27 deletions src/applications/gqrx/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2046,33 +2046,6 @@ void MainWindow::on_actionSaveSettings_triggered()
m_last_dir = fi.absolutePath();
}

void MainWindow::on_actionSaveWaterfall_triggered()
{
QDateTime dt(QDateTime::currentDateTimeUtc());

// previously used location
auto save_path = m_settings->value("wf_save_dir", "").toString();
if (!save_path.isEmpty())
save_path += "/";
save_path += dt.toString("gqrx_wf_yyyyMMdd_hhmmss.png");

auto wffile = QFileDialog::getSaveFileName(this, tr("Save waterfall"),
save_path, nullptr);
if (wffile.isEmpty())
return;

if (!ui->plotter->saveWaterfall(wffile))
{
QMessageBox::critical(this,
tr("Error"),
tr("There was an error saving the waterfall"));
}

// store the location used for the waterfall file
QFileInfo fi(wffile);
m_settings->setValue("wf_save_dir", fi.absolutePath());
}

/** Show I/Q player. */
void MainWindow::on_actionIqTool_triggered()
{
Expand Down
1 change: 0 additions & 1 deletion src/applications/gqrx/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ private slots:
int on_actionIoConfig_triggered();
void on_actionLoadSettings_triggered();
void on_actionSaveSettings_triggered();
void on_actionSaveWaterfall_triggered();
void on_actionIqTool_triggered();
void on_actionFullScreen_triggered(bool checked);
void on_actionRemoteControl_triggered(bool checked);
Expand Down
13 changes: 0 additions & 13 deletions src/applications/gqrx/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,6 @@
<addaction name="actionSaveSettings"/>
<addaction name="menu_RecentConfig"/>
<addaction name="separator"/>
<addaction name="actionSaveWaterfall"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menu_View">
Expand Down Expand Up @@ -726,17 +724,6 @@
<string>Show help on keyboard shortcuts</string>
</property>
</action>
<action name="actionSaveWaterfall">
<property name="text">
<string>Save waterfall</string>
</property>
<property name="statusTip">
<string>Save the current waterfall to a graphics file</string>
</property>
<property name="shortcut">
<string>Ctrl+W</string>
</property>
</action>
<action name="actionDX_Cluster">
<property name="text">
<string>DX Cluster</string>
Expand Down
73 changes: 0 additions & 73 deletions src/qtgui/plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,79 +606,6 @@ void CPlotter::clearWaterfallBuf()
m_wfbuf[i] = 0.0;
}

/**
* @brief Save waterfall to a graphics file
* @param filename
* @return TRUE if the save successful, FALSE if an error occurred.
*
* We assume that frequency strings are up to date
*/
bool CPlotter::saveWaterfall(const QString & filename) const
{
QBrush axis_brush(QColor(0x00, 0x00, 0x00, 0x70), Qt::SolidPattern);
QPixmap pixmap(m_WaterfallPixmap);
QPainter painter(&pixmap);
QRect rect;
QDateTime tt;
QFont font("sans-serif");
QFontMetricsF font_metrics(font);
float pixperdiv;
int x, y, w, h;
int hxa, wya;
int i;

w = pixmap.width();
h = pixmap.height();
hxa = font_metrics.height() + 5; // height of X axis
wya = font_metrics.boundingRect("2008.08.08").width() + 5; // width of Y axis
y = h - hxa;
pixperdiv = (float) w / (float) m_HorDivs;

painter.setBrush(axis_brush);
painter.setPen(QColor(0x0, 0x0, 0x0, 0x70));
painter.drawRect(0, y, w, hxa);
painter.drawRect(0, 0, wya, h - hxa - 1);
painter.setFont(font);
painter.setPen(QColor(0xFF, 0xFF, 0xFF, 0xFF));

// skip last frequency entry
for (i = 2; i < m_HorDivs - 1; i++)
{
// frequency tick marks
x = (int)((float)i * pixperdiv);
painter.drawLine(x, y, x, y + 5);

// frequency strings
x = (int)((float)i * pixperdiv - pixperdiv / 2.0f);
rect.setRect(x, y, (int)pixperdiv, hxa);
painter.drawText(rect, Qt::AlignHCenter|Qt::AlignBottom, m_HDivText[i]);
}
rect.setRect(w - pixperdiv - 10, y, pixperdiv, hxa);
painter.drawText(rect, Qt::AlignRight|Qt::AlignBottom, tr("MHz"));

quint64 msec;
int tdivs = h / 70 + 1;
pixperdiv = (float) h / (float) tdivs;
tt.setTimeSpec(Qt::OffsetFromUTC);
for (i = 1; i < tdivs; i++)
{
y = (int)((float)i * pixperdiv);
if (msec_per_wfline > 0)
msec = tlast_wf_ms - qRound(y * msec_per_wfline);
else
msec = tlast_wf_ms - qRound(y * 1000.0 / fft_rate);

tt.setMSecsSinceEpoch(msec);
rect.setRect(0, y - font_metrics.height(), wya - 5, font_metrics.height());
painter.drawText(rect, Qt::AlignRight|Qt::AlignVCenter, tt.toString("yyyy.MM.dd"));
painter.drawLine(wya - 5, y, wya, y);
rect.setRect(0, y, wya - 5, font_metrics.height());
painter.drawText(rect, Qt::AlignRight|Qt::AlignVCenter, tt.toString("hh:mm:ss"));
}

return pixmap.save(filename, nullptr, -1);
}

/** Get waterfall time resolution in milleconds / line. */
quint64 CPlotter::getWfTimeRes() const
{
Expand Down
1 change: 0 additions & 1 deletion src/qtgui/plotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class CPlotter : public QFrame
quint64 getWfTimeRes() const;
void setFftRate(int rate_hz);
void clearWaterfallBuf();
bool saveWaterfall(const QString & filename) const;

enum ePlotMode {
PLOT_MODE_MAX = 0,
Expand Down

0 comments on commit 8fc9dad

Please sign in to comment.