From 15930464c0cfd23febdb6361956e03b6e7ddaceb Mon Sep 17 00:00:00 2001 From: Yohann Dedy Date: Sat, 25 Mar 2017 14:26:22 +0100 Subject: [PATCH] Added progress bar when importing all presets --- src/mainwindow.cpp | 22 ++++++++++++++++++---- src/mainwindow.h | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8db498d..fcacd5d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -374,15 +375,28 @@ void mainWindow::sendSingleDumpRequest() if(_midiOut->isPortOpen()) _midiOut->sendRawMessage(rawRequest); } +void mainWindow::sendSingleDumpRequest(int numPreset) +{ + std::vector rawRequest; + rawRequest = _prefixPocketC; + rawRequest.push_back(0x26); + rawRequest.push_back(numPreset); + rawRequest.push_back(0x00); + rawRequest.push_back(0xF7); + if(_midiOut->isPortOpen()) _midiOut->sendRawMessage(rawRequest); +} + void mainWindow::sendAllDumpRequest() { - _presetsList->setCurrentRow(0); + QProgressDialog progress(this); + progress.setRange(0,128); + progress.setCancelButton(0); + progress.open(); for(int i=0; i<_presetsList->count(); i++){ - _presetsList->setCurrentRow(i); - sendSingleDumpRequest(); + sendSingleDumpRequest(i); + progress.setValue(i); QThread::msleep(200); } - } void mainWindow::sendSingleDump() diff --git a/src/mainwindow.h b/src/mainwindow.h index a646f57..2b2b500 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -77,6 +77,7 @@ private slots: void openMidiPorts(); void sendThruMasterChnRequest(); void sendSingleDumpRequest(); + void sendSingleDumpRequest(int num); void sendAllDumpRequest(); void sendSingleDump();