64 lines
1.7 KiB
C++
64 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2025 Fraunhofer IESE. All rights reserved.
|
|
*
|
|
* Authors:
|
|
* Iron Prando da Silva
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "data/tracedb.h"
|
|
#include "phases/dependencyinfos.h"
|
|
|
|
#include <QAbstractTableModel>
|
|
#include <QListWidget>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
class DependencyInfosModel : public QAbstractItemModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit DependencyInfosModel(TraceDB& traceFile, QObject* parent = nullptr);
|
|
~DependencyInfosModel() {}
|
|
|
|
protected:
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
int columnCount(const QModelIndex& parent) const override;
|
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
|
QVariant
|
|
headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
|
|
QModelIndex index(int row, int column, const QModelIndex& parent) const override;
|
|
QModelIndex parent(const QModelIndex& index) const override;
|
|
|
|
private:
|
|
DependencyInfos mDepInfosDepType;
|
|
DependencyInfos mDepInfosTimeDep;
|
|
DependencyInfos mDepInfosDelPhase;
|
|
DependencyInfos mDepInfosDepPhase;
|
|
|
|
void parseInfos();
|
|
struct Node
|
|
{
|
|
using NodeData = std::pair<QString, QString>;
|
|
|
|
Node() {}
|
|
Node(NodeData data, const Node* parent) : data(data), parent(parent) {}
|
|
|
|
/**
|
|
* Gets the row relative to its parent.
|
|
*/
|
|
int getRow() const;
|
|
int childCount() const { return children.size(); }
|
|
|
|
NodeData data;
|
|
|
|
const Node* parent = nullptr;
|
|
std::vector<std::unique_ptr<Node>> children;
|
|
};
|
|
|
|
std::unique_ptr<Node> rootNode = std::unique_ptr<Node>(new Node);
|
|
};
|