| 178 | |
| 179 | |
| 180 | void 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 | |