1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:48:11 +00:00

Everywhere: Replace Model::update() with Model::invalidate()

Most of the models were just calling did_update anyway, which is
pointless since it can be unified to the base Model class. Instead, code
calling update() will now call invalidate(), which functions identically
and is more obvious in what it does.

Additionally, a default implementation is provided, which removes the
need to add empty implementations of update() for each model subclass.

Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
This commit is contained in:
sin-ack 2021-05-25 14:13:19 +00:00 committed by Andreas Kling
parent 5cd2e0f3a2
commit ca2c81251a
100 changed files with 116 additions and 261 deletions

View file

@ -33,7 +33,6 @@ public:
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual void update() override { }
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override;
struct FrameInfo {

View file

@ -111,9 +111,4 @@ GUI::Variant DisassemblyModel::data(const GUI::ModelIndex& index, GUI::ModelRole
return {};
}
void DisassemblyModel::update()
{
did_update();
}
}

View file

@ -46,7 +46,6 @@ public:
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual void update() override;
private:
DisassemblyModel(const Debug::DebugSession&, const PtraceRegisters&);

View file

@ -136,9 +136,4 @@ GUI::Variant RegistersModel::data(const GUI::ModelIndex& index, GUI::ModelRole r
return {};
}
void RegistersModel::update()
{
did_update();
}
}

View file

@ -42,7 +42,6 @@ public:
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual void update() override;
const PtraceRegisters& raw_registers() const { return m_raw_registers; }

View file

@ -158,11 +158,6 @@ GUI::Variant VariablesModel::data(const GUI::ModelIndex& index, GUI::ModelRole r
}
}
void VariablesModel::update()
{
did_update();
}
RefPtr<VariablesModel> VariablesModel::create(const PtraceRegisters& regs)
{
auto lib = Debugger::the().session()->library_at(regs.ip());

View file

@ -23,7 +23,6 @@ public:
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; }
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override;
virtual void update() override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override;