mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	desktop-widgets: use shared uploadDiveShare for diveshare.
Remove shared code from DiveShareExportDialog::doUpload() and add call to uploadDiveShare::doUpload() Remark signal handling is not implemented. Signed-off-by: Jan Iversen <jan@casacondor.com>
This commit is contained in:
		
							parent
							
								
									e3416fa152
								
							
						
					
					
						commit
						e5f3e927a7
					
				
					 1 changed files with 6 additions and 23 deletions
				
			
		|  | @ -6,6 +6,7 @@ | ||||||
| #include "desktop-widgets/subsurfacewebservices.h" | #include "desktop-widgets/subsurfacewebservices.h" | ||||||
| #include "core/qthelper.h" | #include "core/qthelper.h" | ||||||
| #include "core/cloudstorage.h" | #include "core/cloudstorage.h" | ||||||
|  | #include "core/uploadDiveShare.h" | ||||||
| #include "core/settings/qPrefCloudStorage.h" | #include "core/settings/qPrefCloudStorage.h" | ||||||
| 
 | 
 | ||||||
| #include <QDesktopServices> | #include <QDesktopServices> | ||||||
|  | @ -105,8 +106,10 @@ void DiveShareExportDialog::finishedSlot() | ||||||
| void DiveShareExportDialog::doUpload() | void DiveShareExportDialog::doUpload() | ||||||
| { | { | ||||||
| 	//Store current settings
 | 	//Store current settings
 | ||||||
| 	qPrefCloudStorage::set_diveshare_uid(ui->txtUID->text()); | 	QString uid = ui->txtUID->text(); | ||||||
| 	qPrefCloudStorage::set_diveshare_private(ui->chkPrivate->isChecked()); | 	bool noPublic = ui->chkPrivate->isChecked(); | ||||||
|  | 	qPrefCloudStorage::set_diveshare_uid(uid); | ||||||
|  | 	qPrefCloudStorage::set_diveshare_private(noPublic); | ||||||
| 
 | 
 | ||||||
| 	//Change UI into results mode
 | 	//Change UI into results mode
 | ||||||
| 	ui->frameConfigure->setVisible(false); | 	ui->frameConfigure->setVisible(false); | ||||||
|  | @ -114,25 +117,5 @@ void DiveShareExportDialog::doUpload() | ||||||
| 	ui->progressBar->setVisible(true); | 	ui->progressBar->setVisible(true); | ||||||
| 	ui->progressBar->setRange(0, 0); | 	ui->progressBar->setRange(0, 0); | ||||||
| 
 | 
 | ||||||
| 	//generate json
 | 	uploadDiveShare::instance()->doUpload(exportSelected, uid, noPublic); | ||||||
| 	struct membuffer buf = {}; |  | ||||||
| 	export_list(&buf, NULL, exportSelected, false); |  | ||||||
| 	QByteArray json_data(buf.buffer, buf.len); |  | ||||||
| 	free_buffer(&buf); |  | ||||||
| 
 |  | ||||||
| 	//Request to server
 |  | ||||||
| 	QNetworkRequest request; |  | ||||||
| 
 |  | ||||||
| 	if (ui->chkPrivate->isChecked()) |  | ||||||
| 		request.setUrl(QUrl(DIVESHARE_BASE_URI "/upload?private=true")); |  | ||||||
| 	else |  | ||||||
| 		request.setUrl(QUrl(DIVESHARE_BASE_URI "/upload")); |  | ||||||
| 
 |  | ||||||
| 	request.setRawHeader("User-Agent", getUserAgent().toUtf8()); |  | ||||||
| 	if (ui->txtUID->text().length() != 0) |  | ||||||
| 		request.setRawHeader("X-UID", ui->txtUID->text().toUtf8()); |  | ||||||
| 
 |  | ||||||
| 	reply = manager()->put(request, json_data); |  | ||||||
| 
 |  | ||||||
| 	QObject::connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot())); |  | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue