| 8 | #include <QSortFilterProxyModel> |
| 9 | |
| 10 | AdBlockLogDisplay::AdBlockLogDisplay(AdBlockManager *adBlockManager) : |
| 11 | QWidget(nullptr), |
| 12 | ui(new Ui::AdBlockLogDisplay), |
| 13 | m_adBlockManager(adBlockManager), |
| 14 | m_proxyModel(new QSortFilterProxyModel(this)), |
| 15 | m_sourceModel(new AdBlockLogTableModel(this)), |
| 16 | m_logSource(LogSourcePageUrl), |
| 17 | m_sourceUrl() |
| 18 | { |
| 19 | setAttribute(Qt::WA_DeleteOnClose, true); |
| 20 | |
| 21 | ui->setupUi(this); |
| 22 | |
| 23 | // Setup proxy model and table view |
| 24 | m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
| 25 | m_proxyModel->setFilterKeyColumn(-1); // -1 applies search terms to all columns |
| 26 | |
| 27 | m_proxyModel->setSourceModel(m_sourceModel); |
| 28 | ui->tableView->setModel(m_proxyModel); |
| 29 | |
| 30 | // Setup search event handler |
| 31 | connect(ui->lineEditSearch, &QLineEdit::editingFinished, this, &AdBlockLogDisplay::onSearchTermEntered); |
| 32 | |
| 33 | // Setup push button binding |
| 34 | connect(ui->pushButtonReload, &QPushButton::clicked, this, &AdBlockLogDisplay::onReloadClicked); |
| 35 | |
| 36 | // Setup combo box for log source type |
| 37 | ui->comboBoxLogSource->addItem(tr("URL"), QVariant(static_cast<int>(LogSourcePageUrl))); |
| 38 | ui->comboBoxLogSource->addItem(tr("All URLs"), QVariant(static_cast<int>(LogSourceAll))); |
| 39 | connect(ui->comboBoxLogSource, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), |
| 40 | this, &AdBlockLogDisplay::onComboBoxIndexChanged); |
| 41 | } |
| 42 | |
| 43 | AdBlockLogDisplay::~AdBlockLogDisplay() |
| 44 | { |
nothing calls this directly
no outgoing calls
no test coverage detected