From 4d014ba91bd50b53666a1e44bee10398715f153e Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Wed, 20 Aug 2014 14:26:48 +1000 Subject: [PATCH] CMS50 Session duration formatting --- sleepyhead/SleepLib/serialoximeter.h | 1 + sleepyhead/oximeterimport.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sleepyhead/SleepLib/serialoximeter.h b/sleepyhead/SleepLib/serialoximeter.h index 9ece3347..3b533e8e 100644 --- a/sleepyhead/SleepLib/serialoximeter.h +++ b/sleepyhead/SleepLib/serialoximeter.h @@ -51,6 +51,7 @@ public: virtual QDateTime getDateTime(int session) { Q_UNUSED(session); return QDateTime(); } virtual int getDuration(int session) { Q_UNUSED(session); return 0; } virtual int getSessionCount() { return 0; } + virtual QString getUser() { return QString(); } virtual QString getModel() { return QString(); } virtual QString getVendor() { return QString(); } virtual QString getDeviceString() { return QString(); } diff --git a/sleepyhead/oximeterimport.cpp b/sleepyhead/oximeterimport.cpp index 0a3f17da..ee9830a3 100644 --- a/sleepyhead/oximeterimport.cpp +++ b/sleepyhead/oximeterimport.cpp @@ -223,6 +223,8 @@ void OximeterImport::on_directImportButton_clicked() return; QString model = oximodule->getModel(); + QString user = oximodule->getUser(); + oximodule->resetDevice(); int session_count = oximodule->getSessionCount(); @@ -240,7 +242,6 @@ void OximeterImport::on_directImportButton_clicked() ui->tableOxiSessions->setColumnWidth(0,150); - int h, m, s; for (int i=0; i< session_count; ++i) { int duration = oximodule->getDuration(i); @@ -256,11 +257,11 @@ void OximeterImport::on_directImportButton_clicked() item->setData(Qt::UserRole+2, duration); item->setFlags(item->flags() & ~Qt::ItemIsEditable); - item = new QTableWidgetItem(QString(). sprintf("%ih, %im, %is", h,m,s)); + item = new QTableWidgetItem(QString(). sprintf("%02i:%02i:%02i", h,m,s)); ui->tableOxiSessions->setItem(i, 1, item); item->setFlags(item->flags() & ~Qt::ItemIsEditable); - item = new QTableWidgetItem(tr("%1 Session %2 (%3s)").arg(model).arg(i+1, 0).arg(duration)); + item = new QTableWidgetItem(tr("\"%1\", session %2").arg(user).arg(i+1, 0)); ui->tableOxiSessions->setItem(i, 2, item); item->setFlags(item->flags() & ~Qt::ItemIsEditable); }