From accf0e9cbba9e65c068f26445af88c5d463cd31f Mon Sep 17 00:00:00 2001 From: Andrei-Fabian-Pop Date: Fri, 20 Sep 2024 16:17:54 +0300 Subject: [PATCH] debugger: Add context attributes in info page Signed-off-by: Andrei-Fabian-Pop --- plugins/debugger/src/debuggerplugin.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/debugger/src/debuggerplugin.cpp b/plugins/debugger/src/debuggerplugin.cpp index 71e615f74..4e2186615 100644 --- a/plugins/debugger/src/debuggerplugin.cpp +++ b/plugins/debugger/src/debuggerplugin.cpp @@ -15,6 +15,7 @@ #include #include #include +#include using namespace scopy; using namespace scopy::debugger; @@ -102,7 +103,27 @@ bool DebuggerPlugin::loadPage() { m_page = new QWidget(); QVBoxLayout *lay = new QVBoxLayout(m_page); - lay->addWidget(new QLabel("IIO Debugger plugin", m_page)); + // m_page->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + InfoPage *info = new InfoPage(m_page); + info->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + lay->addWidget(info); + lay->addItem(new QSpacerItem(0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding)); + + ConnectionProvider *c = ConnectionProvider::GetInstance(); + Connection *conn = c->open(m_param); + + const char *name; + const char *value; + for(int i = 0; i < iio_context_get_attrs_count(conn->context()); ++i) { + int ret = iio_context_get_attr(conn->context(), i, &name, &value); + if(ret != 0) + continue; + + info->update(name, value); + } + c->close(m_param); + return true; }