Skip to content

Class QfCloudProjectsModel

ClassList > QfCloudProjectsModel

Inherits the following classes: QAbstractListModel

Public Types

Type Name
enum ColumnRole
enum ProjectsRequestAttribute
Attributes controlling fetching of projects.

Public Properties

Type Name
property QSet< QString > busyProjectIds
Currently busy project ids.
property QfCloudConnection * cloudConnection
The current cloud connection.
property QfCloudProject * currentProject
The current cloud project. (null for non-cloud projects).
property QString currentProjectId
The current cloud project id of the currently opened project (empty string for non-cloud projects).
property QgsGpkgFlusher * gpkgFlusher
The current geopackage flusher.
property bool hasTemplates
property bool isCreating
Returns TRUE whether the model is creating a project.
property bool isRefreshing
Returns TRUE whether the model is being refreshed.
property QfLayerObserver * layerObserver
The current layer observer.

Public Signals

Type Name
signal void busyProjectIdsChanged
signal void cloudConnectionChanged
signal void currentProjectChanged
signal void currentProjectIdChanged
signal void gpkgFlusherChanged
signal void hasTemplatesChanged
signal void isCreatingChanged
signal void isRefreshingChanged
signal void layerObserverChanged
signal void projectAppended (const QString & projectId, const bool hasError=false, const QString & errorString=QString())
signal void projectCreated (const QString & projectId, const QString & fromProjectId, const bool hasError, const QString & errorString)
signal void projectDownloaded (const QString & projectId, const QString & projectName, const QString & projectOwner, const bool hasError=false, const QString & errorString=QString())
signal void projectUploaded (const QString & projectId)
signal void projectsAppended (const QString & owner, const QString & search, const bool hasError=false, const QString & errorString=QString())
signal void pushFinished (const QString & projectId, bool isDownloadingProject, bool hasError=false, const QString & errorString=QString())
signal void warning (const QString & message)

Public Functions

Type Name
QfCloudProjectsModel ()
Q_INVOKABLE void appendProject (const QString & projectId, bool forceRefresh=false)
Fetches a cloud project for a given projectId and appends it to the model.
Q_INVOKABLE void appendProjects (const QString & owner, const QString & search, int projectFetchOffset=0)
Fetches all cloud projects tied to a given search term and/or__owner name.
QSet< QString > busyProjectIds () const
Returns a set containing the currently busy project ids.
QfCloudConnection * cloudConnection () const
Returns the currently used cloud connection.
Q_INVOKABLE void createProject (const QString & name, const QString & fromProjectId=QString())
QfCloudProject * currentProject () const
Returns the cloud project of the currently oepened project or NULL for non-cloud projects.
QString currentProjectId () const
Returns the cloud project id of the currently opened project.
QVariant data (const QModelIndex & index, int role) override const
Returns the data at given index with given__role .
Q_INVOKABLE bool discardLocalChangesFromCurrentProject ()
Discards the delta records of the current cloud project.
Q_INVOKABLE QfCloudProject * findProject (const QString & projectId) const
Return the cloud project for a given projectId .
QgsGpkgFlusher * gpkgFlusher () const
Returns the geopackage flusher.
bool hasTemplates () const
bool isCreating () const
Returns TRUE whether the model is being refreshed.
bool isRefreshing () const
Returns TRUE whether the model is being refreshed.
QfLayerObserver * layerObserver () const
Returns the currently used layer observer.
Q_INVOKABLE void projectCancelDownload (const QString & projectId)
Cancels ongoing cloud project download with projectId .
Q_INVOKABLE void projectPackageAndDownload (const QString & projectId)
Downloads a cloud project with given projectId and all of its files.
Q_INVOKABLE void projectPush (const QString & projectId, const bool shouldDownloadUpdates)
Pushes all local deltas for given projectId . If__shouldDownloadUpdates is true, also callsdownloadProject .
Q_INVOKABLE void refreshProjectsList (bool shouldResetModel=true, int projectFetchOffset=0)
Q_INVOKABLE void removeLocalProject (const QString & projectId)
Remove local cloud project with given projectId from the device storage.
Q_INVOKABLE bool revertLocalChangesFromCurrentProject ()
Reverts the deltas of the current cloud project. The changes would applied in reverse order and opposite methods, e.g. "delete" becomes "create".
QHash< int, QByteArray > roleNames () override const
Returns the model role names.
int rowCount (const QModelIndex & parent) override const
Returns number of rows.
void setCloudConnection (QfCloudConnection * cloudConnection)
Sets the cloud connection.
void setCurrentProjectId (const QString & currentProjectId)
Sets the cloud project id of the currently opened project.
void setGpkgFlusher (QgsGpkgFlusher * flusher)
Sets the geopackage flusher.
void setLayerObserver (QfLayerObserver * layerObserver)
Sets the layer observer.
Q_INVOKABLE QStringList uniqueOwners () const
Returns a list of unique project owners, excluding projects where the user has access only through public visibility.

