Merge branch 'master' into update-machine-db-version

This commit is contained in:
Phil Olynyk 2020-02-16 21:19:00 -05:00
commit 3df1ba50df
3 changed files with 14 additions and 27 deletions

View File

@ -54,7 +54,11 @@ int DreemLoader::OpenFile(const QString & filename)
mach->AddSession(sess);
count++;
}
mach->Save();
if (count > 0) {
mach->Save();
mach->SaveSummaryCache();
p_profile->StoreMachines();
}
closeCSV();
return count;
}

View File

@ -95,7 +95,11 @@ int ZEOLoader::OpenFile(const QString & filename)
mach->AddSession(sess);
count++;
}
mach->Save();
if (count > 0) {
mach->Save();
mach->SaveSummaryCache();
p_profile->StoreMachines();
}
closeCSV();
return count;
}

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();
}
@ -2485,6 +2460,10 @@ void MainWindow::on_actionImport_Viatom_Data_triggered()
w.setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
w.setOption(QFileDialog::ShowDirsOnly, false);
w.setNameFilters(viatom.getNameFilter());
#if defined(Q_OS_WIN)
// Windows can't handle this name filter.
w.setOption(QFileDialog::DontUseNativeDialog, true);
#endif
if (w.exec() == QFileDialog::Accepted) {
QString filename = w.selectedFiles()[0];