| 56 | } |
| 57 | |
| 58 | void ViewStatus::paintEvent(QPaintEvent *) |
| 59 | { |
| 60 | QStyleOption opt; |
| 61 | #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
| 62 | opt.initFrom(this); |
| 63 | #else |
| 64 | opt.init(this); |
| 65 | #endif |
| 66 | |
| 67 | QPainter p(this); |
| 68 | style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); |
| 69 | QColor fore(QWidget::palette().color(QWidget::foregroundRole())); |
| 70 | |
| 71 | QFont font = p.font(); |
| 72 | float fSize = AppConfig::Instance().appOptions.fontSize; |
| 73 | if (fSize > 10) |
| 74 | fSize = 10; |
| 75 | font.setPointSizeF(fSize); |
| 76 | p.setFont(font); |
| 77 | |
| 78 | int mode = _session->get_device()->get_work_mode(); |
| 79 | |
| 80 | if (mode == LOGIC) { |
| 81 | fore.setAlpha(View::ForeAlpha); |
| 82 | p.setPen(fore); |
| 83 | p.drawText(this->rect(), Qt::AlignLeft | Qt::AlignVCenter, _rle_depth); |
| 84 | p.drawText(this->rect(), Qt::AlignRight | Qt::AlignVCenter, _trig_time); |
| 85 | |
| 86 | p.setPen(Qt::NoPen); |
| 87 | p.setBrush(View::Blue); |
| 88 | p.drawRect(this->rect().left(), this->rect().bottom() - 3, |
| 89 | _session->get_repeat_hold() * this->rect().width() / 100, 3); |
| 90 | |
| 91 | p.setPen(View::Blue); |
| 92 | p.drawText(this->rect(), Qt::AlignCenter | Qt::AlignVCenter, _capture_status); |
| 93 | } |
| 94 | else if (mode == DSO) { |
| 95 | fore.setAlpha(View::BackAlpha); |
| 96 | |
| 97 | for(size_t i = 0; i < _mrects.size(); i++) { |
| 98 | int sig_index = std::get<1>(_mrects[i]); |
| 99 | view::DsoSignal *dsoSig = NULL; |
| 100 | |
| 101 | for(auto s : _session->get_signals()) { |
| 102 | if (s->signal_type() == SR_CHANNEL_DSO && s->enabled()) { |
| 103 | dsoSig = (view::DsoSignal*)s; |
| 104 | if (sig_index == dsoSig->get_index()) |
| 105 | break; |
| 106 | else |
| 107 | dsoSig = NULL; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | bool active = dsoSig && dsoSig->enabled(); |
| 112 | const QRect rect = std::get<0>(_mrects[i]); |
| 113 | p.setPen(Qt::NoPen); |
| 114 | p.setBrush(active ? dsoSig->get_colour() : fore); |
| 115 | p.drawRect(QRect(rect.topLeft(), QSize(10, rect.height()))); |
nothing calls this directly
no test coverage detected