Public Types Documentation

enum ColumnRole

enum QfCloudProjectsModel::ColumnRole {
    IdRole = Qt::UserRole + 1,
    OwnerRole,
    PublicRole,
    FeaturedRole,
    NameRole,
    DescriptionRole,
    ModificationRole,
    CheckoutRole,
    StatusRole,
    ProjectOutdatedRole,
    ProjectFileOutdatedRole,
    ErrorStatusRole,
    ErrorStringRole,
    DownloadProgressRole,
    DownloadSizeRole,
    PackagingStatusRole,
    PackagedLayerErrorsRole,
    PushDeltaProgressRole,
    PushDeltaStatusRole,
    PushDeltaStatusStringRole,
    LocalDeltasCountRole,
    LocalPathRole,
    LastLocalExportedAtRole,
    LastLocalPushDeltasRole,
    UserRoleRole,
    UserRoleOriginRole,
    ProjectTypeRole
};

enum ProjectsRequestAttribute

Attributes controlling fetching of projects.

enum QfCloudProjectsModel::ProjectsRequestAttribute {
    FetchPublicProjects = QNetworkRequest::User + 1,
    ProjectsFetchOffset = QNetworkRequest::User + 2,
    ResetModel = QNetworkRequest::User + 3,
    ProjectId = QNetworkRequest::User + 4,
    ProjectOwnerName = QNetworkRequest::User + 5,
    ProjectSearchTerm = QNetworkRequest::User + 6,
    FromProjectId = QNetworkRequest::User + 7
};


Public Properties Documentation

property busyProjectIds [1/2]

Currently busy project ids.

QSet<QString> QfCloudProjectsModel::busyProjectIds;


property cloudConnection [1/2]

The current cloud connection.

QfCloudConnection * QfCloudProjectsModel::cloudConnection;


property currentProject [1/2]

The current cloud project. (null for non-cloud projects).

QfCloudProject * QfCloudProjectsModel::currentProject;


property currentProjectId [1/2]

The current cloud project id of the currently opened project (empty string for non-cloud projects).

QString QfCloudProjectsModel::currentProjectId;


property gpkgFlusher [1/2]

The current geopackage flusher.

QgsGpkgFlusher * QfCloudProjectsModel::gpkgFlusher;


property hasTemplates [1/2]

bool QfCloudProjectsModel::hasTemplates;

property isCreating [1/2]

Returns TRUE whether the model is creating a project.

bool QfCloudProjectsModel::isCreating;


property isRefreshing [1/2]

Returns TRUE whether the model is being refreshed.

bool QfCloudProjectsModel::isRefreshing;


property layerObserver [1/2]

The current layer observer.

QfLayerObserver * QfCloudProjectsModel::layerObserver;


Public Signals Documentation

signal busyProjectIdsChanged

void QfCloudProjectsModel::busyProjectIdsChanged;

signal cloudConnectionChanged

void QfCloudProjectsModel::cloudConnectionChanged;

signal currentProjectChanged

void QfCloudProjectsModel::currentProjectChanged;

signal currentProjectIdChanged

void QfCloudProjectsModel::currentProjectIdChanged;

signal gpkgFlusherChanged

void QfCloudProjectsModel::gpkgFlusherChanged;

signal hasTemplatesChanged

void QfCloudProjectsModel::hasTemplatesChanged;

signal isCreatingChanged

void QfCloudProjectsModel::isCreatingChanged;

signal isRefreshingChanged

void QfCloudProjectsModel::isRefreshingChanged;

signal layerObserverChanged

void QfCloudProjectsModel::layerObserverChanged;

signal projectAppended

void QfCloudProjectsModel::projectAppended;

signal projectCreated

void QfCloudProjectsModel::projectCreated;

signal projectDownloaded

void QfCloudProjectsModel::projectDownloaded;

signal projectUploaded

void QfCloudProjectsModel::projectUploaded;

signal projectsAppended

void QfCloudProjectsModel::projectsAppended;

signal pushFinished

void QfCloudProjectsModel::pushFinished;

signal warning

void QfCloudProjectsModel::warning;

Public Functions Documentation

function QfCloudProjectsModel

QfCloudProjectsModel::QfCloudProjectsModel () 

function appendProject

Fetches a cloud project for a given projectId and appends it to the model.

Q_INVOKABLE void QfCloudProjectsModel::appendProject (
    const QString & projectId,
    bool forceRefresh=false
) 


function appendProjects

Fetches all cloud projects tied to a given search term and/or__owner name.

Q_INVOKABLE void QfCloudProjectsModel::appendProjects (
    const QString & owner,
    const QString & search,
    int projectFetchOffset=0
) 


