MCPcopy Create free account
hub / github.com/LMMS/lmms / setFile

Method setFile

plugins/patman/patman.cpp:180–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178
179
180void patmanInstrument::setFile( const QString & _patch_file, bool _rename )
181{
182 if( _patch_file.size() <= 0 )
183 {
184 m_patchFile = QString::null;
185 return;
186 }
187
188 // is current instrument-track-name equal to previous-filename??
189 if( _rename &&
190 ( instrumentTrack()->name() ==
191 QFileInfo( m_patchFile ).fileName() ||
192 m_patchFile == "" ) )
193 {
194 // then set it to new one
195 instrumentTrack()->setName( QFileInfo( _patch_file
196 ).fileName() );
197 }
198 // else we don't touch the instrument-track-name, because the user
199 // named it self
200
201 m_patchFile = SampleBuffer::tryToMakeRelative( _patch_file );
202 LoadErrors error = loadPatch( SampleBuffer::tryToMakeAbsolute( _patch_file ) );
203 if( error )
204 {
205 printf("Load error\n");
206 }
207
208 emit fileChanged();
209}
210
211
212

Callers 2

openFileMethod · 0.80
dropEventMethod · 0.80

Calls 4

instrumentTrackFunction · 0.50
sizeMethod · 0.45
nameMethod · 0.45
setNameMethod · 0.45

Tested by

no test coverage detected