Slow down cube a bit to conserve resources.. Format Usage in Summary as time

This commit is contained in:
Mark Watkins 2011-12-24 01:01:14 +10:00
parent 77e92d4b16
commit cda2e4d1aa
2 changed files with 15 additions and 6 deletions

View File

@ -2609,7 +2609,7 @@ void gGraphView::paintGL()
if (this->isVisible()) {
if (m_limbo || m_inAnimation || (something_fun && !numgraphs)) {
redrawtimer->setInterval(15);
redrawtimer->setInterval(50);
redrawtimer->setSingleShot(true);
redrawtimer->start();
} else {

View File

@ -478,6 +478,15 @@ void MainWindow::on_homeButton_clicked()
{
ui->webView->setUrl(QUrl("qrc:/docs/index.html"));
}
QString formatTime(float time)
{
int hours=time;
int seconds=time*3600.0;
int minutes=(seconds / 60) % 60;
seconds %= 60;
return QString().sprintf("%02i:%02i",hours,minutes); //,seconds);
}
void MainWindow::on_summaryButton_clicked()
{
QString html=htmlHeader();
@ -539,11 +548,11 @@ void MainWindow::on_summaryButton_clicked()
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
.arg(tr("Usage (Average)"))
.arg(p_profile->calcHours(MT_CPAP),0,'f',3)
.arg(p_profile->calcHours(MT_CPAP,cpapweek,lastcpap)/float(cpapweekdays),0,'f',3)
.arg(p_profile->calcHours(MT_CPAP,cpapmonth,lastcpap)/float(cpapmonthdays),0,'f',3)
.arg(p_profile->calcHours(MT_CPAP,cpap6month,lastcpap)/float(cpap6monthdays),0,'f',3)
.arg(p_profile->calcHours(MT_CPAP,cpapyear,lastcpap)/float(cpapyeardays),0,'f',3);
.arg(formatTime(p_profile->calcHours(MT_CPAP)))
.arg(formatTime(p_profile->calcHours(MT_CPAP,cpapweek,lastcpap)/float(cpapweekdays)))
.arg(formatTime(p_profile->calcHours(MT_CPAP,cpapmonth,lastcpap)/float(cpapmonthdays)))
.arg(formatTime(p_profile->calcHours(MT_CPAP,cpap6month,lastcpap)/float(cpap6monthdays)))
.arg(formatTime(p_profile->calcHours(MT_CPAP,cpapyear,lastcpap)/float(cpapyeardays)));
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
.arg(tr("Average Pressure"))