mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-12 07:35:55 +01:00
2018-02-04 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDAudioImport class to use RDApplication.
This commit is contained in:
@@ -32,10 +32,11 @@
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <rd.h>
|
||||
#include <rdxport_interface.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rdapplication.h>
|
||||
#include <rdaudioimport.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rdwebresult.h>
|
||||
#include <rdxport_interface.h>
|
||||
|
||||
//
|
||||
// CURL Callbacks
|
||||
@@ -62,12 +63,9 @@ int ImportProgressCallback(void *clientp,double dltotal,double dlnow,
|
||||
}
|
||||
|
||||
|
||||
RDAudioImport::RDAudioImport(RDStation *station,RDConfig *config,
|
||||
QObject *parent)
|
||||
RDAudioImport::RDAudioImport(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
conv_station=station;
|
||||
conv_config=config;
|
||||
conv_cart_number=0;
|
||||
conv_cut_number=0;
|
||||
conv_settings=NULL;
|
||||
@@ -170,7 +168,7 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username,
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout);
|
||||
curl_easy_setopt(curl,CURLOPT_HTTPPOST,first);
|
||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||
(const char *)conv_config->userAgent());
|
||||
(const char *)rda->config()->userAgent());
|
||||
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
|
||||
curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,ImportProgressCallback);
|
||||
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);
|
||||
@@ -182,7 +180,7 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(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);
|
||||
|
||||
//
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Import an Audio File using the RdXport Web Service
|
||||
//
|
||||
// (C) Copyright 2010-2014,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2010-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>
|
||||
#include <rdaudioconvert.h>
|
||||
|
||||
@@ -36,7 +34,7 @@ class RDAudioImport : public QObject
|
||||
ErrorNoDestination=3,ErrorInternal=5,ErrorUrlInvalid=7,
|
||||
ErrorService=8,ErrorInvalidUser=9,ErrorAborted=10,
|
||||
ErrorConverter=11};
|
||||
RDAudioImport(RDStation *station,RDConfig *config,QObject *parent=0);
|
||||
RDAudioImport(QObject *parent=0);
|
||||
void setCartNumber(unsigned cartnum);
|
||||
void setCutNumber(unsigned cutnum);
|
||||
void setSourceFile(const QString &filename);
|
||||
@@ -53,8 +51,6 @@ class RDAudioImport : public QObject
|
||||
void abort();
|
||||
|
||||
private:
|
||||
RDStation *conv_station;
|
||||
RDConfig *conv_config;
|
||||
unsigned conv_cart_number;
|
||||
unsigned conv_cut_number;
|
||||
QString conv_src_filename;
|
||||
|
||||
@@ -577,7 +577,7 @@ void RDCartDialog::loadFileData()
|
||||
// Import Audio
|
||||
//
|
||||
cart_busy_dialog->show(tr("Importing"),tr("Importing..."));
|
||||
conv=new RDAudioImport(cart_station,cart_config,this);
|
||||
conv=new RDAudioImport(this);
|
||||
conv->setCartNumber(cartnum);
|
||||
conv->setCutNumber(1);
|
||||
conv->setSourceFile(filename);
|
||||
|
||||
@@ -544,7 +544,7 @@ void RDImportAudio::Import()
|
||||
//
|
||||
StartBar();
|
||||
RDCut *cut=new RDCut(import_cutname);
|
||||
import_import_conv=new RDAudioImport(import_station,import_config,this);
|
||||
import_import_conv=new RDAudioImport(this);
|
||||
import_import_conv->setCartNumber(cut->cartNumber());
|
||||
import_import_conv->setCutNumber(cut->cutNumber());
|
||||
import_import_conv->setSourceFile(import_in_filename_edit->text());
|
||||
|
||||
@@ -602,7 +602,7 @@ bool RDRenderer::ImportCart(const QString &srcfile,unsigned cartnum,int cutnum,
|
||||
settings.setChannels(chans);
|
||||
settings.setNormalizationLevel(0);
|
||||
|
||||
RDAudioImport *conv=new RDAudioImport(rda->station(),rda->config(),this);
|
||||
RDAudioImport *conv=new RDAudioImport(this);
|
||||
conv->setCartNumber(cartnum);
|
||||
conv->setCutNumber(cutnum);
|
||||
conv->setSourceFile(srcfile);
|
||||
|
||||
Reference in New Issue
Block a user