Skip to content

Commit

Permalink
plugins/m2k: Add conditional preference for including the debugger pl…
Browse files Browse the repository at this point in the history
…ugin

The debugger plugin should not be included by default in the m2k plugin,
so following the same logic from Scopy v1, an m2k specific preference
was created (default is false) so the user can decide if the debugger
should be included or not.

Signed-off-by: Andrei-Fabian-Pop <Andreifabian.Pop@analog.com>
  • Loading branch information
Andrei-Fabian-Pop authored and AlexandraTrifan committed Feb 4, 2025
1 parent dbe7649 commit 13b703d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion plugins/m2k/src/m2kplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ void M2kPlugin::initPreferences()
{
Preferences *p = Preferences::GetInstance();
p->init("m2k_instrument_notes_active", false);
p->init("m2k_debugger_plugin_included", false);
p->init("m2k_manual_calibration_enable", false);

p->init("m2k_show_adc_filters", false);
Expand Down Expand Up @@ -303,6 +304,12 @@ bool M2kPlugin::loadPreferencesPage()
"the user to take notes. Disabled by default.",
generalSection));

generalSection->contentLayout()->addWidget(
PREFERENCE_CHECK_BOX(p, "m2k_debugger_plugin_included", "Include debugger plugin",
"Include the Debugger in the current instrument list "
"when connected to an ADALM2000 device. Disabled by default.",
generalSection));

// Analog tools preferences
MenuSectionWidget *analogWidget = new MenuSectionWidget(m_preferencesPage);
MenuCollapseSection *analogSection = new MenuCollapseSection("Analog tools", MenuCollapseSection::MHCW_NONE,
Expand Down Expand Up @@ -582,9 +589,18 @@ void M2kPlugin::initMetadata()
"iio",
"m2k"
],
"exclude":["*", "!debuggerplugin"]
"exclude":["*"]
}
)plugin");

// Add !debuggerplugin to exclude list
if(Preferences::get("m2k_debugger_plugin_included").toBool()) {
if(!m_metadata.contains("exclude")) {
qWarning(CAT_M2KPLUGIN) << "Cannot find \"exclude\" key in M2kPlugin metadata";
} else {
m_metadata["exclude"] = QJsonArray({"*", "!debuggerplugin"});
}
}
}

#include "moc_m2kplugin.cpp"

0 comments on commit 13b703d

Please sign in to comment.