AbstractProjectsModel
Qualified name: mv::AbstractProjectsModel
-
class AbstractProjectsModel : public mv::StandardItemModel
Abstract projects model class.
Base standard item model for projects.
- Author
Thomas Kroes
Subclassed by mv::ProjectsListModel, mv::ProjectsTreeModel
Public Types
-
enum class Column
Model columns.
Values:
-
enumerator Title
-
enumerator UUID
Title of the project.
-
enumerator IsVisible
Title of the project.
-
enumerator LastModified
Whether the project is visible in the model.
-
enumerator Downloaded
Last modified date of the project.
-
enumerator Group
Whether the project has been downloaded before.
-
enumerator IsGroup
Group title of the project.
-
enumerator Tags
Whether the item is a project group.
-
enumerator Date
Tags of the project.
-
enumerator IconName
Date of the project.
-
enumerator Summary
Icon name of the project.
-
enumerator Url
Summary of the project.
-
enumerator MinimumCoreVersion
URL of the project.
-
enumerator RequiredPlugins
Minimum ManiVault application core version.
-
enumerator MissingPlugins
Required plugins for the project.
-
enumerator DownloadSize
Missing plugins for the project.
-
enumerator SystemCompatibility
Download size of the ManiVault project.
-
enumerator IsStartup
System compatibility of the project.
-
enumerator ProjectsJsonDsn
Whether the project can be opened at application startup.
-
enumerator Count
Data Source Name (DSN) of the projects JSON file, used for loading the project.
Number of columns in the model
-
enumerator Title
Public Functions
-
AbstractProjectsModel(const PopulationMode &populationMode = PopulationMode::Automatic, QObject *parent = nullptr)
Construct with population
modeand pointer toparentobject.- Parameters:
populationMode – Population mode of the model (automatic/manual)
parent – Pointer to parent object
-
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override
Get header data for
section,orientationand displayrole.- Parameters:
section – Section
orientation – Orientation
role – Data role
- Returns:
Header
-
void populateFromJsonByteArray(const QByteArray &jsonByteArray, std::int32_t dsnIndex, const QString &jsonLocation)
Populate the model from the Data Source Names (DSN)
- Parameters:
jsonByteArray – Byte array containing the JSON data to populate from
dsnIndex – Index of the DSN to populate from
jsonLocation – Location of the JSON file
-
void populateFromJsonFile(const QString &filePath)
Populate the model from a JSON file at
filePath.- Parameters:
filePath – Path to the JSON file containing the projects data
-
void updateTags()
Builds a set of all project tags and emits ProjectDatabaseModel::tagsChanged(…)
-
QSet<QString> getTagsSet() const
Get tags.
- Returns:
All tags
-
util::ProjectsModelProjectSharedPtr getProject(const QModelIndex &index) const
Get the project at
index.- Returns:
Shared pointer to project at index
Add
project.- Parameters:
project – Shared pointer to project to add
parentIndex – Parent index to add the project to (defaults to root)
-
void removeProject(const QModelIndex &index)
Remove project with
indexfrom the model.- Parameters:
index – Index of the project to remove
-
void tagsChanged(const QSet<QString> &tags)
Signals that the tags changed to
tags.- Parameters:
tags – New tags
-
void aboutToBePopulated()
Signals that the model is about to be populated.
-
void populated()
Signals that the model has been re-populated.
Protected Functions
-
void beginPopulate()
Begin the population of the model.
Populate the model with the given projects.
- Parameters:
projects – Shared pointers to projects to populate the model with
-
void endPopulate()
End the population of the model.
-
class DateItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project date.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class DownloadedItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying whether the project has been downloaded before.
Public Functions
Construct with pointer
project.- Parameters:
project – Const pointer to project
editable – Boolean determining whether the item is editable or not
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
class DownloadSizeItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the download size.
Public Functions
Construct with pointer
project.- Parameters:
project – Const pointer to project
editable – Boolean determining whether the item is editable or not
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
class GroupItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project group title.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class IconNameItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project icon name.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class IsGroupItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying whether the item is a project group.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class IsStartupItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying whether the project is a startup project.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class IsVisibleItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project visibility.
Public Functions
Construct with pointer
project.- Parameters:
project – Const pointer to project
editable – Boolean determining whether the item is editable or not
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
-
void setData(const QVariant &value, int role) override
Set model data for
role.- Parameters:
value – Data value
role – Data role
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
class Item : public QStandardItem, public QObject
Base standard model item class for project.
Subclassed by mv::AbstractProjectsModel::DateItem, mv::AbstractProjectsModel::DownloadSizeItem, mv::AbstractProjectsModel::DownloadedItem, mv::AbstractProjectsModel::GroupItem, mv::AbstractProjectsModel::IconNameItem, mv::AbstractProjectsModel::IsGroupItem, mv::AbstractProjectsModel::IsStartupItem, mv::AbstractProjectsModel::IsVisibleItem, mv::AbstractProjectsModel::LastModifiedItem, mv::AbstractProjectsModel::MinimumCoreVersionItem, mv::AbstractProjectsModel::MissingPluginsItem, mv::AbstractProjectsModel::ProjectsJsonDsnItem, mv::AbstractProjectsModel::RequiredPluginsItem, mv::AbstractProjectsModel::SummaryItem, mv::AbstractProjectsModel::SystemCompatibilityItem, mv::AbstractProjectsModel::TagsItem, mv::AbstractProjectsModel::TitleItem, mv::AbstractProjectsModel::UUIDItem, mv::AbstractProjectsModel::UrlItem
Public Functions
Construct with shared pointer
project.- Parameters:
project – Shared pointer to project
editable – Boolean determining whether the item is editable or not
-
util::ProjectsModelProjectSharedPtr getProject() const
Get project return Shared pointer to the project.
-
class LastModifiedItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the download size.
Public Functions
Construct with pointer
project.- Parameters:
project – Const pointer to project
editable – Boolean determining whether the item is editable or not
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
class MinimumCoreVersionItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project minimum application core version.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class MissingPluginsItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying missing plugins.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class ProjectsJsonDsnItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying to which projects JSON DSN a row belongs.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class RequiredPluginsItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying required plugins.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class Row : public QList<QStandardItem*>
Convenience class for combining items in a row.
Public Functions
Construct with pointer to
projectobject.- Parameters:
project – Pointer to project object
-
class SummaryItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project summary.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class SystemCompatibilityItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the system compatibility with the project.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class TagsItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project tags.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class TitleItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project title.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class UrlItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project URL.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override
-
class UUIDItem : public mv::AbstractProjectsModel::Item
Standard model item class for displaying the project UUID.
Public Functions
-
QVariant data(int role = Qt::UserRole + 1) const override
Get model data for
role.- Returns:
Data for
rolein variant form
No need for custom constructor.
Public Static Functions
-
static inline QVariant headerData(Qt::Orientation orientation, int role)
Get header data for
orientationandrole.- Parameters:
orientation – Horizontal/vertical
role – Data role
- Returns:
Header data
-
QVariant data(int role = Qt::UserRole + 1) const override