exportPorjectDialog - default output file format

exportProjectDialog - select the output file format based on
what the user has already chosen in the export dialog. Prevents
the user from having to choose twice.
(also fixed whitespace and added modelines where applicable)
This commit is contained in:
Andrew Kelley
2009-07-16 05:19:26 -07:00
parent 9cb6c6ab6a
commit 73fdfb4ef1
3 changed files with 28 additions and 4 deletions

1
TODO
View File

@@ -54,7 +54,6 @@
Andrew Kelley's todo:
* when you press down or up while browsing the resource browser, it should
play the sample
* select the output file format based on what you selected in file->save as
* load asdlol.mmpz. if you render it without playing it, or if you play it
the first time, you hear unwanted artifacts.

View File

@@ -37,11 +37,11 @@ public:
{
WaveFile,
OggFile,
Mp3File,
Mp3File,
NumFileFormats
} ;
static const char * EFF_ext[];
static const char * EFF_ext[];
enum Depths
{
@@ -120,3 +120,5 @@ struct fileEncodeDevice
extern fileEncodeDevice __fileEncodeDevices[];
#endif
/* vim: set tw=0 noexpandtab: */

View File

@@ -46,12 +46,32 @@ exportProjectDialog::exportProjectDialog( const QString & _file_name,
setWindowTitle( tr( "Export project to %1" ).arg(
QFileInfo( _file_name ).fileName() ) );
// get the extension of the chosen file
QStringList parts = _file_name.split(".");
QString file_ext = "";
if( parts.size() > 0 )
file_ext = parts[parts.size()-1];
int cbIndex = 0;
for( int i = 0; i < projectRenderer::NumFileFormats; ++i )
{
if( __fileEncodeDevices[i].m_getDevInst != NULL )
{
// get the extension of this format
QString render_ext = projectRenderer::EFF_ext[i];
// add to combo box
fileFormatCB->addItem( projectRenderer::tr(
__fileEncodeDevices[i].m_description ) );
// if this is our extension, select it
if( QString::compare(render_ext, file_ext,
Qt::CaseInsensitive ) == 0 )
{
fileFormatCB->setCurrentIndex(cbIndex);
}
cbIndex++;
}
}
@@ -145,7 +165,7 @@ void exportProjectDialog::startBtnClicked( void )
m_renderer = new projectRenderer( qs, os, ft, m_fileName );
if( m_renderer->isReady() )
{
updateTitleBar( 0 );
updateTitleBar( 0 );
connect( m_renderer, SIGNAL( progressChanged( int ) ),
progressBar, SLOT( setValue( int ) ) );
connect( m_renderer, SIGNAL( progressChanged( int ) ),
@@ -178,3 +198,6 @@ void exportProjectDialog::updateTitleBar( int _prog )
#endif
/* vim: set tw=0 noexpandtab: */