Fix double import progress window.

This commit is contained in:
sawinglogz 2020-02-16 20:12:25 -05:00
parent c5c6f779f7
commit b96f22bcd9

View File

@ -1064,35 +1064,17 @@ void MainWindow::importCPAPDataCards(const QList<ImportPath> & datacards)
{
bool newdata = false;
// QStringList goodlocations;
ProgressDialog * prog = new ProgressDialog(this);
prog->setMessage(tr("Processing import list..."));
prog->addAbortButton();
prog->setWindowModality(Qt::ApplicationModal);
prog->open();
int c = -1;
for (int i = 0; i < datacards.size(); i++) {
QString dir = datacards[i].path;
MachineLoader * loader = datacards[i].loader;
if (!loader) continue;
connect(loader, SIGNAL(updateMessage(QString)), prog, SLOT(setMessage(QString)));
connect(loader, SIGNAL(setProgressMax(int)), prog, SLOT(setProgressMax(int)));
connect(loader, SIGNAL(setProgressValue(int)), prog, SLOT(setProgressValue(int)));
connect(prog, SIGNAL(abortClicked()), loader, SLOT(abortImport()));
QPixmap image = loader->getPixmap(loader->PeekInfo(dir).series);
image = image.scaled(64,64);
prog->setPixmap(image);
if (!dir.isEmpty()) {
c = importCPAP(datacards[i], tr("Importing Data"));
qDebug() << "Finished Importing data" << c;
if (c >= 0) {
// goodlocations.push_back(dir);
QDir d(dir.section("/",0,-1));
(*p_profile)[STR_PREF_LastCPAPPath] = d.absolutePath();
}
@ -1101,19 +1083,12 @@ void MainWindow::importCPAPDataCards(const QList<ImportPath> & datacards)
newdata = true;
}
}
disconnect(prog, SIGNAL(abortClicked()), loader, SLOT(abortImport()));
disconnect(loader, SIGNAL(setProgressMax(int)), prog, SLOT(setProgressMax(int)));
disconnect(loader, SIGNAL(setProgressValue(int)), prog, SLOT(setProgressValue(int)));
disconnect(loader, SIGNAL(updateMessage(QString)), prog, SLOT(setMessage(QString)));
}
if (newdata) {
finishCPAPImport();
PopulatePurgeMenu();
}
prog->close();
prog->deleteLater();
}