Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions include/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,12 @@ class LMMS_EXPORT Song : public TrackContainer
constexpr static auto PlayModeCount = static_cast<std::size_t>(PlayMode::Count);

struct SaveOptions {
/**
* Should we discard MIDI ControllerConnections from project files?
*/
BoolModel discardMIDIConnections{false};
/**
* Should we save the project as a project bundle? (with resources)
*/
BoolModel saveAsProjectBundle{false};

void setDefaultOptions() {
discardMIDIConnections.setValue(false);
saveAsProjectBundle.setValue(false);
}
};
Expand Down
1 change: 0 additions & 1 deletion include/VersionedSaveDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class SaveOptionsWidget : public QWidget {
SaveOptionsWidget(Song::SaveOptions &saveOptions);

private:
LedCheckBox *m_discardMIDIConnectionsCheckbox;
LedCheckBox *m_saveAsProjectBundleCheckbox;
};

Expand Down
60 changes: 0 additions & 60 deletions src/core/AutomatableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,42 +135,6 @@ void AutomatableModel::saveSettings( QDomDocument& doc, QDomElement& element, co
element.setAttribute( name, m_value );
}
}

// Skip saving MIDI connections if we're saving project and
// the discardMIDIConnections option is true.
auto controllerType = m_controllerConnection
? m_controllerConnection->getController()->type()
: Controller::ControllerType::Dummy;
bool skipMidiController = Engine::getSong()->isSavingProject()
&& Engine::getSong()->getSaveOptions().discardMIDIConnections.value();
if (m_controllerConnection && controllerType != Controller::ControllerType::Dummy
&& !(skipMidiController && controllerType == Controller::ControllerType::Midi))
{
QDomElement controllerElement;

// get "connection" element (and create it if needed)
QDomNode node = element.namedItem( "connection" );
if( node.isElement() )
{
controllerElement = node.toElement();
}
else
{
controllerElement = doc.createElement( "connection" );
element.appendChild( controllerElement );
}

bool mustQuote = mustQuoteName(name);
QString elementName = mustQuote ? "controllerconnection"
: name;

QDomElement element = doc.createElement( elementName );
if(mustQuote)
element.setAttribute( "nodename", name );
m_controllerConnection->saveSettings( doc, element );

controllerElement.appendChild( element );
}
}


Expand Down Expand Up @@ -200,30 +164,6 @@ void AutomatableModel::loadSettings( const QDomElement& element, const QString&
// so they can be ignored
}

QDomNode connectionNode = element.namedItem( "connection" );
// reads controller connection
if( connectionNode.isElement() )
{
QDomNode thisConnection = connectionNode.toElement().namedItem( name );
if( !thisConnection.isElement() )
{
thisConnection = connectionNode.toElement().namedItem( "controllerconnection" );
QDomElement tcElement = thisConnection.toElement();
// sanity check
if( tcElement.isNull() || tcElement.attribute( "nodename" ) != name )
{
// no, that wasn't it, act as if we never found one
thisConnection.clear();
}
}
if( thisConnection.isElement() )
{
setControllerConnection(new ControllerConnection(nullptr));
m_controllerConnection->loadSettings( thisConnection.toElement() );
//m_controllerConnection->setTargetName( displayName() );
}
}

// models can be stored as elements (port00) or attributes (port10):
// <ladspacontrols port10="4.41">
// <port00 value="4.41" id="4249278"/>
Expand Down
5 changes: 0 additions & 5 deletions src/gui/modals/VersionedSaveDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,10 @@ bool VersionedSaveDialog::fileExistsQuery( QString FileName, QString WindowTitle
SaveOptionsWidget::SaveOptionsWidget(Song::SaveOptions &saveOptions) {
auto *layout = new QVBoxLayout();

m_discardMIDIConnectionsCheckbox = new LedCheckBox(nullptr);
m_discardMIDIConnectionsCheckbox->setText(tr("Discard MIDI connections"));
m_discardMIDIConnectionsCheckbox->setModel(&saveOptions.discardMIDIConnections);

m_saveAsProjectBundleCheckbox = new LedCheckBox(nullptr);
m_saveAsProjectBundleCheckbox->setText(tr("Save As Project Bundle (with resources)"));
m_saveAsProjectBundleCheckbox->setModel(&saveOptions.saveAsProjectBundle);

layout->addWidget(m_discardMIDIConnectionsCheckbox);
layout->addWidget(m_saveAsProjectBundleCheckbox);

setLayout(layout);
Expand Down
6 changes: 2 additions & 4 deletions src/tracks/InstrumentTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,8 @@ void InstrumentTrack::saveTrackSpecificSettings( QDomDocument& doc, QDomElement
m_arpeggio.saveState( doc, thisElement );

// Save the midi port info if we are not in song saving mode, e.g. in
// track cloning mode or if we are in song saving mode and the user
// has chosen to discard the MIDI connections.
if (!Engine::getSong()->isSavingProject() ||
!Engine::getSong()->getSaveOptions().discardMIDIConnections.value())
// track cloning mode or if we are in song saving mode
if (!Engine::getSong()->isSavingProject())
{
// Don't save auto assigned midi device connection
bool hasAuto = m_hasAutoMidiDev;
Expand Down