From 4766da616f718ec08fc4b659ca493033006c59d8 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 16 Jul 2011 17:28:50 +1000 Subject: [PATCH] Some Date fixes --- Graphs/gBarChart.h | 2 +- Graphs/gSessionTime.h | 2 +- Graphs/gXAxis.cpp | 2 +- daily.cpp | 2 +- overview.ui | 26 ++++++++++---------------- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Graphs/gBarChart.h b/Graphs/gBarChart.h index 0c41981e..3e964f40 100644 --- a/Graphs/gBarChart.h +++ b/Graphs/gBarChart.h @@ -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; }; diff --git a/Graphs/gSessionTime.h b/Graphs/gSessionTime.h index 13d39320..e11d2ea5 100644 --- a/Graphs/gSessionTime.h +++ b/Graphs/gSessionTime.h @@ -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; }; diff --git a/Graphs/gXAxis.cpp b/Graphs/gXAxis.cpp index 9205f3ca..9c6506de 100644 --- a/Graphs/gXAxis.cpp +++ b/Graphs/gXAxis.cpp @@ -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(); diff --git a/daily.cpp b/daily.cpp index 379c38e5..d8014a1e 100644 --- a/daily.cpp +++ b/daily.cpp @@ -690,7 +690,7 @@ void Daily::Load(QDate date) for (vector::iterator s=cpap->begin();s!=cpap->end();s++) { fd=QDateTime::fromMSecsSinceEpoch((*s)->first()); ld=QDateTime::fromMSecsSinceEpoch((*s)->last()); - tmp.sprintf(("%08x"+fd.toString("yyyy-MM-dd")+""+fd.toString("HH:mm ")+""+ld.toString("HH:mm")+"").toLatin1(),(*s)->session()); + tmp.sprintf(("%08x"+fd.date().toString(Qt::SystemLocaleShortDate)+""+fd.toString("HH:mm ")+""+ld.toString("HH:mm")+"").toLatin1(),(*s)->session()); html+=tmp; } html+=""; diff --git a/overview.ui b/overview.ui index 1a8ecb4b..57477886 100644 --- a/overview.ui +++ b/overview.ui @@ -90,7 +90,7 @@ 0 0 800 - 282 + 276 @@ -126,19 +126,7 @@ QFrame::Raised - - 0 - - - 4 - - - 0 - - - 0 - - + 0 @@ -202,10 +190,13 @@ - + false + + + dd/MM/yyyy @@ -225,10 +216,13 @@ - + false + + + dd/MM/yyyy