81 ChildPointerMap::const_iterator i =
childPointer_.find(index);
146 if (index.
column() == 0) {
148 if (role == ItemDataRole::Display) {
150 return object.name +
'/';
153 }
else if (role == ItemDataRole::Decoration) {
155 return static_cast<const char*
>(
"icons/git-blob.png");
157 return static_cast<const char*
>(
"icons/git-tree.png");
172 if (orientation == Orientation::Horizontal && role == ItemDataRole::Display)
173 return static_cast<const char*
>(
"File");
Git::Object getObject(const WModelIndex &index) const
Get the Git::Object that corresponds to an index.
void setRepositoryPath(const std::string &repositoryPath)
Set the repository and load its 'master' revision.
Index usable as a key to a map, that identifies a child/row within a tree.
const Git::ObjectId & treeObject() const
Returns the SHA1 id for the git tree object.
virtual int columnCount(const WModelIndex &parent=WModelIndex()) const
Returns the column count.
Git git_
The git repository.
int treeSize(const ObjectId &tree) const
Return the number of objects inside a tree object.
static constexpr int User
virtual Signal & layoutAboutToBeChanged()
Object treeGetObject(const ObjectId &tree, int index) const
Get some info on a tree object.
virtual WModelIndex parent(const WModelIndex &index) const
Returns the parent index.
void emit(A...args) const
int getTreeId(int parentId, int childIndex) const
Get or allocate an id for a folder.
static const ItemDataRole FilePathRole
::uint64_t internalId() const
virtual Signal & layoutChanged()
ChildPointerMap childPointer_
Maps child indexes to tree indexes.
virtual cpp17::any data(const WModelIndex &index, ItemDataRole role=ItemDataRole::Display) const
Returns data.
WModelIndex createIndex(int row, int column, void *ptr) const
virtual WModelIndex index(int row, int column, const WModelIndex &parent=WModelIndex()) const
Returns a child index.
static const ItemDataRole ContentsRole
The role which may be used on a file to retrieve its contents.
ObjectId getCommitTree(const std::string &revision) const
Get the tree for a particular revision.
virtual int rowCount(const WModelIndex &parent=WModelIndex()) const
Returns the row count.
int parentId() const
Returns the parent id.
int index() const
Returns the child index within the parent folder.
std::vector< Tree > treeData_
List of folder objects.
void loadRevision(const std::string &revName)
Load a particular revision.
Used to uniquely locate a folder within the folder hierarchy.
virtual cpp17::any headerData(int section, Orientation orientation=Orientation::Horizontal, ItemDataRole role=ItemDataRole::Display) const
Returns header data.
std::string catFile(const ObjectId &id) const
Return the raw contents of a git object.
void setRepositoryPath(const std::string &repository)
Set the git repository path.