Dialog setup loader.
| 118 | |
| 119 | // Dialog setup loader. |
| 120 | void PatchesDialog::setup( GigInstance * pSynth, int iChan, |
| 121 | const QString & chanName, |
| 122 | LcdSpinBoxModel * bankModel, |
| 123 | LcdSpinBoxModel * progModel, |
| 124 | QLabel * patchLabel ) |
| 125 | { |
| 126 | |
| 127 | // We'll going to changes the whole thing... |
| 128 | m_dirty = 0; |
| 129 | m_bankModel = bankModel; |
| 130 | m_progModel = progModel; |
| 131 | m_patchLabel = patchLabel; |
| 132 | |
| 133 | // Set the proper caption... |
| 134 | setWindowTitle( chanName + " - GIG patches" ); |
| 135 | |
| 136 | // set m_pSynth to NULL so we don't trigger any progChanged events |
| 137 | m_pSynth = NULL; |
| 138 | |
| 139 | // Load bank list from actual synth stack... |
| 140 | m_bankListView->setSortingEnabled( false ); |
| 141 | m_bankListView->clear(); |
| 142 | |
| 143 | // now it should be safe to set internal stuff |
| 144 | m_pSynth = pSynth; |
| 145 | m_iChan = iChan; |
| 146 | |
| 147 | |
| 148 | //fluid_preset_t preset; |
| 149 | QTreeWidgetItem * pBankItem = NULL; |
| 150 | |
| 151 | // Currently just use zero as the only bank |
| 152 | int iBankDefault = -1; |
| 153 | int iProgDefault = -1; |
| 154 | |
| 155 | gig::Instrument * pInstrument = m_pSynth->gig.GetFirstInstrument(); |
| 156 | |
| 157 | while( pInstrument ) |
| 158 | { |
| 159 | int iBank = pInstrument->MIDIBank; |
| 160 | int iProg = pInstrument->MIDIProgram; |
| 161 | |
| 162 | if ( !findBankItem( iBank ) ) |
| 163 | { |
| 164 | pBankItem = new PatchItem( m_bankListView, pBankItem ); |
| 165 | |
| 166 | if( pBankItem ) |
| 167 | { |
| 168 | pBankItem->setText( 0, QString::number( iBank ) ); |
| 169 | |
| 170 | if( iBankDefault == -1 ) |
| 171 | { |
| 172 | iBankDefault = iBank; |
| 173 | iProgDefault = iProg; |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 |
no test coverage detected