void MidiTable::saveMidiTable() { MidiMap *mM = MidiMap::get_instance(); for ( int row = 0; row < __row_count; row++ ) { QComboBox * eventCombo = dynamic_cast <QComboBox *> ( cellWidget( row, 1 ) ); QSpinBox * eventSpinner = dynamic_cast <QSpinBox *> ( cellWidget( row, 2 ) ); QComboBox * actionCombo = dynamic_cast <QComboBox *> ( cellWidget( row, 3 ) ); QSpinBox * actionSpinner = dynamic_cast <QSpinBox *> ( cellWidget( row, 4 ) ); QString eventString; QString actionString; if( !eventCombo->currentText().isEmpty() && !actionCombo->currentText().isEmpty() ){ eventString = eventCombo->currentText(); actionString = actionCombo->currentText(); MidiAction* pAction = new MidiAction( actionString ); if( actionSpinner->cleanText() != ""){ pAction->setParameter1( actionSpinner->cleanText() ); } if( eventString.left(2) == "CC" ){ mM->registerCCEvent( eventSpinner->cleanText().toInt() , pAction ); } else if( eventString.left(3) == "MMC" ){ mM->registerMMCEvent( eventString , pAction ); } else if( eventString.left(4) == "NOTE" ){ mM->registerNoteEvent( eventSpinner->cleanText().toInt() , pAction ); } else if( eventString.left(14) == "PROGRAM_CHANGE" ){ mM->registerPCEvent( pAction ); } } } }