Skip to content

Commit

Permalink
SaveOptions: Show the save option dialog on "save as".
Browse files Browse the repository at this point in the history
  • Loading branch information
Reflexe committed Jun 9, 2019
1 parent d8b6cc8 commit 193e4d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion include/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ class LMMS_EXPORT Song : public TrackContainer
/**
* Should we discard MIDI ControllerConnections from project files?
*/
BoolModel discardMIDIConnections;
BoolModel discardMIDIConnections{false};

void setDefaultOptions() {
discardMIDIConnections.setValue(false);
}
};

void clearErrors();
Expand Down
6 changes: 5 additions & 1 deletion src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,11 @@ bool Song::guiSaveProjectAs( const QString & _file_name )
m_oldFileName = m_fileName;
setProjectFileName(_file_name);

if(!guiSaveProject())
bool saveResult = guiSaveProject();
// After saving as, restore default save options.
m_saveOptions.setDefaultOptions();

if(saveResult)
{
// Saving failed. Restore old filenames.
setProjectFileName(m_oldFileName);
Expand Down
3 changes: 2 additions & 1 deletion src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,8 @@ bool MainWindow::saveProject()

bool MainWindow::saveProjectAs()
{
VersionedSaveDialog sfd( this, tr( "Save Project" ), "",
auto optionsWidget = new SaveOptionsWidget(Engine::getSong()->getSaveOptions());
VersionedSaveDialog sfd( this, optionsWidget, tr( "Save Project" ), "",
tr( "LMMS Project" ) + " (*.mmpz *.mmp);;" +
tr( "LMMS Project Template" ) + " (*.mpt)" );
QString f = Engine::getSong()->projectFileName();
Expand Down

0 comments on commit 193e4d8

Please sign in to comment.