From 56ed436dc407c21fa5afed88c9413d7e86653d23 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 6 Feb 2018 06:54:12 -0500 Subject: [PATCH] 2018-02-06 Fred Gleason * Refactored the RDPeaksExport class to use RDApplication. --- ChangeLog | 2 ++ lib/rdedit_audio.cpp | 2 +- lib/rdpeaksexport.cpp | 20 +++++++++----------- lib/rdpeaksexport.h | 8 ++------ lib/rdwavepainter.cpp | 2 +- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a3d0f61..a3ded1cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16689,3 +16689,5 @@ * Refactored the RDEditAudio class to use RDApplication. 2018-02-06 Fred Gleason * Refactored the RDExportSettingDialog class to use RDApplication. +2018-02-06 Fred Gleason + * Refactored the RDPeaksExport class to use RDApplication. diff --git a/lib/rdedit_audio.cpp b/lib/rdedit_audio.cpp index a86e8c1e..64480f49 100644 --- a/lib/rdedit_audio.cpp +++ b/lib/rdedit_audio.cpp @@ -746,7 +746,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, // // The Wave Forms // - edit_peaks=new RDPeaksExport(rda->station(),rda->config(),this); + edit_peaks=new RDPeaksExport(this); RDPeaksExport::ErrorCode conv_err; edit_peaks->setCartNumber(RDCut::cartNumber(cut_name)); edit_peaks->setCutNumber(RDCut::cutNumber(cut_name)); diff --git a/lib/rdpeaksexport.cpp b/lib/rdpeaksexport.cpp index 8f983279..241341de 100644 --- a/lib/rdpeaksexport.cpp +++ b/lib/rdpeaksexport.cpp @@ -2,7 +2,7 @@ // // Export peak data using the RdXport Web Service // -// (C) Copyright 2010,2016 Fred Gleason +// (C) Copyright 2010,2016-2018 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -32,10 +32,11 @@ #include #include -#include -#include -#include -#include +#include "rd.h" +#include "rdapplication.h" +#include "rdxport_interface.h" +#include "rdformpost.h" +#include "rdpeaksexport.h" // // LibCURL Write Callback @@ -63,11 +64,8 @@ RDPeaksExport::~RDPeaksExport() } -RDPeaksExport::RDPeaksExport(RDStation *station,RDConfig *config, - QObject *parent) +RDPeaksExport::RDPeaksExport(QObject *parent) { - conv_station=station; - conv_config=config; conv_cart_number=0; conv_cut_number=0; conv_energy_data=NULL; @@ -117,14 +115,14 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username, // otherwise some versions of LibCurl will throw a 'bad/illegal format' // error. // - strncpy(url,conv_station->webServiceUrl(conv_config),1024); + strncpy(url,rda->station()->webServiceUrl(rda->config()),1024); curl_easy_setopt(curl,CURLOPT_URL,url); curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)conv_config->userAgent()); + (const char *)rda->config()->userAgent()); //curl_easy_setopt(curl,CURLOPT_VERBOSE,1); switch((curl_err=curl_easy_perform(curl))) { diff --git a/lib/rdpeaksexport.h b/lib/rdpeaksexport.h index 4a71b0ae..1a8b1672 100644 --- a/lib/rdpeaksexport.h +++ b/lib/rdpeaksexport.h @@ -2,7 +2,7 @@ // // Export peak data using the RdXport Web Service // -// (C) Copyright 2010,2016 Fred Gleason +// (C) Copyright 2010,2016-2018 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -23,8 +23,6 @@ #include -#include -#include #include class RDPeaksExport @@ -33,7 +31,7 @@ class RDPeaksExport enum ErrorCode {ErrorOk=0,ErrorNoSource=2, ErrorInternal=5,ErrorUrlInvalid=7, ErrorService=8,ErrorInvalidUser=9,ErrorAborted=10}; - RDPeaksExport(RDStation *station,RDConfig *config,QObject *parent=0); + RDPeaksExport(QObject *parent=0); ~RDPeaksExport(); void setCartNumber(unsigned cartnum); void setCutNumber(unsigned cutnum); @@ -45,8 +43,6 @@ class RDPeaksExport static QString errorText(RDPeaksExport::ErrorCode err); private: - RDStation *conv_station; - RDConfig *conv_config; unsigned conv_cart_number; unsigned conv_cut_number; unsigned short *conv_energy_data; diff --git a/lib/rdwavepainter.cpp b/lib/rdwavepainter.cpp index 4032f896..13b9da8a 100644 --- a/lib/rdwavepainter.cpp +++ b/lib/rdwavepainter.cpp @@ -236,7 +236,7 @@ void RDWavePainter::LoadWave() if(wave_peaks!=NULL) { delete wave_peaks; } - wave_peaks=new RDPeaksExport(wave_station,wave_config); + wave_peaks=new RDPeaksExport(); wave_peaks->setCartNumber(wave_cut->cartNumber()); wave_peaks->setCutNumber(wave_cut->cutNumber()); wave_peaks->runExport(wave_user->name(),wave_user->password());