Remove double-underscore prefix from __fileEncodeDevices & make it a static member variable;
this helps to reduce pollution of the global namespace
This commit is contained in:
@@ -64,6 +64,14 @@ public:
|
||||
}
|
||||
} ;
|
||||
|
||||
struct FileEncodeDevice
|
||||
{
|
||||
ExportFileFormats m_fileFormat;
|
||||
const char * m_description;
|
||||
const char * m_extension;
|
||||
AudioFileDeviceInstantiaton m_getDevInst;
|
||||
} ;
|
||||
|
||||
|
||||
ProjectRenderer( const Mixer::qualitySettings & _qs,
|
||||
const OutputSettings & _os,
|
||||
@@ -79,6 +87,8 @@ public:
|
||||
static ExportFileFormats getFileFormatFromExtension(
|
||||
const QString & _ext );
|
||||
|
||||
static const FileEncodeDevice fileEncodeDevices[];
|
||||
|
||||
|
||||
public slots:
|
||||
void startProcessing();
|
||||
@@ -103,16 +113,4 @@ private:
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
struct FileEncodeDevice
|
||||
{
|
||||
ProjectRenderer::ExportFileFormats m_fileFormat;
|
||||
const char * m_description;
|
||||
const char * m_extension;
|
||||
AudioFileDeviceInstantiaton m_getDevInst;
|
||||
} ;
|
||||
|
||||
|
||||
extern FileEncodeDevice __fileEncodeDevices[];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
#include <QMutexLocker>
|
||||
|
||||
FileEncodeDevice __fileEncodeDevices[] =
|
||||
const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] =
|
||||
{
|
||||
|
||||
{ ProjectRenderer::WaveFile,
|
||||
@@ -73,13 +73,13 @@ ProjectRenderer::ProjectRenderer( const Mixer::qualitySettings & _qs,
|
||||
m_progress( 0 ),
|
||||
m_abort( false )
|
||||
{
|
||||
if( __fileEncodeDevices[_file_format].m_getDevInst == NULL )
|
||||
if( fileEncodeDevices[_file_format].m_getDevInst == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool success_ful = false;
|
||||
m_fileDev = __fileEncodeDevices[_file_format].m_getDevInst(
|
||||
m_fileDev = fileEncodeDevices[_file_format].m_getDevInst(
|
||||
_os.samplerate, DEFAULT_CHANNELS, success_ful,
|
||||
_out_file, _os.vbr,
|
||||
_os.bitrate, _os.bitrate - 64, _os.bitrate + 64,
|
||||
@@ -109,11 +109,11 @@ ProjectRenderer::ExportFileFormats ProjectRenderer::getFileFormatFromExtension(
|
||||
const QString & _ext )
|
||||
{
|
||||
int idx = 0;
|
||||
while( __fileEncodeDevices[idx].m_fileFormat != NumFileFormats )
|
||||
while( fileEncodeDevices[idx].m_fileFormat != NumFileFormats )
|
||||
{
|
||||
if( QString( __fileEncodeDevices[idx].m_extension ) == _ext )
|
||||
if( QString( fileEncodeDevices[idx].m_extension ) == _ext )
|
||||
{
|
||||
return( __fileEncodeDevices[idx].m_fileFormat );
|
||||
return( fileEncodeDevices[idx].m_fileFormat );
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
|
||||
@@ -1257,9 +1257,9 @@ void Song::exportProject( bool multiExport )
|
||||
efd.setFileMode( FileDialog::AnyFile );
|
||||
int idx = 0;
|
||||
QStringList types;
|
||||
while( __fileEncodeDevices[idx].m_fileFormat != ProjectRenderer::NumFileFormats )
|
||||
while( ProjectRenderer::fileEncodeDevices[idx].m_fileFormat != ProjectRenderer::NumFileFormats )
|
||||
{
|
||||
types << tr( __fileEncodeDevices[idx].m_description );
|
||||
types << tr( ProjectRenderer::fileEncodeDevices[idx].m_description );
|
||||
++idx;
|
||||
}
|
||||
efd.setNameFilters( types );
|
||||
@@ -1274,7 +1274,7 @@ void Song::exportProject( bool multiExport )
|
||||
efd.setDirectory( ConfigManager::inst()->userProjectsDir() );
|
||||
baseFilename = tr( "untitled" );
|
||||
}
|
||||
efd.selectFile( baseFilename + __fileEncodeDevices[0].m_extension );
|
||||
efd.selectFile( baseFilename + ProjectRenderer::fileEncodeDevices[0].m_extension );
|
||||
efd.setWindowTitle( tr( "Select file for project-export..." ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -58,14 +58,14 @@ ExportProjectDialog::ExportProjectDialog( const QString & _file_name,
|
||||
int cbIndex = 0;
|
||||
for( int i = 0; i < ProjectRenderer::NumFileFormats; ++i )
|
||||
{
|
||||
if( __fileEncodeDevices[i].m_getDevInst != NULL )
|
||||
if( ProjectRenderer::fileEncodeDevices[i].m_getDevInst != NULL )
|
||||
{
|
||||
// get the extension of this format
|
||||
QString renderExt = __fileEncodeDevices[i].m_extension;
|
||||
QString renderExt = ProjectRenderer::fileEncodeDevices[i].m_extension;
|
||||
|
||||
// add to combo box
|
||||
fileFormatCB->addItem( ProjectRenderer::tr(
|
||||
__fileEncodeDevices[i].m_description ) );
|
||||
ProjectRenderer::fileEncodeDevices[i].m_description ) );
|
||||
|
||||
// if this is our extension, select it
|
||||
if( QString::compare( renderExt, fileExt,
|
||||
@@ -302,10 +302,10 @@ void ExportProjectDialog::startBtnClicked()
|
||||
{
|
||||
if( fileFormatCB->currentText() ==
|
||||
ProjectRenderer::tr(
|
||||
__fileEncodeDevices[i].m_description ) )
|
||||
ProjectRenderer::fileEncodeDevices[i].m_description ) )
|
||||
{
|
||||
m_ft = __fileEncodeDevices[i].m_fileFormat;
|
||||
m_fileExtension = QString( QLatin1String( __fileEncodeDevices[i].m_extension ) );
|
||||
m_ft = ProjectRenderer::fileEncodeDevices[i].m_fileFormat;
|
||||
m_fileExtension = QString( QLatin1String( ProjectRenderer::fileEncodeDevices[i].m_extension ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user