Selection area got mucked up in last graph changes.. fixed

This commit is contained in:
Mark Watkins 2011-12-07 22:23:19 +10:00
parent eadb25fb7d
commit db2c4866dd
8 changed files with 42 additions and 27 deletions

View File

@ -1120,7 +1120,7 @@ void gGraph::paint(int originX, int originY, int width, int height)
if (m_selection.width()>0 && m_selecting_area) {
QColor col(128,128,255,128);
quads()->add(originX+m_selection.x(),originY+top, originX+m_selection.x()+m_selection.width(),originY+top,col);
quads()->add(originX+m_selection.x()+m_selection.width(),originY+height-top-bottom, originX+m_selection.x(),originY+height-top-bottom,col);
quads()->add(originX+m_selection.x()+m_selection.width(),originY+height-bottom, originX+m_selection.x(),originY+height-bottom,col);
}
}
void gGraphView::queGraph(gGraph * g,int left, int top, int width, int height)
@ -1178,7 +1178,7 @@ void gGraph::mouseMoveEvent(QMouseEvent * event)
//int y=event->pos().y();
int x=event->pos().x();
int x2=m_graphview->pointClicked().x();//,y2=m_graphview->pointClicked().y();
int w=m_lastbounds.width()-(right+m_marginright);
int w=m_lastbounds.width()-(right);
//int h=m_lastbounds.height()-(bottom+m_marginbottom);
double xx=max_x-min_x;
double xmult=xx/w;
@ -1196,7 +1196,7 @@ void gGraph::mouseMoveEvent(QMouseEvent * event)
if (a2>w) a2=w;
m_selecting_area=true;
m_selection=QRect(a1-m_marginleft-1,0,a2-a1,m_lastbounds.height());
double w2=m_lastbounds.width()-(right+m_marginright)-(m_marginleft+left);
double w2=m_lastbounds.width();-(right+m_marginright)-(m_marginleft+left);
if (m_blockzoom) {
xmult=(rmax_x-rmin_x)/w2;
} else xmult=(max_x-min_x)/w2;

View File

@ -44,7 +44,7 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
int x,y;
float bottom=start_py+height-25, top=start_py+25;
float bottom=start_py+height-25*w.printScaleY(), top=start_py+25*w.printScaleY();
double X;
double Y;
@ -114,7 +114,7 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
if (lines->full()) { verts_exceeded=true; break; }
if (xx<(1800000)) {
GetTextExtent(m_label,x,y);
w.renderText(m_label,x1-(x/2),top-y+3);
w.renderText(m_label,x1-(x/2),top-y+(3*w.printScaleY()));
}
}

View File

@ -29,14 +29,16 @@ gXAxis::gXAxis(QColor col,bool fadeout)
m_show_major_ticks=true;
m_utcfix=false;
m_fadeout=fadeout;
QDateTime d=QDateTime::currentDateTime();
QTime t1=d.time();
QTime t2=d.toUTC().time();
// QDateTime d=QDateTime::currentDateTime();
// QTime t1=d.time();
// QTime t2=d.toUTC().time();
tz_offset=t2.secsTo(t1);
tz_hours=tz_offset/3600.0;
tz_offset*=1000L;
// tz_offset=t2.secsTo(t1);
// tz_hours=tz_offset/3600.0;
// tz_offset*=1000L;
tz_offset=timezoneOffset();
tz_hours=tz_offset/3600000.0;
}
gXAxis::~gXAxis()
{

View File

@ -98,6 +98,7 @@ bool EDFParser::Parse()
serialnumber+=recordingident[i];
}
QDateTime startDate=QDateTime::fromString(QString::fromAscii(header.datetime,16),"dd.MM.yyHH.mm.ss");
//startDate.toTimeSpec(Qt::UTC);
QDate d2=startDate.date();
if (d2.year()<2000) {
d2.setYMD(d2.year()+100,d2.month(),d2.day());
@ -108,13 +109,7 @@ bool EDFParser::Parse()
return false;
}
startdate=qint64(startDate.toTime_t())*1000L;
QDateTime d=QDateTime::currentDateTime();
QTime t1=d.time();
QTime t2=d.toUTC().time();
qint64 tz_offset=t2.secsTo(t1);
//tz_hours=tz_offset/3600.0;
tz_offset*=1000L;
startdate-=tz_offset;
//startdate-=timezoneOffset();
//qDebug() << startDate.toString("yyyy-MM-dd HH:mm:ss");

