Fix export - double dialog windows on writing over existing file (#3526)

* Fix export - double dialog windows on writing over existing file

* Case sensitivity
This commit is contained in:
Oskar Wallgren
2017-05-30 17:04:00 +02:00
committed by Umcaruje
parent 74790c0c45
commit 9bdc011904

View File

@@ -1337,13 +1337,14 @@ void Song::exportProject( bool multiExport )
efd.setWindowTitle( tr( "Select file for project-export..." ) );
}
QString suffix = "wav";
efd.setDefaultSuffix( suffix );
efd.setAcceptMode( FileDialog::AcceptSave );
if( efd.exec() == QDialog::Accepted && !efd.selectedFiles().isEmpty() &&
!efd.selectedFiles()[0].isEmpty() )
{
QString suffix = "";
QString exportFileName = efd.selectedFiles()[0];
if ( !multiExport )
{
@@ -1355,19 +1356,18 @@ void Song::exportProject( bool multiExport )
// Get first extension from selected dropdown.
// i.e. ".wav" from "WAV-File (*.wav), Dummy-File (*.dum)"
suffix = efd.selectedNameFilter().mid( stx + 2, etx - stx - 2 ).split( " " )[0].trimmed();
exportFileName.remove( "." + suffix, Qt::CaseInsensitive );
if ( efd.selectedFiles()[0].endsWith( suffix ) )
{
suffix = "";
if( VersionedSaveDialog::fileExistsQuery( exportFileName + suffix,
tr( "Save project" ) ) )
{
exportFileName += suffix;
}
}
}
}
if( VersionedSaveDialog::fileExistsQuery( exportFileName + suffix,
tr( "Save project" ) ) )
{
exportFileName += suffix;
}
ExportProjectDialog epd( exportFileName, gui->mainWindow(), multiExport );
epd.exec();
}