QGIS API Documentation 3.41.0-Master (af5edcb665c)
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#include "moc_qgsexternalstorage.cpp"
18
19void QgsExternalStorageContent::reportError( const QString &errorMsg )
20{
22 mErrorString = errorMsg;
24}
25
30
32{
33 return mStatus;
34}
35
37{
38 return mErrorString;
39};
40
41QgsExternalStorageStoredContent *QgsExternalStorage::store( const QString &filePath, const QString &url, const QString &authCfg, Qgis::ActionStart storingMode ) const
42{
43 QgsExternalStorageStoredContent *content = doStore( filePath, url, authCfg );
44 if ( storingMode == Qgis::ActionStart::Immediate )
45 content->store();
46
47 return content;
48}
49
50QgsExternalStorageFetchedContent *QgsExternalStorage::fetch( const QString &url, const QString &authCfg, Qgis::ActionStart fetchingMode ) const
51{
52 QgsExternalStorageFetchedContent *content = doFetch( url, authCfg );
53 if ( fetchingMode == Qgis::ActionStart::Immediate )
54 content->fetch();
55
56 return content;
57}
ContentStatus
Status for fetched or stored content.
Definition qgis.h:1755
@ Failed
Content fetching/storing has failed.
ActionStart
Enum to determine when an operation would begin.
Definition qgis.h:1074
@ Immediate
Action will start immediately.
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.
Class for QgsExternalStorage fetched content.
virtual void fetch()=0
Starts fetching.
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.