Skip to content

Commit

Permalink
tools/plugingenerator.py: return false to load page
Browse files Browse the repository at this point in the history
The template does not actually create a plugin page,
so it should return false

Signed-off-by: Adrian Suciu <[email protected]>
  • Loading branch information
adisuciu committed Jun 21, 2024
1 parent 4728b46 commit 58e34ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 62 deletions.
31 changes: 1 addition & 30 deletions plugins/datalogger/src/dataloggerplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,7 @@ bool DataLoggerPlugin::compatible(QString m_param, QString category)
return true;
}

bool DataLoggerPlugin::loadPage()
{
// Here you must write the code for the plugin info page
// Below is an example for an iio device
/*m_page = new QWidget();
m_page->setLayout(new QVBoxLayout(m_page));
m_page->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_infoPage = new InfoPage(m_page);
m_infoPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
m_page->layout()->addWidget(m_infoPage);
m_page->layout()->addItem(new QSpacerItem(0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding));
auto cp = ContextProvider::GetInstance();
struct iio_context *context = cp->open(m_param);
ssize_t attributeCount = iio_context_get_attrs_count(context);
for(int i = 0; i < attributeCount; ++i) {
const char *name;
const char *value;
int ret = iio_context_get_attr(context, i, &name, &value);
if(ret < 0) {
qWarning(CAT_DATALOGGERLUGIN) << "Could not read attribute with index:" << i;
continue;
}
m_infoPage->update(name, value);
}
cp->close(m_param);
m_page->ensurePolished();*/
return true;
}
bool DataLoggerPlugin::loadPage() { return false; }

bool DataLoggerPlugin::loadIcon()
{
Expand Down
31 changes: 1 addition & 30 deletions plugins/iiodebug/src/iiodebugplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,7 @@ bool IIODebugPlugin::compatible(QString m_param, QString category)
return ret;
}

bool IIODebugPlugin::loadPage()
{
// Here you must write the code for the plugin info page
// Below is an example for an iio device
/*m_page = new QWidget();
m_page->setLayout(new QVBoxLayout(m_page));
m_page->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_infoPage = new InfoPage(m_page);
m_infoPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
m_page->layout()->addWidget(m_infoPage);
m_page->layout()->addItem(new QSpacerItem(0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding));
auto cp = ContextProvider::GetInstance();
struct iio_context *context = cp->open(m_param);
ssize_t attributeCount = iio_context_get_attrs_count(context);
for(int i = 0; i < attributeCount; ++i) {
const char *name;
const char *value;
int ret = iio_context_get_attr(context, i, &name, &value);
if(ret < 0) {
qWarning(CAT_IIODEBUGPLUGIN) << "Could not read attribute with index:" << i;
continue;
}
m_infoPage->update(name, value);
}
cp->close(m_param);
m_page->ensurePolished();*/
return true;
}
bool IIODebugPlugin::loadPage() { return false; }

bool IIODebugPlugin::loadIcon()
{
Expand Down
6 changes: 4 additions & 2 deletions tools/plugingenerator/templates/plugin_src_template.mako
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ bool ${config['class_name']}::loadPage()
m_infoPage->update(name, value);
}
cp->close(m_param);
m_page->ensurePolished();*/
m_page->ensurePolished();
return true;
*/
return false;
}

bool ${config['class_name']}::loadIcon()
Expand Down Expand Up @@ -129,4 +131,4 @@ void ${config['class_name']}::initMetadata()
}
% endif
% endif
% endif
% endif

0 comments on commit 58e34ac

Please sign in to comment.