Show progressbar in a dialog during import instead of in the status bar

Also added a warning message for non data capable PRS1 machines
This commit is contained in:
Mark Watkins 2014-05-01 14:59:35 +10:00
parent 22a9736598
commit 027a81d915
2 changed files with 26 additions and 1 deletions

View File

@ -386,12 +386,27 @@ int PRS1Loader::OpenMachine(Machine *m, QString path, Profile *profile)
} }
} }
QString modelstr = m->properties["ModelNumber"];
if (modelstr.endsWith("P"))
modelstr.chop(1);
bool ok;
int model = modelstr.toInt(&ok);
if (!ok || (model < 450)) {
QMessageBox::information(NULL,
QObject::tr("Non Data Capable Machine"),
QString(QObject::tr("Your Philips Respironics CPAP machine (Model %1) is unfortunately not a data capable model.")+"\n\n"+
QObject::tr("I'm sorry to report that SleepyHead can only track hours of use for this machine.")).
arg(m->properties["ModelNumber"]),QMessageBox::Ok);
}
SessionID sid; SessionID sid;
long ext; long ext;
QHash<SessionID, QStringList> sessfiles; QHash<SessionID, QStringList> sessfiles;
int size = paths.size(); int size = paths.size();
int cnt = 0; int cnt = 0;
bool ok;
new_sessions.clear(); new_sessions.clear();

View File

@ -492,6 +492,13 @@ void MainWindow::on_action_Import_Data_triggered()
QStringList goodlocations; QStringList goodlocations;
QDialog dlg(this,Qt::SplashScreen);
QVBoxLayout layout;
dlg.setLayout(&layout);
QLabel label(tr("Please wait, SleepyHead is importing data..."));
layout.addWidget(&label,1);
layout.addWidget(qprogress,1);
dlg.show();
for (int i = 0; i < importFrom.size(); i++) { for (int i = 0; i < importFrom.size(); i++) {
QString dir = importFrom[i]; QString dir = importFrom[i];
@ -512,6 +519,9 @@ void MainWindow::on_action_Import_Data_triggered()
qprogress->hide(); qprogress->hide();
} }
} }
dlg.hide();
ui->statusbar->insertWidget(2,qprogress,1);
if (successful) { if (successful) {
PROFILE.Save(); PROFILE.Save();