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

Method bankChanged

plugins/GigPlayer/PatchesDialog.cpp:332–385  ·  view source on GitHub ↗

Bank change slot.

Source from the content-addressed store, hash-verified

330
331// Bank change slot.
332void PatchesDialog::bankChanged()
333{
334 if( m_pSynth == NULL )
335 {
336 return;
337 }
338
339 QTreeWidgetItem * pBankItem = m_bankListView->currentItem();
340
341 if( pBankItem == NULL )
342 {
343 return;
344 }
345
346 int iBankSelected = pBankItem->text( 0 ).toInt();
347
348 // Clear up the program listview.
349 m_progListView->setSortingEnabled( false );
350 m_progListView->clear();
351 QTreeWidgetItem * pProgItem = NULL;
352
353 gig::Instrument * pInstrument = m_pSynth->gig.GetFirstInstrument();
354
355 while( pInstrument )
356 {
357 QString name = QString::fromStdString( pInstrument->pInfo->Name );
358
359 if( name == "" )
360 {
361 name = "<no name>";
362 }
363
364 int iBank = pInstrument->MIDIBank;
365 int iProg = pInstrument->MIDIProgram;
366
367 if( iBank == iBankSelected && !findProgItem( iProg ) )
368 {
369 pProgItem = new PatchItem( m_progListView, pProgItem );
370
371 if( pProgItem )
372 {
373 pProgItem->setText( 0, QString::number( iProg ) );
374 pProgItem->setText( 1, name );
375 }
376 }
377
378 pInstrument = m_pSynth->gig.GetNextInstrument();
379 }
380
381 m_progListView->setSortingEnabled( true );
382
383 // Stabilize the form.
384 stabilizeForm();
385}
386
387
388

Callers

nothing calls this directly

Calls 2

clearMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected