aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_bsplugins/src/BSPluginInfo/AuxConflictModel.h
blob: 328a39e7975fd5a060cc1afa0a02893fd158bb3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef BSPLUGININFO_AUXCONFLICTMODEL_H
#define BSPLUGININFO_AUXCONFLICTMODEL_H

#include "TESData/PluginList.h"

#include <QAbstractItemModel>

namespace BSPluginInfo
{

class AuxConflictModel : public QAbstractItemModel
{
  Q_OBJECT

public:
  struct Item
  {
    QString name;
    QList<TESData::TESFileHandle> sortedHandles;
  };

  explicit AuxConflictModel(const TESData::PluginList* pluginList,
                            QObject* parent = nullptr);

  void appendItem(const QString& name, QList<TESData::TESFileHandle>&& handles);

  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;

protected:
  const TESData::PluginList* m_PluginList;
  QList<Item> m_Items;
};

class AuxWinnerModel final : public AuxConflictModel
{
  Q_OBJECT

public:
  enum EColumn
  {
    COL_NAME,
    COL_LOSERS,

    COL_COUNT
  };

  using AuxConflictModel::AuxConflictModel;

  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;
};

class AuxLoserModel final : public AuxConflictModel
{
  Q_OBJECT

public:
  enum EColumn
  {
    COL_NAME,
    COL_WINNER,

    COL_COUNT
  };

  using AuxConflictModel::AuxConflictModel;

  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;
};

class AuxNonConflictModel final : public AuxConflictModel
{
  Q_OBJECT

public:
  enum EColumn
  {
    COL_NAME,

    COL_COUNT
  };

  using AuxConflictModel::AuxConflictModel;

  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;
};

}  // namespace BSPluginInfo

#endif  // BSPLUGININFO_AUXCONFLICTMODEL_H