Skip to content

Commit

Permalink
remove default suffix from .mpt
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Aug 2, 2015
1 parent 011668a commit 644d56d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,18 +900,24 @@ bool MainWindow::saveProjectAs()
}

// Don't write over file with suffix if no suffix is provided.
sfd.setDefaultSuffix( ConfigManager::inst()->value( "app",
QString suffix = ConfigManager::inst()->value( "app",
"nommpz" ).toInt() == 0
? "mmpz"
: "mmp" );
: "mmp" ;
sfd.setDefaultSuffix( suffix );

if( sfd.exec () == FileDialog::Accepted &&
!sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" )
{
QString fname = sfd.selectedFiles()[0] ;
if( sfd.selectedNameFilter().contains( "(*.mpt)" ) && !sfd.selectedFiles()[0].endsWith( ".mpt" ) )
if( sfd.selectedNameFilter().contains( "(*.mpt)" ) )
{
fname += ".mpt";
// Remove the default suffix
fname.remove( "." + suffix );
if( !sfd.selectedFiles()[0].endsWith( ".mpt" ) )
{
fname += ".mpt";
}
}
Engine::getSong()->guiSaveProjectAs(
fname );
Expand Down

0 comments on commit 644d56d

Please sign in to comment.