From 9bdc0119049f41d0859c26e7145b5c8a36446eee Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Tue, 30 May 2017 17:04:00 +0200 Subject: [PATCH] Fix export - double dialog windows on writing over existing file (#3526) * Fix export - double dialog windows on writing over existing file * Case sensitivity --- src/core/Song.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/Song.cpp b/src/core/Song.cpp index babc391f3..b776b531f 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -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(); }