CMS50 Session duration formatting

This commit is contained in:
Mark Watkins 2014-08-20 14:26:48 +10:00
parent 51549234eb
commit 4d014ba91b
2 changed files with 5 additions and 3 deletions

View File

@ -51,6 +51,7 @@ public:
virtual QDateTime getDateTime(int session) { Q_UNUSED(session); return QDateTime(); } virtual QDateTime getDateTime(int session) { Q_UNUSED(session); return QDateTime(); }
virtual int getDuration(int session) { Q_UNUSED(session); return 0; } virtual int getDuration(int session) { Q_UNUSED(session); return 0; }
virtual int getSessionCount() { return 0; } virtual int getSessionCount() { return 0; }
virtual QString getUser() { return QString(); }
virtual QString getModel() { return QString(); } virtual QString getModel() { return QString(); }
virtual QString getVendor() { return QString(); } virtual QString getVendor() { return QString(); }
virtual QString getDeviceString() { return QString(); } virtual QString getDeviceString() { return QString(); }

View File

@ -223,6 +223,8 @@ void OximeterImport::on_directImportButton_clicked()
return; return;
QString model = oximodule->getModel(); QString model = oximodule->getModel();
QString user = oximodule->getUser();
oximodule->resetDevice(); oximodule->resetDevice();
int session_count = oximodule->getSessionCount(); int session_count = oximodule->getSessionCount();
@ -240,7 +242,6 @@ void OximeterImport::on_directImportButton_clicked()
ui->tableOxiSessions->setColumnWidth(0,150); ui->tableOxiSessions->setColumnWidth(0,150);
int h, m, s; int h, m, s;
for (int i=0; i< session_count; ++i) { for (int i=0; i< session_count; ++i) {
int duration = oximodule->getDuration(i); int duration = oximodule->getDuration(i);
@ -256,11 +257,11 @@ void OximeterImport::on_directImportButton_clicked()
item->setData(Qt::UserRole+2, duration); item->setData(Qt::UserRole+2, duration);
item->setFlags(item->flags() & ~Qt::ItemIsEditable); 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); ui->tableOxiSessions->setItem(i, 1, item);
item->setFlags(item->flags() & ~Qt::ItemIsEditable); 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); ui->tableOxiSessions->setItem(i, 2, item);
item->setFlags(item->flags() & ~Qt::ItemIsEditable); item->setFlags(item->flags() & ~Qt::ItemIsEditable);
} }