mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-13 06:32:54 +00:00
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>
36 lines
971 B
C++
36 lines
971 B
C++
/*
|
|
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "GitRepo.h"
|
|
#include <AK/LexicalPath.h>
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <LibGUI/Model.h>
|
|
|
|
namespace HackStudio {
|
|
|
|
class GitFilesModel final : public GUI::Model {
|
|
public:
|
|
static NonnullRefPtr<GitFilesModel> create(Vector<LexicalPath>&& files);
|
|
|
|
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_files.size(); }
|
|
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; }
|
|
|
|
virtual String column_name(int) const override
|
|
{
|
|
return "";
|
|
}
|
|
|
|
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
|
|
|
|
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override;
|
|
|
|
private:
|
|
explicit GitFilesModel(Vector<LexicalPath>&& files);
|
|
Vector<LexicalPath> m_files;
|
|
};
|
|
}
|