Skip to content

Commit

Permalink
core/deviceimpl: Create NO_PLUGIN icon using DeviceIconBuilder.
Browse files Browse the repository at this point in the history
Signed-off-by: andreidanila1 <[email protected]>
  • Loading branch information
andreidanila1 committed Dec 13, 2024
1 parent 9cdce5b commit 24b096e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/src/deviceimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <QTextBrowser>
#include <QThread>
#include <QtConcurrent/QtConcurrent>
#include <deviceiconbuilder.h>
#include <style.h>

#include <common/scopyconfig.h>
Expand All @@ -45,6 +46,7 @@
Q_LOGGING_CATEGORY(CAT_DEVICEIMPL, "Device")

namespace scopy {

DeviceImpl::DeviceImpl(QString param, PluginManager *p, QString category, QObject *parent)
: QObject{parent}
, m_param(param)
Expand Down Expand Up @@ -157,17 +159,22 @@ void DeviceImpl::loadName()
void DeviceImpl::loadIcons()
{
m_icon = new QWidget();
QHBoxLayout *lay = new QHBoxLayout(m_icon);
m_icon->setFixedHeight(100);
m_icon->setFixedWidth(100);
new QHBoxLayout(m_icon);
for(auto &p : m_plugins) {
if(p->loadIcon()) {
m_icon->layout()->addWidget(p->icon());
lay->addWidget(p->icon());
return;
}
}

new QLabel("No PLUGIN", m_icon);
QLabel *header = new QLabel("No Plugin");
Style::setStyle(header, style::properties::label::deviceIcon, true);

QWidget *noPluginIcon =
DeviceIconBuilder().shape(DeviceIconBuilder::SQUARE).color("gray").headerWidget(header).build();
lay->addWidget(noPluginIcon);
}

void DeviceImpl::loadPages()
Expand Down

0 comments on commit 24b096e

Please sign in to comment.