• InstalledListModel
  • InstalledListModel Class

    class ScreenPlay::InstalledListModel

    Lists all installed wallpapers, widgets etc. from a given Path. More...

    Header: #include <InstalledListModel>

    Public Functions

    InstalledListModel(const std::shared_ptr<GlobalVariables> &globalVariables, QObject *parent = nullptr)
    int count() const

    Reimplemented Public Functions

    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
    virtual QHash<int, QByteArray> roleNames() const override
    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override

    Public Slots

    void append(const QJsonObject &obj, const QString &folderName, const QDateTime &lastModified)
    bool deinstallItemAt(const int index)
    QVariantMap get(const QString &folderId) const
    void init()
    void loadInstalledContent()
    void reset()
    void setCount(int count)

    Signals

    void countChanged(int count)

    Detailed Description

    Currently we only support one path for the user content. Via a QFileSystemWatcher we automatically reload the list. Dynamic insert and remove is not yet implemented. Otherwhise it is a regular QAbstractListModel based list model.

    Member Function Documentation

    InstalledListModel::InstalledListModel(const std::shared_ptr<GlobalVariables> &globalVariables, QObject *parent = nullptr)

    Constructor.

    [slot] void InstalledListModel::append(const QJsonObject &obj, const QString &folderName, const QDateTime &lastModified)

    Append an ProjectFile to the list.

    [slot] bool InstalledListModel::deinstallItemAt(const int index)

    Deleted the item from the local storage and removes it from the installed list.

    [slot] QVariantMap InstalledListModel::get(const QString &folderId) const

    .

    [slot] void InstalledListModel::init()

    Init function that needs to be called after the constructor because we need the GlobalVariables to finish loading.

    [slot] void InstalledListModel::loadInstalledContent()

    Loads all installed content. Skips projects.json without a "type" field.

    [slot] void InstalledListModel::reset()

    .

    [override virtual] QVariant InstalledListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

    Retruns the data member of the ProjectFile.

    [override virtual] QHash<int, QByteArray> InstalledListModel::roleNames() const

    Returns the variable names for QML.

    [override virtual] int InstalledListModel::rowCount(const QModelIndex &parent = QModelIndex()) const

    Returns the length of the installed items.