Add a save option to discard MIDI connections (#5021)

* Song: add isSavingProject.
* VersionedSaveDialog: Add support for a custom option dialog.
* AutomatableModel: Support the discardMIDIConnections save option.
* InstrumentTrack: Support the discardMIDIConnections save option.
* SaveOptions: Show the save option dialog on "save as".
This commit is contained in:
Shmuel H
2019-06-09 15:44:32 +03:00
committed by GitHub
parent 46c74d0a81
commit 723a451ebc
7 changed files with 87 additions and 7 deletions

View File

@@ -65,6 +65,17 @@ public:
Mode_Count
} ;
struct SaveOptions {
/**
* Should we discard MIDI ControllerConnections from project files?
*/
BoolModel discardMIDIConnections{false};
void setDefaultOptions() {
discardMIDIConnections.setValue(false);
}
};
void clearErrors();
void collectError( const QString error );
bool hasErrors();
@@ -322,6 +333,11 @@ public:
void exportProjectMidi(QString const & exportFileName) const;
inline void setLoadOnLauch(bool value) { m_loadOnLaunch = value; }
SaveOptions &getSaveOptions() {
return m_saveOptions;
}
bool isSavingProject() const;
public slots:
void playSong();
@@ -419,9 +435,12 @@ private:
volatile bool m_playing;
volatile bool m_paused;
bool m_savingProject;
bool m_loadingProject;
bool m_isCancelled;
SaveOptions m_saveOptions;
QStringList m_errors;
PlayModes m_playMode;

View File

@@ -29,15 +29,25 @@
#define VERSIONEDSAVEDIALOG_H
#include "FileDialog.h"
#include "Song.h"
class QLineEdit;
class LedCheckBox;
class SaveOptionsWidget : public QWidget {
public:
SaveOptionsWidget(Song::SaveOptions &saveOptions);
private:
LedCheckBox *m_discardMIDIConnectionsCheckbox;
};
class VersionedSaveDialog : public FileDialog
{
Q_OBJECT
public:
explicit VersionedSaveDialog( QWidget *parent = 0,
QWidget *saveOptionsWidget = nullptr,
const QString &caption = QString(),
const QString &directory = QString(),
const QString &filter = QString() );