mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 07:04:59 +00:00

SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
36 lines
825 B
C++
36 lines
825 B
C++
/*
|
|
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include "GitFilesModel.h"
|
|
|
|
namespace HackStudio {
|
|
|
|
NonnullRefPtr<GitFilesModel> GitFilesModel::create(Vector<LexicalPath>&& files)
|
|
{
|
|
return adopt(*new GitFilesModel(move(files)));
|
|
}
|
|
|
|
GitFilesModel::GitFilesModel(Vector<LexicalPath>&& files)
|
|
: m_files(move(files))
|
|
{
|
|
}
|
|
|
|
GUI::Variant GitFilesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
|
{
|
|
if (role == GUI::ModelRole::Display) {
|
|
return m_files.at(index.row()).string();
|
|
}
|
|
return {};
|
|
}
|
|
|
|
GUI::ModelIndex GitFilesModel::index(int row, int column, const GUI::ModelIndex&) const
|
|
{
|
|
if (row < 0 || row >= static_cast<int>(m_files.size()))
|
|
return {};
|
|
return create_index(row, column, &m_files.at(row));
|
|
}
|
|
|
|
};
|