View File

@ -20,6 +20,20 @@
extern QProgressBar * qprogress;
qint64 timezoneOffset() {
static bool ok=false;
static qint64 _TZ_offset=0;
if (ok) return _TZ_offset;
QDateTime d1=QDateTime::currentDateTime();
QDateTime d2=d1;
d1.setTimeSpec(Qt::UTC);
_TZ_offset=d2.secsTo(d1);
_TZ_offset*=1000L;
return _TZ_offset;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Machine Base-Class implmementation
//////////////////////////////////////////////////////////////////////////////////////////
@ -321,8 +335,6 @@ bool Machine::Save()
dir.mkdir(path);
}
//size=sessionlist.size();
QHash<SessionID,Session *>::iterator s;
m_savelist.clear();
@ -330,9 +342,6 @@ bool Machine::Save()
cnt++;
if ((*s)->IsChanged()) {
m_savelist.push_back(*s);
//(*s)->UpdateSummaries();
//(*s)->Store(path);
//(*s)->TrashEvents();
}
}
savelistCnt=0;

View File

@ -130,6 +130,7 @@ public:
protected:
};
qint64 timezoneOffset();
#endif // MACHINE_H

View File

@ -599,6 +599,11 @@ void Daily::Load(QDate date)
"a:link,a:visited { color: inherit; text-decoration: none; font-weight: normal;}"
"a:hover { background-color: inherit; color: inherit; text-decoration:none; font-weight: bold; }"
"</style>"
"<script language='javascript'><!--"
"func dosession(sessid) {"
""
"}"
"--></script>"
"</head>"
"<body leftmargin=0 rightmargin=0 topmargin=0 marginwidth=0 marginheight=0>"
"<table cellspacing=0 cellpadding=1 border=0 width='100%'>\n";
@ -827,7 +832,7 @@ void Daily::Load(QDate date)
} */
//}
html+="</table><hr height=2><table cellpadding=0 cellspacing=0 border=0 width=100%>";
html+="</table><hr height=2><form method='get' action='sessions.php'><table cellpadding=0 cellspacing=0 border=0 width=100%>";
QDateTime fd,ld;
bool corrupted_waveform=false;
QString tooltip;
@ -844,7 +849,7 @@ void Daily::Load(QDate date)
QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform");
tooltip=cpap->machine->GetClass()+" CPAP "+QString().sprintf("%2ih&nbsp;%2im&nbsp;%2is",h,m,s1);
if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true;
tmp.sprintf(("<tr><td align=left><a href='cpap=%i' title='"+tooltip+"'>%08i</a></td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session(),(*s)->session());
tmp.sprintf(("<tr><td align=left><input type=checkbox on_click='dosession("+QString::number((*s)->session())+")'><a href='cpap=%i' title='"+tooltip+"'>%08i</a></td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session(),(*s)->session());
html+=tmp;
}
//if (oxi) html+="<tr><td colspan=4><hr></td></tr>";
@ -866,7 +871,7 @@ void Daily::Load(QDate date)
html+=tmp;
}
}
html+="</table>";
html+="</table><input type=submit name='submit'></form>";
if (corrupted_waveform) {
html+="<hr><div align=center><i>One or more waveform record for this session had faulty source data. Some waveform overlay points may not match up correctly.</i></div>";
}

View File

@ -1258,8 +1258,11 @@ void Oximetry::on_saveButton_clicked()
if (m->SessionExists(session->session())) {
m->sessionlist.erase(m->sessionlist.find(session->session()));
}
// Forgetting to reset the session ID sucks, as it will delete sessions you don't want to delete..
session->SetSessionID(qint64(session->first())/1000L);
m->AddSession(session,p_profile);
//}
oximeter->getMachine()->Save();
day->getSessions().clear();