| 6 | #include "utils/Log.h" |
| 7 | |
| 8 | AppItem::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 | |
| 44 | AppItem::~AppItem() |
| 45 | { |
nothing calls this directly
no test coverage detected