2018-02-06 Fred Gleason <fredg@paravelsystems.com>

* Refactored the RDPeaksExport class to use RDApplication.
This commit is contained in:
Fred Gleason 2018-02-06 06:54:12 -05:00
parent 6c976c71d7
commit 56ed436dc4
5 changed files with 15 additions and 19 deletions

View File

@ -16689,3 +16689,5 @@
* Refactored the RDEditAudio class to use RDApplication.
2018-02-06 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDExportSettingDialog class to use RDApplication.
2018-02-06 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDPeaksExport class to use RDApplication.

View File

@ -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));

View File

@ -2,7 +2,7 @@
//
// Export peak data using the RdXport Web Service
//
// (C) Copyright 2010,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2010,2016-2018 Fred Gleason <fredg@paravelsystems.com>
//
// 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 <qapplication.h>
#include <qobject.h>
#include <rd.h>
#include <rdxport_interface.h>
#include <rdformpost.h>
#include <rdpeaksexport.h>
#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))) {

View File

@ -2,7 +2,7 @@
//
// Export peak data using the RdXport Web Service
//
// (C) Copyright 2010,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2010,2016-2018 Fred Gleason <fredg@paravelsystems.com>
//
// 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 <qobject.h>
#include <rdconfig.h>
#include <rdstation.h>
#include <rdsettings.h>
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;

View File

@ -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());