function busyProjectIds [2/2]

Returns a set containing the currently busy project ids.

QSet< QString > QfCloudProjectsModel::busyProjectIds () const


function cloudConnection [2/2]

Returns the currently used cloud connection.

QfCloudConnection * QfCloudProjectsModel::cloudConnection () const


function createProject

Q_INVOKABLE void QfCloudProjectsModel::createProject (
    const QString & name,
    const QString & fromProjectId=QString()
) 

Transform a locally-stored project into a cloud project by uploading its content to the QFieldCloud server.

The converted project will then be removed from the local storage in favor of a newly packaged cloud project downloaded from the server.


function currentProject [2/2]

Returns the cloud project of the currently oepened project or NULL for non-cloud projects.

QfCloudProject * QfCloudProjectsModel::currentProject () const


function currentProjectId [2/2]

Returns the cloud project id of the currently opened project.

QString QfCloudProjectsModel::currentProjectId () const


function data

Returns the data at given index with given__role .

QVariant QfCloudProjectsModel::data (
    const QModelIndex & index,
    int role
) override const


function discardLocalChangesFromCurrentProject

Discards the delta records of the current cloud project.

Q_INVOKABLE bool QfCloudProjectsModel::discardLocalChangesFromCurrentProject () 


function findProject

Return the cloud project for a given projectId .

Q_INVOKABLE QfCloudProject * QfCloudProjectsModel::findProject (
    const QString & projectId
) const


function gpkgFlusher [2/2]

Returns the geopackage flusher.

inline QgsGpkgFlusher * QfCloudProjectsModel::gpkgFlusher () const


function hasTemplates [2/2]

bool QfCloudProjectsModel::hasTemplates () const

Returns TRUE if the source model contains at least one template project, regardless of the currently applied filters.


function isCreating [2/2]

Returns TRUE whether the model is being refreshed.

inline bool QfCloudProjectsModel::isCreating () const


function isRefreshing [2/2]

Returns TRUE whether the model is being refreshed.

inline bool QfCloudProjectsModel::isRefreshing () const


function layerObserver [2/2]

Returns the currently used layer observer.

QfLayerObserver * QfCloudProjectsModel::layerObserver () const


function projectCancelDownload

Cancels ongoing cloud project download with projectId .

Q_INVOKABLE void QfCloudProjectsModel::projectCancelDownload (
    const QString & projectId
) 


function projectPackageAndDownload

Downloads a cloud project with given projectId and all of its files.

Q_INVOKABLE void QfCloudProjectsModel::projectPackageAndDownload (
    const QString & projectId
) 


function projectPush

Pushes all local deltas for given projectId . If__shouldDownloadUpdates is true, also callsdownloadProject .

Q_INVOKABLE void QfCloudProjectsModel::projectPush (
    const QString & projectId,
    const bool shouldDownloadUpdates
) 


function refreshProjectsList

Q_INVOKABLE void QfCloudProjectsModel::refreshProjectsList (
    bool shouldResetModel=true,
    int projectFetchOffset=0
) 

Requests the cloud projects list from the server.

Parameters:

  • shouldResetModel set to TRUE to reset the model
  • projectFetchOffset offset for pagination

function removeLocalProject

Remove local cloud project with given projectId from the device storage.

Q_INVOKABLE void QfCloudProjectsModel::removeLocalProject (
    const QString & projectId
) 


function revertLocalChangesFromCurrentProject

Reverts the deltas of the current cloud project. The changes would applied in reverse order and opposite methods, e.g. "delete" becomes "create".

Q_INVOKABLE bool QfCloudProjectsModel::revertLocalChangesFromCurrentProject () 


function roleNames

Returns the model role names.

QHash< int, QByteArray > QfCloudProjectsModel::roleNames () override const


function rowCount

Returns number of rows.

int QfCloudProjectsModel::rowCount (
    const QModelIndex & parent
) override const


function setCloudConnection

Sets the cloud connection.

void QfCloudProjectsModel::setCloudConnection (
    QfCloudConnection * cloudConnection
) 


function setCurrentProjectId

Sets the cloud project id of the currently opened project.

void QfCloudProjectsModel::setCurrentProjectId (
    const QString & currentProjectId
) 


function setGpkgFlusher

Sets the geopackage flusher.

void QfCloudProjectsModel::setGpkgFlusher (
    QgsGpkgFlusher * flusher
) 


function setLayerObserver

Sets the layer observer.

void QfCloudProjectsModel::setLayerObserver (
    QfLayerObserver * layerObserver
) 


function uniqueOwners

Returns a list of unique project owners, excluding projects where the user has access only through public visibility.

Q_INVOKABLE QStringList QfCloudProjectsModel::uniqueOwners () const



The documentation for this class was generated from the following file src/core/qfieldcloud/qfcloudprojectsmodel.h