Implementing filter buttons

This commit is contained in:
Anonymus Raccoon
2020-03-24 21:41:52 +01:00
parent 40f843da75
commit 031cea84df
2 changed files with 26 additions and 1 deletions

View File

@@ -33,55 +33,72 @@ namespace ComSquare::Debugger
QMainWindow::connect(this->_ui.fromAPU, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromAPU, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].apu = checked; this->_proxy.filters[0].apu = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.fromCPU, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromCPU, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].cpu = checked; this->_proxy.filters[0].cpu = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.fromOAM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromOAM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].oamram = checked; this->_proxy.filters[0].oamram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.fromPPU, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromPPU, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].ppu = checked; this->_proxy.filters[0].ppu = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.fromROM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromROM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].rom = checked; this->_proxy.filters[0].rom = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.fromSRAM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromSRAM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].sram = checked; this->_proxy.filters[0].sram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.fromVRAM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromVRAM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].vram = checked; this->_proxy.filters[0].vram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.fromWRAM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromWRAM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].wram = checked; this->_proxy.filters[0].wram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.fromCG, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.fromCG, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[0].cgram = checked; this->_proxy.filters[0].cgram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.toAPU, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.toAPU, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[1].apu = checked; this->_proxy.filters[1].apu = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.toCPU, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.toCPU, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[1].cpu = checked; this->_proxy.filters[1].cpu = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.toOAM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.toOAM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[1].oamram = checked; this->_proxy.filters[1].oamram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.toPPU, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.toPPU, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[1].ppu = checked; this->_proxy.filters[1].ppu = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.toSRAM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.toSRAM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[1].sram = checked; this->_proxy.filters[1].sram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.toVRAM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.toVRAM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[1].vram = checked; this->_proxy.filters[1].vram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.toWRAM, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.toWRAM, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[1].wram = checked; this->_proxy.filters[1].wram = checked;
this->_proxy.refresh();
}); });
QMainWindow::connect(this->_ui.toCG, &QCheckBox::toggled, [this](bool checked) { QMainWindow::connect(this->_ui.toCG, &QCheckBox::toggled, [this](bool checked) {
this->_proxy.filters[1].cgram = checked; this->_proxy.filters[1].cgram = checked;
this->_proxy.refresh();
}); });
this->_window->show(); this->_window->show();
@@ -231,3 +248,8 @@ bool BusLoggerProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePa
return this->filters[log.write].sram; return this->filters[log.write].sram;
} }
} }
void BusLoggerProxy::refresh()
{
this->invalidateFilter();
}

View File

@@ -84,7 +84,10 @@ public:
//! @brief Currently enabled filters, index 0 is for reads, index 1 for writes. //! @brief Currently enabled filters, index 0 is for reads, index 1 for writes.
ComSquare::Debugger::BusLoggerFilters filters[2] = {ComSquare::Debugger::BusLoggerFilters(), ComSquare::Debugger::BusLoggerFilters()}; ComSquare::Debugger::BusLoggerFilters filters[2] = {ComSquare::Debugger::BusLoggerFilters(), ComSquare::Debugger::BusLoggerFilters()};
BusLoggerProxy(BusLogModel &parent); //! @brief Refresh the view after a change of filters.
void refresh();
explicit BusLoggerProxy(BusLogModel &parent);
BusLoggerProxy(const BusLoggerProxy &) = delete; BusLoggerProxy(const BusLoggerProxy &) = delete;
const BusLoggerProxy &operator=(const BusLoggerProxy &) = delete; const BusLoggerProxy &operator=(const BusLoggerProxy &) = delete;
~BusLoggerProxy() override = default; ~BusLoggerProxy() override = default;