Skip to content

Commit

Permalink
Fix export - double dialog windows on writing over existing file (LMM…
Browse files Browse the repository at this point in the history
…S#3526)

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

* Case sensitivity
  • Loading branch information
zonkmachine authored and Umcaruje committed May 30, 2017
1 parent 74790c0 commit 9bdc011
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand All @@ -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();
}
Expand Down

0 comments on commit 9bdc011

Please sign in to comment.