Show time rather than decimal hours in Usage popup

This commit is contained in:
Mark Watkins 2011-09-13 13:38:02 +10:00
parent 2d63c59428
commit add1a51db6
2 changed files with 17 additions and 7 deletions

View File

@ -235,9 +235,9 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
if (d!=m_values.end()) {
day=m_days[zd];
float x1=px;
int x1=px;
//x1-=(barw/2.0);
float x2=px+barw;
int x2=px+barw;
if (x1<left) x1=left;
if (x2>left+width) x2=left+width;
@ -369,6 +369,7 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event)
mx=mx+l_offset;//-86400000L;
int zd=mx/86400000L;
Day * day;
//if (hl_day!=zd) // This line is an optimization
{
@ -376,19 +377,28 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event)
QHash<int,QHash<short,EventDataType> >::iterator d=m_values.find(hl_day);
if (d!=m_values.end()) {
day=m_days[zd];
x+=gYAxis::Margin+gGraphView::titleWidth; //graph->m_marginleft+
int y=event->y()+rtop-10;
QDateTime dt=QDateTime::fromTime_t(hl_day*86400);
// Day * day=m_days[hl_day];
EventDataType val;
//EventDataType val;
QString val;
if (m_graphtype==GT_BAR) {
val=d.value()[0];
if (m_type[0]==ST_HOURS) {
int t=d.value()[0]*3600.0;
int h=t/3600;
int m=(t / 60) % 60;
int s=t % 60;
val.sprintf("%02i:%02i:%02i",h,m,s);
} else val=QString::number(d.value()[0]);
} else {
val=d.value()[1];
val=QString::number(d.value()[1]);
}
QString z=dt.date().toString(Qt::SystemLocaleShortDate)+"\n"+m_label+"="+QString::number(val,'f',2);//+"\nAHI="+QString::number(day->cph(CPAP_AHI));
QString z=dt.date().toString(Qt::SystemLocaleShortDate)+"\n"+m_label+"="+val;//+"\nAHI="+QString::number(day->cph(CPAP_AHI));
graph->ToolTip(z,x,y,1500);
return true;
}

View File

@ -164,7 +164,7 @@ void gXAxis::paint(gGraph & w,int left,int top, int width, int height)
}
for (qint64 i=aligned_start;i<maxx;i+=step) {
px=double(i-minx)*xmult;
px=(i-minx)*xmult;
px+=left;
lines->add(px,top,px,top+6,linecol);
qint64 j=i+tz_offset;