MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / AppItem

Method AppItem

src/interface/item/AppItem.cpp:8–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "utils/Log.h"
7
8AppItem::AppItem(AppItemModel* _model, int id, QWidget *parent) :
9 QWidget(parent),
10 ui(new Ui::AppItem),
11 id(id)
12{
13 ui->setupUi(this);
14
15 // Dummy mode
16 if(id == -1)
17 {
18 return;
19 }
20
21 model = _model;
22
23#ifdef USE_PULSEAUDIO
24 ui->blocklist->hide();
25#endif
26
27 auto node = model->findByNodeId(id);
28 if(!node.has_value())
29 {
30 Log::warning("AppItemModel::findByNodeId retuned nullopt");
31 return;
32 }
33
34 refresh(node.value());
35
36 ui->blocklist->setText(AppConfig::instance().get<bool>(AppConfig::AudioAppBlocklistInvert) ?
37 tr("Add to allowlist") : tr("Add to blocklist"));
38
39 connect(&AppConfig::instance(), &AppConfig::updated, this, &AppItem::onAppConfigUpdated);
40 connect(model, &AppItemModel::appChanged, this, &AppItem::refresh);
41 connect(ui->blocklist, &QCheckBox::toggled, this, &AppItem::setBlocked);
42}
43
44AppItem::~AppItem()
45{

Callers

nothing calls this directly

Calls 5

connectFunction · 0.85
hideMethod · 0.80
findByNodeIdMethod · 0.80
valueMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected