Skip to content

Commit

Permalink
plugins/swiotrefactor/ad: Added info btn(contains acquisition details).
Browse files Browse the repository at this point in the history
Signed-off-by: andrei.danila <[email protected]>
  • Loading branch information
andreidanila1 committed Apr 17, 2024
1 parent 7326845 commit d8f2da9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private Q_SLOTS:
void onChannelBtnChecked(int chnWidgetId, bool en);

private:
bool eventFilter(QObject *watched, QEvent *event) override;
void updateXData(int dataSize);
void plotData(QVector<double> curveData, int chnlIdx);
void createDevicesMap(iio_context *ctx);
Expand Down Expand Up @@ -124,9 +125,9 @@ private Q_SLOTS:
ToolTemplate *m_tool;
RunBtn *m_runBtn;
SingleShotBtn *m_singleBtn;
PrintBtn *m_printBtn;
QPushButton *m_configBtn;
GearBtn *m_settingsBtn;
InfoBtn *m_infoBtn;

PlotWidget *m_plot;
TimePlotInfo *m_info;
Expand Down
25 changes: 23 additions & 2 deletions plugins/swiotrefactor/src/ad74413r/ad74413r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,15 @@ void Ad74413r::setupToolTemplate()
setupDeviceBtn();
m_tool->addWidgetToCentralContainerHelper(m_plot);

m_infoBtn = new InfoBtn(this);
m_infoBtn->installEventFilter(this);
m_settingsBtn = new GearBtn(this);
m_runBtn = new RunBtn(this);
m_runBtn->setEnabled(false);
m_runBtn->setChecked(false);
m_singleBtn = new SingleShotBtn(this);
m_singleBtn->setEnabled(false);
m_singleBtn->setChecked(false);
m_printBtn = new PrintBtn(this);
m_configBtn = createConfigBtn();

MenuControlButton *chnlsMenuBtn = new MenuControlButton(this);
Expand Down Expand Up @@ -546,7 +547,8 @@ void Ad74413r::setupToolTemplate()

m_tool->addWidgetToTopContainerHelper(m_runBtn, TTA_RIGHT);
m_tool->addWidgetToTopContainerHelper(m_singleBtn, TTA_RIGHT);
m_tool->addWidgetToTopContainerHelper(m_printBtn, TTA_LEFT);

m_tool->addWidgetToTopContainerHelper(m_infoBtn, TTA_LEFT);
m_tool->addWidgetToTopContainerHelper(m_configBtn, TTA_LEFT);
}

Expand Down Expand Up @@ -599,6 +601,25 @@ QWidget *Ad74413r::createSettingsMenu(QWidget *parent)
return widget;
}

bool Ad74413r::eventFilter(QObject *watched, QEvent *event)
{
if(watched == (QObject *)m_infoBtn) {
if(event->type() == QEvent::Enter) {
auto enabledPlotsNo = std::count(m_enabledChannels.begin(), m_enabledChannels.end(), true);
m_infoBtn->setToolTip(
"sps = samples per second \n"
"sps = sampling_frequency / enabled_channels \n"
"Enabled channels = " +
QString::number(enabledPlotsNo) + "\n" +
"Samples per channel = " + QString::number(m_currentSamplingInfo.plotSize) + "\n" +
"Sampling frequency = " + QString::number(m_currentSamplingInfo.sampleRate));
}
return false;
} else {
return QWidget::eventFilter(watched, event);
}
}

void Ad74413r::initTutorialProperties()
{
// initialize components that might be used for the AD74413R tutorial
Expand Down

0 comments on commit d8f2da9

Please sign in to comment.