Skip to content

Commit

Permalink
Implement quick audio actions
Browse files Browse the repository at this point in the history
  • Loading branch information
BatchDrake committed Aug 18, 2024
1 parent ccea005 commit 1786a6a
Show file tree
Hide file tree
Showing 9 changed files with 4,131 additions and 0 deletions.
68 changes: 68 additions & 0 deletions Default/Audio/AudioWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,31 @@ AudioWidget::AudioWidget(
connectAll();

setProperty("collapsed", m_panelConfig->collapsed);

auto action = new QAction;

action->setIcon(QIcon(":/icons/nodemod.svg"));
registerAction(action, SLOT(onNoDemod()));

action = new QAction;
action->setIcon(QIcon(":/icons/am.svg"));
registerAction(action, SLOT(onAM()));

action = new QAction;
action->setIcon(QIcon(":/icons/fm.svg"));
registerAction(action, SLOT(onFM()));

action = new QAction;
action->setIcon(QIcon(":/icons/lsb.svg"));
registerAction(action, SLOT(onAM()));

action = new QAction;
action->setIcon(QIcon(":/icons/usb.svg"));
registerAction(action, SLOT(onUSB()));

action = new QAction;
action->setIcon(QIcon(":/icons/raw.svg"));
registerAction(action, SLOT(onRaw()));
}

AudioWidget::~AudioWidget()
Expand Down Expand Up @@ -878,6 +903,9 @@ AudioWidget::setState(int state, Suscan::Analyzer *analyzer)
if (analyzer == nullptr)
m_processor->setAnalyzer(analyzer);

for (auto &p : UIComponent::actions())
p->setEnabled(m_analyzer != nullptr);

applySpectrumState();
}

Expand Down Expand Up @@ -1233,5 +1261,45 @@ AudioWidget::onLockToFreqChanged()
setLockToFreq(getLockToFreq());
}

void
AudioWidget::onNoDemod()
{
setEnabled(false);
}

void
AudioWidget::onAM()
{
setEnabled(true);
setDemod(AudioDemod::AM);
}

void
AudioWidget::onFM()
{
setEnabled(true);
setDemod(AudioDemod::FM);
}

void
AudioWidget::onUSB()
{
setEnabled(true);
setDemod(AudioDemod::USB);
}

void
AudioWidget::onLSB()
{
setEnabled(true);
setDemod(AudioDemod::LSB);
}

void
AudioWidget::onRaw()
{
setEnabled(true);
setDemod(AudioDemod::RAW);
}

////////////////// TODO: implement onJumpToBookmark ////////////////////////////
9 changes: 9 additions & 0 deletions Default/Audio/AudioWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ namespace SigDigger {

// Analyzer slots
void onSourceInfoMessage(Suscan::SourceInfoMessage const &);

// Quick actions
void onNoDemod();
void onAM();
void onFM();
void onUSB();
void onLSB();
void onRaw();

};
}

Expand Down
6 changes: 6 additions & 0 deletions icons/Icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<file>fsk-inspector.svg</file>
<file>psk-inspector.svg</file>
<file>rms-inspector.svg</file>
<file>am.svg</file>
<file>fm.svg</file>
<file>nodemod.svg</file>
<file>raw.svg</file>
<file>usb.svg</file>
<file>lsb.svg</file>
</qresource>
<qresource prefix="/"/>
</RCC>
Loading

0 comments on commit 1786a6a

Please sign in to comment.