From 027a81d915520e06e3923a382a51af0a01d6c757 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 1 May 2014 14:59:35 +1000 Subject: [PATCH] Show progressbar in a dialog during import instead of in the status bar Also added a warning message for non data capable PRS1 machines --- .../SleepLib/loader_plugins/prs1_loader.cpp | 17 ++++++++++++++++- sleepyhead/mainwindow.cpp | 10 ++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp index 2dc0d3af..630d4617 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp @@ -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; long ext; QHash sessfiles; int size = paths.size(); int cnt = 0; - bool ok; new_sessions.clear(); diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 4a64d342..c6d03621 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -492,6 +492,13 @@ void MainWindow::on_action_Import_Data_triggered() 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++) { QString dir = importFrom[i]; @@ -512,6 +519,9 @@ void MainWindow::on_action_Import_Data_triggered() qprogress->hide(); } } + dlg.hide(); + + ui->statusbar->insertWidget(2,qprogress,1); if (successful) { PROFILE.Save();