1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Allow replay time offset to be set by ctrl+left click in waterfall.

This commit is contained in:
srcejon 2023-12-06 10:09:30 +00:00
parent 364dfc1fc5
commit 238a40b9e0
17 changed files with 70 additions and 12 deletions

View File

@ -623,6 +623,11 @@ void AirspyHFGui::on_replayLoop_toggled(bool checked)
sendSettings();
}
void AirspyHFGui::setReplayTime(float time)
{
ui->replayOffset->setValue(std::ceil(time * 10.0f));
}
void AirspyHFGui::makeUIConnections()
{
QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &AirspyHFGui::on_centerFrequency_changed);

View File

@ -46,6 +46,7 @@ public:
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
void setReplayTime(float time) override;
uint32_t getDevSampleRate(unsigned int index);
int getDevSampleRateIndex(uint32_t sampleRate);

View File

@ -691,6 +691,11 @@ void RTLSDRGui::on_replayLoop_toggled(bool checked)
sendSettings();
}
void RTLSDRGui::setReplayTime(float time)
{
ui->replayOffset->setValue(std::ceil(time * 10.0f));
}
void RTLSDRGui::makeUIConnections()
{
QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &RTLSDRGui::on_centerFrequency_changed);

View File

@ -50,6 +50,7 @@ public:
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
void setReplayTime(float time) override;
private:
Ui::RTLSDRGui* ui;

View File

@ -687,6 +687,11 @@ void SDRPlayV3Gui::on_replayLoop_toggled(bool checked)
sendSettings();
}
void SDRPlayV3Gui::setReplayTime(float time)
{
ui->replayOffset->setValue(std::ceil(time * 10.0f));
}
void SDRPlayV3Gui::makeUIConnections()
{
QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &SDRPlayV3Gui::on_centerFrequency_changed);

View File

@ -46,6 +46,7 @@ public:
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
void setReplayTime(float time) override;
private:
Ui::SDRPlayV3Gui* ui;

View File

@ -769,6 +769,11 @@ void USRPInputGUI::on_replayLoop_toggled(bool checked)
sendSettings();
}
void USRPInputGUI::setReplayTime(float time)
{
ui->replayOffset->setValue(std::ceil(time * 10.0f));
}
void USRPInputGUI::makeUIConnections()
{
QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &USRPInputGUI::on_startStop_toggled);

View File

@ -50,6 +50,7 @@ public:
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
void setReplayTime(float time) override;
private:
Ui::USRPInputGUI* ui;

View File

@ -875,28 +875,28 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>TransverterButton</class>
<extends>QPushButton</extends>
<header>gui/transverterbutton.h</header>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TransverterButton</class>
<extends>QPushButton</extends>
<header>gui/transverterbutton.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>

View File

@ -81,6 +81,7 @@ public:
void setCurrentDeviceIndex(int index) { m_currentDeviceIndex = index; } //!< index in plugins list
void setChannelNames(const QStringList& channelNames) { m_channelAddDialog.addChannelNames(channelNames); }
DeviceUISet* getDeviceUISet() { return m_deviceUISet; }
virtual void setReplayTime(float time) {} //!< Not supported by all devices
protected:
void closeEvent(QCloseEvent *event) override;

View File

@ -73,6 +73,8 @@ DeviceUISet::DeviceUISet(int deviceSetIndex, DeviceSet *deviceSet)
font.setFamily(QStringLiteral("Liberation Sans"));
font.setPointSize(9);
m_spectrum->setFont(font);
connect(m_mainSpectrumGUI, &MainSpectrumGUI::timeSelected, this, &DeviceUISet::onTimeSelected);
}
DeviceUISet::~DeviceUISet()
@ -825,3 +827,10 @@ int DeviceUISet::webapiSpectrumServerDelete(SWGSDRangel::SWGSuccessResponse& res
{
return m_spectrumVis->webapiSpectrumServerDelete(response, errorMessage);
}
void DeviceUISet::onTimeSelected(int deviceSetIndex, float time)
{
if (m_deviceGUI) {
m_deviceGUI->setReplayTime(time);
}
}

View File

@ -167,6 +167,7 @@ private:
private slots:
void handleChannelGUIClosing(ChannelGUI* channelGUI);
void handleDeleteChannel(ChannelAPI *channelAPI);
void onTimeSelected(int deviceSetIndex, float time);
};

View File

@ -4175,6 +4175,18 @@ void GLSpectrumView::mousePressEvent(QMouseEvent* event)
{
frequencyPan(event);
}
else if (event->modifiers() & Qt::ControlModifier)
{
if (!m_display3DSpectrogram && pointInWaterfallOrSpectrogram(ep))
{
QPointF pWat = ep;
pWat.rx() = (ep.x()/width() - m_waterfallRect.left()) / m_waterfallRect.width();
pWat.ry() = (ep.y()/height() - m_waterfallRect.top()) / m_waterfallRect.height();
float time = m_timeScale.getRangeMin() + pWat.y()*m_timeScale.getRange();
emit timeSelected(time);
}
return;
}
else if (m_display3DSpectrogram)
{
// Detect click and drag to rotate 3D spectrogram

View File

@ -541,6 +541,8 @@ signals:
void requestCenterFrequency(qint64 frequency);
// Emitted when annotations are changed
void updateAnnotations();
// Emitted when user ctrl-clicks on waterfall to select a time. time is in seconds.
void timeSelected(float time);
};

View File

@ -157,6 +157,8 @@ MainSpectrumGUI::MainSpectrumGUI(GLSpectrum *spectrum, GLSpectrumGUI *spectrumGU
connect(spectrum->getSpectrumView(), &GLSpectrumView::requestCenterFrequency, this, &MainSpectrumGUI::onRequestCenterFrequency);
connect(spectrumGUI, &GLSpectrumGUI::requestCenterFrequency, this, &MainSpectrumGUI::onRequestCenterFrequency);
connect(spectrum->getSpectrumView(), &GLSpectrumView::timeSelected, this, &MainSpectrumGUI::onTimeSelected);
m_resizer.enableChildMouseTracking();
shrinkWindow();
}
@ -380,3 +382,8 @@ void MainSpectrumGUI::onRequestCenterFrequency(qint64 frequency)
{
emit requestCenterFrequency(m_deviceSetIndex, frequency);
}
void MainSpectrumGUI::onTimeSelected(float time)
{
emit timeSelected(m_deviceSetIndex, time);
}

View File

@ -113,12 +113,14 @@ private slots:
void shrinkWindow();
void maximizeWindow();
void onRequestCenterFrequency(qint64 frequency);
void onTimeSelected(float time);
signals:
void closing();
void moveToWorkspace(int workspaceIndex);
void forceShrink();
void requestCenterFrequency(int deviceSetIndex, qint64 frequency); // an action from the user to move device center frequency
void timeSelected(int deviceSetIndex, float time); // user ctrl-clicked waterfall to set a time
};