Class QFieldCloudProjectsModel
ClassList > QFieldCloudProjectsModel
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 QFieldCloudConnection * | cloudConnection The current cloud connection. |
| property QFieldCloudProject * | 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 | isCreating Returns TRUE whether the model is creating a project. |
| property bool | isRefreshing Returns TRUE whether the model is being refreshed. |
| property LayerObserver * | layerObserver The current layer observer. |
Public Signals
| Type | Name |
|---|---|
| signal void | busyProjectIdsChanged |
| signal void | cloudConnectionChanged |
| signal void | currentProjectChanged |
| signal void | currentProjectIdChanged |
| signal void | deltaListModelChanged |
| signal void | gpkgFlusherChanged |
| 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 bool hasError=false, const QString & errorString=QString()) |
| signal void | projectDownloaded (const QString & projectId, const QString & projectName, const bool hasError=false, const QString & errorString=QString()) |
| signal void | projectUploaded (const QString & projectId) |
| 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 |
|---|---|
| QFieldCloudProjectsModel () |
|
| Q_INVOKABLE void | appendProject (const QString & projectId) Fetches a cloud project for a given projectId and appends it to the model. |
| QSet< QString > | busyProjectIds () const Returns a set containing the currently busy project ids. |
| QFieldCloudConnection * | cloudConnection () const Returns the currently used cloud connection. |
| Q_INVOKABLE void | createProject (const QString name) |
| QFieldCloudProject * | 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 QFieldCloudProject * | findProject (const QString & projectId) const Return the cloud project for a given projectId . |
| QgsGpkgFlusher * | gpkgFlusher () const Returns the geopackage flusher. |
| bool | isCreating () const Returns TRUE whether the model is being refreshed. |
| bool | isRefreshing () const Returns TRUE whether the model is being refreshed. |
| LayerObserver * | 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 calls downloadProject . |
| Q_INVOKABLE void | refreshProjectDeltaList (const QString & projectId) Retreives the delta list for a given projectId . |
| Q_INVOKABLE void | refreshProjectFileOutdatedStatus (const QString & projectId) Refreshes the project file (.qgs, .qgz) outdated status. |
| Q_INVOKABLE void | refreshProjectsList (bool shouldResetModel=true, bool shouldFetchPublic=false, 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 (QFieldCloudConnection * 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 (LayerObserver * layerObserver) Sets the layer observer. |
| Q_INVOKABLE void | updateLocalizedDataPaths (const QString & projectPath) Configure localized data paths for cloud projects when available. |
Public Types Documentation
enum ColumnRole
enum QFieldCloudProjectsModel::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,
DeltaListRole
};
enum ProjectsRequestAttribute
Attributes controlling fetching of projects.
enum QFieldCloudProjectsModel::ProjectsRequestAttribute {
FetchPublicProjects = QNetworkRequest::User + 1,
ProjectsFetchOffset = QNetworkRequest::User + 2,
ResetModel = QNetworkRequest::User + 3,
ProjectId = QNetworkRequest::User + 4
};
Public Properties Documentation
property busyProjectIds [1/2]
Currently busy project ids.
QSet<QString> QFieldCloudProjectsModel::busyProjectIds;
property cloudConnection [1/2]
The current cloud connection.
QFieldCloudConnection * QFieldCloudProjectsModel::cloudConnection;
property currentProject [1/2]
The current cloud project. (null for non-cloud projects).
QFieldCloudProject * QFieldCloudProjectsModel::currentProject;
property currentProjectId [1/2]
The current cloud project id of the currently opened project (empty string for non-cloud projects).
QString QFieldCloudProjectsModel::currentProjectId;
property gpkgFlusher [1/2]
The current geopackage flusher.
QgsGpkgFlusher * QFieldCloudProjectsModel::gpkgFlusher;
property isCreating [1/2]
Returns TRUE whether the model is creating a project.
bool QFieldCloudProjectsModel::isCreating;
property isRefreshing [1/2]
Returns TRUE whether the model is being refreshed.
bool QFieldCloudProjectsModel::isRefreshing;
property layerObserver [1/2]
The current layer observer.
LayerObserver * QFieldCloudProjectsModel::layerObserver;
Public Signals Documentation
signal busyProjectIdsChanged
void QFieldCloudProjectsModel::busyProjectIdsChanged;
signal cloudConnectionChanged
void QFieldCloudProjectsModel::cloudConnectionChanged;
signal currentProjectChanged
void QFieldCloudProjectsModel::currentProjectChanged;
signal currentProjectIdChanged
void QFieldCloudProjectsModel::currentProjectIdChanged;
signal deltaListModelChanged
void QFieldCloudProjectsModel::deltaListModelChanged;
signal gpkgFlusherChanged
void QFieldCloudProjectsModel::gpkgFlusherChanged;
signal isCreatingChanged
void QFieldCloudProjectsModel::isCreatingChanged;
signal isRefreshingChanged
void QFieldCloudProjectsModel::isRefreshingChanged;
signal layerObserverChanged
void QFieldCloudProjectsModel::layerObserverChanged;
signal projectAppended
void QFieldCloudProjectsModel::projectAppended;
signal projectCreated
void QFieldCloudProjectsModel::projectCreated;
signal projectDownloaded
void QFieldCloudProjectsModel::projectDownloaded;
signal projectUploaded
void QFieldCloudProjectsModel::projectUploaded;
signal pushFinished
void QFieldCloudProjectsModel::pushFinished;
signal warning
void QFieldCloudProjectsModel::warning;
Public Functions Documentation
function QFieldCloudProjectsModel
QFieldCloudProjectsModel::QFieldCloudProjectsModel ()
function appendProject
Fetches a cloud project for a given projectId and appends it to the model.
Q_INVOKABLE void QFieldCloudProjectsModel::appendProject (
const QString & projectId
)
function busyProjectIds [2/2]
Returns a set containing the currently busy project ids.
QSet< QString > QFieldCloudProjectsModel::busyProjectIds () const
function cloudConnection [2/2]
Returns the currently used cloud connection.
QFieldCloudConnection * QFieldCloudProjectsModel::cloudConnection () const
function createProject
Q_INVOKABLE void QFieldCloudProjectsModel::createProject (
const QString name
)
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.
QFieldCloudProject * QFieldCloudProjectsModel::currentProject () const
function currentProjectId [2/2]
Returns the cloud project id of the currently opened project.
QString QFieldCloudProjectsModel::currentProjectId () const
function data
Returns the data at given index with given__role .
QVariant QFieldCloudProjectsModel::data (
const QModelIndex & index,
int role
) override const
function discardLocalChangesFromCurrentProject
Discards the delta records of the current cloud project.
Q_INVOKABLE bool QFieldCloudProjectsModel::discardLocalChangesFromCurrentProject ()
function findProject
Return the cloud project for a given projectId .
Q_INVOKABLE QFieldCloudProject * QFieldCloudProjectsModel::findProject (
const QString & projectId
) const
function gpkgFlusher [2/2]
Returns the geopackage flusher.
inline QgsGpkgFlusher * QFieldCloudProjectsModel::gpkgFlusher () const
function isCreating [2/2]
Returns TRUE whether the model is being refreshed.
inline bool QFieldCloudProjectsModel::isCreating () const
function isRefreshing [2/2]
Returns TRUE whether the model is being refreshed.
inline bool QFieldCloudProjectsModel::isRefreshing () const
function layerObserver [2/2]
Returns the currently used layer observer.
LayerObserver * QFieldCloudProjectsModel::layerObserver () const
function projectCancelDownload
Cancels ongoing cloud project download with projectId .
Q_INVOKABLE void QFieldCloudProjectsModel::projectCancelDownload (
const QString & projectId
)
function projectPackageAndDownload
Downloads a cloud project with given projectId and all of its files.
Q_INVOKABLE void QFieldCloudProjectsModel::projectPackageAndDownload (
const QString & projectId
)
function projectPush
Pushes all local deltas for given projectId . If__shouldDownloadUpdates is true, also callsdownloadProject .
Q_INVOKABLE void QFieldCloudProjectsModel::projectPush (
const QString & projectId,
const bool shouldDownloadUpdates
)
function refreshProjectDeltaList
Retreives the delta list for a given projectId .
Q_INVOKABLE void QFieldCloudProjectsModel::refreshProjectDeltaList (
const QString & projectId
)
function refreshProjectFileOutdatedStatus
Refreshes the project file (.qgs, .qgz) outdated status.
Q_INVOKABLE void QFieldCloudProjectsModel::refreshProjectFileOutdatedStatus (
const QString & projectId
)
function refreshProjectsList
Q_INVOKABLE void QFieldCloudProjectsModel::refreshProjectsList (
bool shouldResetModel=true,
bool shouldFetchPublic=false,
int projectFetchOffset=0
)
Requests the cloud projects list from the server.
Parameters:
shouldResetModelset to TRUE to reset the modelshouldFetchPublicset to TRUE to refresh public projectsprojectFetchOffsetoffset for pagination
function removeLocalProject
Remove local cloud project with given projectId from the device storage.
Q_INVOKABLE void QFieldCloudProjectsModel::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 QFieldCloudProjectsModel::revertLocalChangesFromCurrentProject ()
function roleNames
Returns the model role names.
QHash< int, QByteArray > QFieldCloudProjectsModel::roleNames () override const
function rowCount
Returns number of rows.
int QFieldCloudProjectsModel::rowCount (
const QModelIndex & parent
) override const
function setCloudConnection
Sets the cloud connection.
void QFieldCloudProjectsModel::setCloudConnection (
QFieldCloudConnection * cloudConnection
)
function setCurrentProjectId
Sets the cloud project id of the currently opened project.
void QFieldCloudProjectsModel::setCurrentProjectId (
const QString & currentProjectId
)
function setGpkgFlusher
Sets the geopackage flusher.
void QFieldCloudProjectsModel::setGpkgFlusher (
QgsGpkgFlusher * flusher
)
function setLayerObserver
Sets the layer observer.
void QFieldCloudProjectsModel::setLayerObserver (
LayerObserver * layerObserver
)
function updateLocalizedDataPaths
Configure localized data paths for cloud projects when available.
Q_INVOKABLE void QFieldCloudProjectsModel::updateLocalizedDataPaths (
const QString & projectPath
)
The documentation for this class was generated from the following file src/core/qfieldcloud/qfieldcloudprojectsmodel.h