bool FilterFileLine::accept (DecodedCommand const & cmd) const { QString file, line; if (!cmd.getString(tlv::tag_file, file)) return true; if (!cmd.getString(tlv::tag_line, line)) return true; bool excluded = false; if (!file.isNull() && !line.isNull() && !file.isEmpty() && !line.isEmpty()) { TreeModelItem ff; bool const ff_present = isFileLinePresent(std::make_pair(file, line), ff); if (ff_present) { excluded |= ff.m_state == e_Unchecked; } } return !excluded; }
bool FilterTid::accept (DecodedCommand const & cmd) const { QString tid; if (!cmd.getString(tlv::tag_tid, tid)) return true; bool enabled = true; bool const present = isPresent(tid, enabled); bool excluded = false; if (present) { //if (enabled && lvlmode == e_TidForceInclude) return true; // forced tids (errors etc) excluded |= !enabled; } return !excluded; }
bool Connection::handleTableCommand (DecodedCommand const & cmd, E_ReceiveMode mode) { if (getClosestFeatureState(e_data_table) == e_FtrDisabled) return true; QString msg_tag; if (!cmd.getString(tlv::tag_msg, msg_tag)) return true; QString tag = msg_tag; int const slash_pos = tag.lastIndexOf(QChar('/')); tag.chop(msg_tag.size() - slash_pos); QString subtag = msg_tag; subtag.remove(0, slash_pos + 1); datatables_t::iterator it = findOrCreateTable(tag); (*it)->handleCommand(cmd, mode); return true; }
bool FilterLvl::accept (DecodedCommand const & cmd) const { QString lvl; if (!cmd.getString(tlv::tag_lvl, lvl)) return true; E_LevelMode lvlmode = e_LvlInclude; bool lvl_enabled = true; bool const lvl_present = isPresent(lvl, lvl_enabled, lvlmode); bool excluded = false; if (lvl_present) { if (lvl_enabled && lvlmode == e_LvlForceInclude) return true; // forced levels (errors etc) excluded |= !lvl_enabled; } return !excluded; }
bool ColorizerRow::action (DecodedCommand const & cmd) { QString msg; if (!cmd.getString(tlv::tag_msg, msg)) return true; for (int i = 0, ie = m_data.size(); i < ie; ++i) { ColorizedRow const & ct = m_data[i]; bool const is_match = ct.m_row == cmd.m_src_row; if (!is_match) continue; for (size_t i = 0, ie = cmd.m_tvs.size(); i < ie; ++i) { QString const & val = cmd.m_tvs[i].m_val; QModelIndex const idx = m_src_model->index(cmd.m_src_row, i, QModelIndex()); //@TODO: cache QMI in DecodedCommand m_src_model->setData(idx, ct.m_bgcolor, Qt::BackgroundRole); m_src_model->setData(idx, ct.m_fgcolor, Qt::ForegroundRole); //@TODO: if column != level //@TODO: if column != tid } /*bool const is_match = cmd.m_src_row == ct.m_row; int const col = m_src_model->logWidget().findColumn4TagCst(tlv::tag_msg); QModelIndex const idx = m_src_model->index(cmd.m_src_row, col, QModelIndex()); if (is_match && idx.isValid()) { m_src_model->setData(idx, ct.m_fgcolor, Qt::ForegroundRole); m_src_model->setData(idx, ct.m_bgcolor, Qt::BackgroundRole); return true; }*/ } return false; }