@@ -299,9 +299,13 @@ void MainWindow::slotProgErase()
299299
300300void MainWindow::slotProgReadCompleted (int status)
301301{
302+ disconnect (prog, SIGNAL (readChipProgress (unsigned int )), this ,
303+ SLOT (slotProgReadProgress (unsigned int )));
302304 disconnect (prog, SIGNAL (readChipCompleted (int )), this ,
303305 SLOT (slotProgReadCompleted (int )));
304306
307+ setProgress (100 );
308+
305309 if (status)
306310 {
307311 buffer.clear ();
@@ -313,6 +317,16 @@ void MainWindow::slotProgReadCompleted(int status)
313317 static_cast <uint32_t >(buffer.size ()));
314318}
315319
320+ void MainWindow::slotProgReadProgress (unsigned int progress)
321+ {
322+ uint32_t progressPercent;
323+ int index = ui->chipSelectComboBox ->currentIndex ();
324+ uint32_t readSize = chipDb.sizeGetById (CHIP_INDEX2ID (index));
325+
326+ progressPercent = progress * 100ULL / readSize;
327+ setProgress (progressPercent);
328+ }
329+
316330void MainWindow::slotProgRead ()
317331{
318332 int index = ui->chipSelectComboBox ->currentIndex ();
@@ -329,9 +343,12 @@ void MainWindow::slotProgRead()
329343 buffer.resize (static_cast <int >(readSize));
330344
331345 qInfo () << " Reading data ..." ;
346+ setProgress (0 );
332347
333348 connect (prog, SIGNAL (readChipCompleted (int )), this ,
334349 SLOT (slotProgReadCompleted (int )));
350+ connect (prog, SIGNAL (readChipProgress (unsigned int )), this ,
351+ SLOT (slotProgReadProgress (unsigned int )));
335352
336353 prog->readChip (buffer.data (), START_ADDRESS, readSize, true );
337354}
0 commit comments