diff --git a/src/applications/gqrx/mainwindow.cpp b/src/applications/gqrx/mainwindow.cpp index 50cbaf2e99..0ba6717922 100644 --- a/src/applications/gqrx/mainwindow.cpp +++ b/src/applications/gqrx/mainwindow.cpp @@ -1574,6 +1574,8 @@ void MainWindow::startIqRecording(const QString& recdir) toString("%1/gqrx_yyyyMMdd_hhmmss_%2_%3_fc.'raw'") .arg(recdir).arg(freq).arg(sr/dec); + ui->actionIoConfig->setDisabled(true); + ui->actionLoadSettings->setDisabled(true); // start recorder; fails if recording already in progress if (rx->start_iq_recording(lastRec.toStdString())) { @@ -1604,6 +1606,8 @@ void MainWindow::stopIqRecording() ui->statusBar->showMessage(tr("Error stopping I/Q recoder")); else ui->statusBar->showMessage(tr("I/Q data recoding stopped"), 5000); + ui->actionIoConfig->setDisabled(false); + ui->actionLoadSettings->setDisabled(false); } void MainWindow::startIqPlayback(const QString& filename, float samprate, double center_freq) @@ -1615,6 +1619,8 @@ void MainWindow::startIqPlayback(const QString& filename, float samprate, double } storeSession(); + backupFreq = ui->freqCtrl->getFrequency(); + backupOffset = (qint64) rx->get_filter_offset(); auto sri = (int)samprate; auto cf = (long long) center_freq; @@ -1646,6 +1652,9 @@ void MainWindow::startIqPlayback(const QString& filename, float samprate, double // FIXME: would be nice with good/bad status ui->statusBar->showMessage(tr("Playing %1").arg(filename)); + ui->actionIoConfig->setDisabled(true); + ui->actionLoadSettings->setDisabled(true); + ui->actionSaveSettings->setDisabled(true); on_actionDSP_triggered(true); } @@ -1659,6 +1668,9 @@ void MainWindow::stopIqPlayback() } ui->statusBar->showMessage(tr("I/Q playback stopped"), 5000); + ui->actionIoConfig->setDisabled(false); + ui->actionLoadSettings->setDisabled(false); + ui->actionSaveSettings->setDisabled(false); // restore original input device auto indev = m_settings->value("input/device", "").toString(); diff --git a/src/applications/gqrx/mainwindow.h b/src/applications/gqrx/mainwindow.h index c3679c569f..8bb801d4e6 100644 --- a/src/applications/gqrx/mainwindow.h +++ b/src/applications/gqrx/mainwindow.h @@ -80,6 +80,8 @@ public slots: qint64 d_hw_freq; qint64 d_hw_freq_start{}; qint64 d_hw_freq_stop{}; + qint64 backupFreq; /* for IQ player */ + qint64 backupOffset; /* for IQ player */ enum receiver::filter_shape d_filter_shape; std::complex* d_fftData; diff --git a/src/qtgui/iq_tool.cpp b/src/qtgui/iq_tool.cpp index 99559c88d5..1d2e180a84 100644 --- a/src/qtgui/iq_tool.cpp +++ b/src/qtgui/iq_tool.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -106,6 +107,20 @@ void CIqTool::on_listWidget_currentTextChanged(const QString ¤tText) } +/*! \brief Show/hide/enable/disable GUI controls */ + +void CIqTool::switchControlsState(bool recording, bool playback) +{ + ui->recButton->setEnabled(!playback); + + ui->playButton->setEnabled(!recording); + ui->slider->setEnabled(!recording); + + ui->listWidget->setEnabled(!(recording || playback)); + ui->recDirEdit->setEnabled(!(recording || playback)); + ui->recDirButton->setEnabled(!(recording || playback)); +} + /*! \brief Start/stop playback */ void CIqTool::on_playButton_clicked(bool checked) { @@ -131,8 +146,9 @@ void CIqTool::on_playButton_clicked(bool checked) } else { - ui->listWidget->setEnabled(false); - ui->recButton->setEnabled(false); + on_listWidget_currentTextChanged(current_file); + switchControlsState(false, true); + emit startPlayback(recdir->absoluteFilePath(current_file), (float)sample_rate, center_freq); } @@ -140,8 +156,7 @@ void CIqTool::on_playButton_clicked(bool checked) else { emit stopPlayback(); - ui->listWidget->setEnabled(true); - ui->recButton->setEnabled(true); + switchControlsState(false, false); ui->slider->setValue(0); } } @@ -154,9 +169,7 @@ void CIqTool::on_playButton_clicked(bool checked) */ void CIqTool::cancelPlayback() { - ui->playButton->setChecked(false); - ui->listWidget->setEnabled(true); - ui->recButton->setEnabled(true); + switchControlsState(false, false); is_playing = false; } @@ -178,7 +191,7 @@ void CIqTool::on_recButton_clicked(bool checked) if (checked) { - ui->playButton->setEnabled(false); + switchControlsState(true, false); emit startRecording(recdir->path()); refreshDir(); @@ -186,7 +199,7 @@ void CIqTool::on_recButton_clicked(bool checked) } else { - ui->playButton->setEnabled(true); + switchControlsState(false, false); emit stopRecording(); } } @@ -309,6 +322,8 @@ void CIqTool::refreshDir() { int selection = ui->listWidget->currentRow(); + QScrollBar * sc = ui->listWidget->verticalScrollBar(); + int lastScroll = sc->sliderPosition(); recdir->refresh(); QStringList files = recdir->entryList(); @@ -316,6 +331,7 @@ void CIqTool::refreshDir() ui->listWidget->clear(); ui->listWidget->insertItems(0, files); ui->listWidget->setCurrentRow(selection); + sc->setSliderPosition(lastScroll); ui->listWidget->blockSignals(false); if (is_recording) diff --git a/src/qtgui/iq_tool.h b/src/qtgui/iq_tool.h index 39fd1ca768..c6f5b6be33 100644 --- a/src/qtgui/iq_tool.h +++ b/src/qtgui/iq_tool.h @@ -86,6 +86,8 @@ private slots: void refreshDir(void); void refreshTimeWidgets(void); void parseFileName(const QString &filename); + void switchControlsState(bool recording, bool playback); + private: Ui::CIqTool *ui;