File indexing completed on 2025-01-05 05:14:39

0001 /*
0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com>
0003 
0004 SPDX-License-Identifier: GPL-3.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "filestatus.h"
0010 #include <diff.h>
0011 #define TREEMODEL_NODE_DATA_TYPE Diff::DiffType
0012 #include "treemodel.h"
0013 
0014 class DiffTreeModel : public TreeModel
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     explicit DiffTreeModel(QObject *parent = nullptr);
0020 
0021     void addFile(const Git::FileStatus &file);
0022     void addFile(const QString &file, Diff::DiffType type);
0023 
0024     QVariant data(const QModelIndex &index, int role) const override;
0025 
0026     void emitAll();
0027 
0028 private:
0029     Q_REQUIRED_RESULT Diff::DiffType toDiffType(Git::FileStatus::Status status) const;
0030     Node *createPath(const QStringList &path, Diff::DiffType status);
0031     Q_REQUIRED_RESULT QColor statusColor(Diff::DiffType status) const;
0032 };