--- qsampler/trunk/src/qsamplerInstrumentListForm.cpp 2010/03/15 18:21:28 2071 +++ qsampler/trunk/src/qsamplerInstrumentListForm.cpp 2019/08/13 10:19:32 3555 @@ -1,7 +1,7 @@ // qsamplerInstrumentListForm.cpp // /**************************************************************************** - Copyright (C) 2003-2010, rncbc aka Rui Nuno Capela. All rights reserved. + Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved. Copyright (C) 2007, Christian Schoenebeck This program is free software; you can redistribute it and/or @@ -35,6 +35,8 @@ #include #include +#include + namespace QSampler { @@ -141,11 +143,11 @@ void InstrumentListForm::refreshInstruments (void) { MainForm* pMainForm = MainForm::getInstance(); - if (pMainForm == NULL) + if (pMainForm == nullptr) return; Options *pOptions = pMainForm->options(); - if (pOptions == NULL) + if (pOptions == nullptr) return; // Get/save current map selection... @@ -172,11 +174,11 @@ void InstrumentListForm::activateMap ( int iMap ) { MainForm* pMainForm = MainForm::getInstance(); - if (pMainForm == NULL) + if (pMainForm == nullptr) return; Options *pOptions = pMainForm->options(); - if (pOptions == NULL) + if (pOptions == nullptr) return; int iMidiMap = iMap - 1; @@ -225,7 +227,7 @@ Instrument *pInstrument = static_cast (index.internalPointer()); - if (pInstrument == NULL) + if (pInstrument == nullptr) return; // Save current key values... @@ -269,25 +271,41 @@ Instrument *pInstrument = static_cast (index.internalPointer()); - if (pInstrument == NULL) + if (pInstrument == nullptr) return; MainForm *pMainForm = MainForm::getInstance(); - if (pMainForm == NULL) + if (pMainForm == nullptr) return; // Prompt user if this is for real... Options *pOptions = pMainForm->options(); if (pOptions && pOptions->bConfirmRemove) { - if (QMessageBox::warning(this, - QSAMPLER_TITLE ": " + tr("Warning"), - tr("About to delete instrument map entry:\n\n" + const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning"); + const QString& sText = tr( + "About to delete instrument map entry:\n\n" "%1\n\n" "Are you sure?") - .arg(pInstrument->name()), - QMessageBox::Ok | QMessageBox::Cancel) - == QMessageBox::Cancel) - return; + .arg(pInstrument->name()); + #if 0 + if (QMessageBox::warning(this, sTitle, sText, + QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) + return; + #else + QMessageBox mbox(this); + mbox.setIcon(QMessageBox::Warning); + mbox.setWindowTitle(sTitle); + mbox.setText(sText); + mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + QCheckBox cbox(tr("Don't ask this again")); + cbox.setChecked(false); + cbox.blockSignals(true); + mbox.addButton(&cbox, QMessageBox::ActionRole); + if (mbox.exec() == QMessageBox::Cancel) + return; + if (cbox.isChecked()) + pOptions->bConfirmRemove = false; + #endif } pInstrument->unmapInstrument();