summaryrefslogtreecommitdiff
path: root/src/modlistgroupnexusidproxy.h
blob: 01d8a97d4c35d98f846fc96d82843b0b4fd5305e (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
#ifndef MODLISTGROUPNEXUSIDPROXY_H
#define MODLISTGROUPNEXUSIDPROXY_H


#include <QAbstractProxyModel>
#include <vector>
#include <map>
#include "profile.h"


class ModListGroupNexusIDProxy : public QAbstractProxyModel
{
  Q_OBJECT
public:
  explicit ModListGroupNexusIDProxy(Profile *profile, QObject *parent = 0);

  virtual int rowCount(const QModelIndex &parent) const;
  virtual int columnCount(const QModelIndex &parent) const;

  virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
  virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;

  virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
  virtual QModelIndex parent(const QModelIndex &child) const;

  virtual bool hasChildren(const QModelIndex &parent) const;

  virtual QVariant data(const QModelIndex &proxyIndex, int role) const;
  virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
signals:
  
public slots:

private:

  void refreshMap(Profile *profile);

private:

  std::map<int, std::vector<unsigned int> > m_GroupMap;

  std::map<unsigned int, unsigned int> m_RowIdxMap; // maps row to mod id
  std::map<unsigned int, unsigned int> m_IdxRowMap; // maps mod id to row

  mutable std::map<QPersistentModelIndex, QPersistentModelIndex> m_IndexMap;

};

#endif // MODLISTGROUPNEXUSIDPROXY_H