QGIS API Documentation 4.1.0-Master (3b8ef1f72a3)
Loading...
Searching...
No Matches
qgsfileuploader.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfileuploader.h
3 --------------------------------------
4 Date : August 2025
5 Copyright : (C) 2025 by Valentin Buira
6 Email : valentin dot buira at gmail 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#ifndef QGSFILEUPLOADER_H
17#define QGSFILEUPLOADER_H
18
19#include "qgis.h"
20#include "qgis_core.h"
21
22#include <QFile>
23#include <QNetworkReply>
24#include <QObject>
25#include <QUrl>
26
41class CORE_EXPORT QgsFileUploader : public QObject
42{
43 Q_OBJECT
44 public:
54 QgsFileUploader( const QString &uploadFileName, const QUrl &url, const QString &formName = QString(), const QString &authcfg = QString(), bool delayStart = true );
55
56 signals:
58 void uploadCompleted( const QUrl &url );
61
67
69 void uploadError( QStringList errorMessages );
71 void uploadProgress( qint64 bytesSent, qint64 bytesTotal );
72
73 public slots:
74
80 void cancelUpload();
81
83 void startUpload();
84
85 private slots:
87 void onFinished();
89 void onUploadProgress( qint64 bytesSent, qint64 bytesTotal );
90
91
92 protected:
93 ~QgsFileUploader() override;
94
95 private:
100 void error( const QStringList &errorMessages );
101 void error( const QString &errorMessage );
102 QUrl mUrl;
103 QString mFormName;
104 QFile mFile;
105 bool mUploadCanceled;
106 QStringList mErrors;
107 QString mAuthCfg;
108};
109
110#endif // QGSFILEUPLOADER_H
void startUpload()
Called to start the upload.
void uploadExited()
Emitted always when the uploader exits.
void cancelUpload()
Call to abort the upload and delete this object after the cancellation has been processed.
void uploadError(QStringList errorMessages)
Emitted when an error makes the upload fail.
void uploadCompleted(const QUrl &url)
Emitted when the upload has completed successfully.
void uploadCanceled()
Emitted when the upload was canceled by the user.
QgsFileUploader(const QString &uploadFileName, const QUrl &url, const QString &formName=QString(), const QString &authcfg=QString(), bool delayStart=true)
QgsFileUploader.
void uploadProgress(qint64 bytesSent, qint64 bytesTotal)
Emitted when data are ready to be processed.