Some Date fixes

This commit is contained in:
Mark Watkins 2011-07-16 17:28:50 +10:00
parent 2cdd9ab333
commit 4766da616f
5 changed files with 14 additions and 20 deletions

View File

@ -22,7 +22,7 @@ class gBarChart:public gLayer
// d.Set(i+2400000.5+.000001); // JDN vs MJD vs Rounding errors
virtual const QString & FormatX(double v) { static QString t; QDateTime d; d=d.fromMSecsSinceEpoch(v*86400000.0); t=d.toString("dd MMM"); return t; };
virtual const QString & FormatX(double v) { static QString t; QDateTime d; d=d.fromMSecsSinceEpoch(v*86400000.0); t=d.toString("MMM dd"); return t; };
//virtual const wxString & FormatX(double v) { static wxString t; wxDateTime d; d.Set(vi*86400000.0); t=d.Format(wxT("HH:mm")); return t; };
//virtual const wxString & FormatX(double v) { static wxString t; t=wxString::Format(wxT("%.1f"),v); return t; };
virtual const QString & FormatY(double v) { static QString t; t.sprintf("%.1f",v); return t; };

View File

@ -31,7 +31,7 @@ class gSessionTime:public gLayer
protected:
Qt::Orientation m_orientation;
virtual const QString & FormatX(double v) { static QString t; QDateTime d; d=d.fromMSecsSinceEpoch(v*86400000.0); t=d.toString("dd MMM"); return t; };
virtual const QString & FormatX(double v) { static QString t; QDateTime d; d=d.fromMSecsSinceEpoch(v*86400000.0); t=d.toString("MMM dd"); return t; };
//virtual const wxString & FormatX(double v) { static wxString t; wxDateTime d; d.Set(vi*86400000.0); t=d.Format(wxT("HH:mm")); return t; };
//virtual const wxString & FormatX(double v) { static wxString t; t=wxString::Format(wxT("%.1f"),v); return t; };
virtual const QString & FormatY(double v) { static QString t; t.sprintf("%.1f",v); return t; };

View File

@ -150,7 +150,7 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
fd.sprintf("%02i:%02i",hour,minute);
}
} else {
fd=d.toString("dd MMM");
fd=d.toString("MMM dd");
}
px=(i-minx)*xmult+w.GetLeftMargin();

View File

@ -690,7 +690,7 @@ void Daily::Load(QDate date)
for (vector<Session *>::iterator s=cpap->begin();s!=cpap->end();s++) {
fd=QDateTime::fromMSecsSinceEpoch((*s)->first());
ld=QDateTime::fromMSecsSinceEpoch((*s)->last());
tmp.sprintf(("<tr><td align=center>%08x</td><td align=center>"+fd.toString("yyyy-MM-dd")+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session());
tmp.sprintf(("<tr><td align=center>%08x</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());
html+=tmp;
}
html+="</table>";

View File

@ -90,7 +90,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>282</height>
<height>276</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -126,19 +126,7 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
@ -202,10 +190,13 @@
</widget>
</item>
<item>
<widget class="QDateEdit" name="drEnd">
<widget class="QDateEdit" name="drStart">
<property name="enabled">
<bool>false</bool>
</property>
<property name="locale">
<locale language="C" country="AnyCountry"/>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>
@ -225,10 +216,13 @@
</widget>
</item>
<item>
<widget class="QDateEdit" name="drStart">
<widget class="QDateEdit" name="drEnd">
<property name="enabled">
<bool>false</bool>
</property>
<property name="locale">
<locale language="C" country="AnyCountry"/>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>