Limo
A simple mod manager
Loading...
Searching...
No Matches
deployerlistmodel.h
Go to the documentation of this file.
1
5
6#pragma once
7
9#include <QAbstractTableModel>
10#include <QColor>
11
12
16class DeployerListModel : public QAbstractTableModel
17{
18 Q_OBJECT
19
20public:
25 explicit DeployerListModel(QObject* parent = nullptr);
26
28 static constexpr int status_col = 0;
30 static constexpr int name_col = 1;
32 static constexpr int id_col = 2;
34 static constexpr int tags_col = 3;
35
37 static constexpr int mod_status_role = 300;
39 static constexpr int mod_tags_role = 301;
41 static constexpr int ids_are_source_references_role = 302;
43 static constexpr int source_mod_name_role = 303;
45 static constexpr int valid_mod_actions_role = 304;
46
54 QVariant headerData(int section,
55 Qt::Orientation orientation,
56 int role = Qt::DisplayRole) const override;
62 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
68 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
79 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
84 void setDeployerInfo(const DeployerInfo& info);
89 bool hasSeparateDirs() const;
94 bool hasIgnoredFiles() const;
95
96private:
100 std::map<int, QBrush> text_colors_;
102 std::vector<std::vector<std::string>> tags_;
103};
static constexpr int valid_mod_actions_role
Role representing a list of valid mod actions.
Definition deployerlistmodel.h:45
std::vector< std::vector< std::string > > tags_
For every mod: A vector containing every tag added to that mod.
Definition deployerlistmodel.h:102
bool hasIgnoredFiles() const
Only for ReverseDeployers: Whether or not the deployer's ignore list contains files.
Definition deployerlistmodel.cpp:168
void setDeployerInfo(const DeployerInfo &info)
Updates all data stored in this model with the given data.
Definition deployerlistmodel.cpp:131
static constexpr int id_col
Index of the mod id column.
Definition deployerlistmodel.h:32
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns to display.
Definition deployerlistmodel.cpp:44
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns the horizontal header section names and vertical header section indices.
Definition deployerlistmodel.cpp:14
DeployerInfo deployer_info_
Contains all mods managed by this model.
Definition deployerlistmodel.h:98
std::map< int, QBrush > text_colors_
Maps mod ids to the color used to display their names.
Definition deployerlistmodel.h:100
static constexpr int name_col
Index of the mod name column.
Definition deployerlistmodel.h:30
static constexpr int mod_status_role
Role representing the activation status of a mod.
Definition deployerlistmodel.h:37
static constexpr int status_col
Index of the mod status column.
Definition deployerlistmodel.h:28
DeployerListModel(QObject *parent=nullptr)
Constructor.
Definition deployerlistmodel.cpp:12
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows to display.
Definition deployerlistmodel.cpp:39
static constexpr int source_mod_name_role
Role representing the name of the source mod.
Definition deployerlistmodel.h:43
static constexpr int mod_tags_role
Role representing all tags added to a mod.
Definition deployerlistmodel.h:39
bool hasSeparateDirs() const
Only for ReverseDeployers: Whether or not profiles use separate directories.
Definition deployerlistmodel.cpp:163
static constexpr int tags_col
Index of the tags column.
Definition deployerlistmodel.h:34
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Used to access the data stored in this model.
Definition deployerlistmodel.cpp:49
static constexpr int ids_are_source_references_role
Rile representing whether ids are references to source mods.
Definition deployerlistmodel.h:41
Contains the DeployerInfo struct.
Stores a deployer's installed mods and load order.
Definition deployerinfo.h:17