aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_bsplugins/src/BSPluginInfo/RecordStructureModel.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/installer_bsplugins/src/BSPluginInfo/RecordStructureModel.h')
-rw-r--r--libs/installer_bsplugins/src/BSPluginInfo/RecordStructureModel.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/libs/installer_bsplugins/src/BSPluginInfo/RecordStructureModel.h b/libs/installer_bsplugins/src/BSPluginInfo/RecordStructureModel.h
new file mode 100644
index 0000000..9592b24
--- /dev/null
+++ b/libs/installer_bsplugins/src/BSPluginInfo/RecordStructureModel.h
@@ -0,0 +1,51 @@
+#ifndef BSPLUGININFO_RECORDSTRUCTUREMODEL_H
+#define BSPLUGININFO_RECORDSTRUCTUREMODEL_H
+
+#include "TESData/DataItem.h"
+#include "TESData/PluginList.h"
+#include "TESData/RecordPath.h"
+
+#include <QAbstractItemModel>
+#include <QList>
+
+namespace BSPluginInfo
+{
+
+class RecordStructureModel final : public QAbstractItemModel
+{
+ Q_OBJECT
+
+public:
+ RecordStructureModel(TESData::PluginList* pluginList, TESData::Record* record,
+ const TESData::RecordPath& path, MOBase::IOrganizer* organizer);
+
+ void refresh();
+
+ [[nodiscard]] const QString& file(int index) const { return m_Files[index]; }
+
+ QModelIndex index(int row, int column,
+ const QModelIndex& parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex& index) const override;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex& parent = QModelIndex()) 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;
+
+private:
+ using Item = TESData::DataItem;
+
+ void readFile(const TESData::RecordPath& path, const QString& filePath,
+ int index = 0);
+
+ QList<QString> m_Files;
+ MOBase::IOrganizer* m_Organizer = nullptr;
+ TESData::PluginList* m_PluginList = nullptr;
+ TESData::Record* m_Record = nullptr;
+ TESData::RecordPath m_Path;
+ std::shared_ptr<Item> m_Root;
+};
+
+} // namespace BSPluginInfo
+
+#endif // BSPLUGININFO_RECORDSTRUCTUREMODEL_H