QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsexternalstorage.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsexternalstorage.cpp
3 --------------------------------------
4 Date : March 2021
5 Copyright : (C) 2021 by Julien Cabieces
6 Email : julien dot cabieces at oslandia dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgsexternalstorage.h"
17
18#include "moc_qgsexternalstorage.cpp"
19
20void QgsExternalStorageContent::reportError( const QString &errorMsg )
21{
23 mErrorString = errorMsg;
25}
26
31
33{
34 return mStatus;
35}
36
38{
39 return mErrorString;
40};
41
42QgsExternalStorageStoredContent *QgsExternalStorage::store( const QString &filePath, const QString &url, const QString &authCfg, Qgis::ActionStart storingMode ) const
43{
44 QgsExternalStorageStoredContent *content = doStore( filePath, url, authCfg );
45 if ( storingMode == Qgis::ActionStart::Immediate )
46 content->store();
47
48 return content;
49}
50
51QgsExternalStorageFetchedContent *QgsExternalStorage::fetch( const QString &url, const QString &authCfg, Qgis::ActionStart fetchingMode ) const
52{
53 QgsExternalStorageFetchedContent *content = doFetch( url, authCfg );
54 if ( fetchingMode == Qgis::ActionStart::Immediate )
55 content->fetch();
56
57 return content;
58}
ContentStatus
Status for fetched or stored content.
Definition qgis.h:1845
@ Failed
Content fetching/storing has failed.
Definition qgis.h:1849
ActionStart
Enum to determine when an operation would begin.
Definition qgis.h:1143
@ Immediate
Action will start immediately.
Definition qgis.h:1145
void reportError(const QString &errorMsg)
Update content according to given errorMsg error message Inherited classes should call this method wh...
void setStatus(Qgis::ContentStatus status)
Sets the external storage status.
void errorOccurred(const QString &errorString)
The signal is emitted when an error occurred.
Qgis::ContentStatus status() const
Returns content status.
const QString & errorString() const
Returns error textual description if an error occurred and status() returns Failed.
Abstract base class for QgsExternalStorage fetched content.
virtual void fetch()=0
Starts fetching.
Abstract base class for QgsExternalStorage stored content.
virtual void store()=0
Starts storing.
virtual QgsExternalStorageFetchedContent * doFetch(const QString &url, const QString &authCfg=QString()) const =0
Fetches file from url using authCfg for this project external storage.
virtual QgsExternalStorageStoredContent * doStore(const QString &filePath, const QString &url, const QString &authCfg=QString()) const =0
Stores file filePath to the url using authCfg authentication for this project external storage.
QgsExternalStorageStoredContent * store(const QString &filePath, const QString &url, const QString &authCfg=QString(), Qgis::ActionStart storingMode=Qgis::ActionStart::Deferred) const
Stores file filePath to the url for this project external storage.
QgsExternalStorageFetchedContent * fetch(const QString &url, const QString &authCfg=QString(), Qgis::ActionStart fetchingMode=Qgis::ActionStart::Deferred) const
Fetches file from url for this project external storage.