summaryrefslogtreecommitdiff
path: root/library/timestring.cpp
Unidiff
Diffstat (limited to 'library/timestring.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/timestring.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/timestring.cpp b/library/timestring.cpp
index 6443b6b..8f60b72 100644
--- a/library/timestring.cpp
+++ b/library/timestring.cpp
@@ -222,72 +222,72 @@ void DateFormat::save(QDataStream &d) const
222void DateFormat::load(QDataStream &d) 222void DateFormat::load(QDataStream &d)
223{ 223{
224 ushort value; 224 ushort value;
225 d >> value; 225 d >> value;
226 _shortSeparator = QChar(value); 226 _shortSeparator = QChar(value);
227 uint v = 0; 227 uint v = 0;
228 d >> v; 228 d >> v;
229 _shortOrder = (Order)v; 229 _shortOrder = (Order)v;
230 v = 0; 230 v = 0;
231 d >> v; 231 d >> v;
232 _longOrder = (Order)v; 232 _longOrder = (Order)v;
233} 233}
234 234
235QDataStream &operator<<(QDataStream &s, const DateFormat&df) 235QDataStream &operator<<(QDataStream &s, const DateFormat&df)
236{ 236{
237 df.save(s); 237 df.save(s);
238 return s; 238 return s;
239} 239}
240QDataStream &operator>>(QDataStream &s, DateFormat&df) 240QDataStream &operator>>(QDataStream &s, DateFormat&df)
241{ 241{
242 df.load(s); 242 df.load(s);
243 return s; 243 return s;
244} 244}
245#endif 245#endif
246 246
247QString TimeString::shortDate( const QDate &d, DateFormat dtf ) 247QString TimeString::shortDate( const QDate &d, DateFormat dtf )
248{ 248{
249 return dtf.wordDate(d); 249 return dtf.wordDate(d);
250} 250}
251 251
252QString TimeString::dateString( const QDate &d, DateFormat dtf ) 252QString TimeString::dateString( const QDate &d, DateFormat dtf )
253{ 253{
254 return dtf.wordDate(d, DateFormat::longNumber | DateFormat::longWord); 254 return QObject::tr( dtf.wordDate(d, DateFormat::longNumber | DateFormat::longWord) );
255} 255}
256 256
257 257
258QString TimeString::longDateString( const QDate &d, DateFormat dtf ) 258QString TimeString::longDateString( const QDate &d, DateFormat dtf )
259{ 259{
260 return dtf.wordDate(d, DateFormat::showWeekDay | DateFormat::longNumber 260 return QObject::tr( dtf.wordDate(d, DateFormat::showWeekDay | DateFormat::longNumber
261 | DateFormat::longWord); 261 | DateFormat::longWord) );
262} 262}
263 263
264DateFormat TimeString::currentDateFormat() 264DateFormat TimeString::currentDateFormat()
265{ 265{
266 return TimeStringFormatKeeper::currentFormat(); 266 return TimeStringFormatKeeper::currentFormat();
267} 267}
268 268
269 269
270QString TimeString::dateString( const QDateTime &dt, bool ampm, bool seconds, DateFormat dtf ) 270QString TimeString::dateString( const QDateTime &dt, bool ampm, bool seconds, DateFormat dtf )
271{ 271{
272 const QDate& d = dt.date(); 272 const QDate& d = dt.date();
273 const QTime& t = dt.time(); 273 const QTime& t = dt.time();
274 274
275 // based on QDateTime::toString() 275 // based on QDateTime::toString()
276 QString buf = timeString(t,ampm,seconds); 276 QString buf = timeString(t,ampm,seconds);
277 buf += " "; 277 buf += " ";
278 buf += longDateString( d, dtf ); 278 buf += longDateString( d, dtf );
279 279
280 return buf; 280 return buf;
281} 281}
282 282
283QString TimeString::timeString( const QTime &t, bool ampm, bool seconds ) 283QString TimeString::timeString( const QTime &t, bool ampm, bool seconds )
284{ 284{
285 if ( !ampm ) { 285 if ( !ampm ) {
286 if ( seconds ) 286 if ( seconds )
287 return t.toString(); 287 return t.toString();
288 QString r = QString::number(t.hour()); 288 QString r = QString::number(t.hour());
289 if ( t.hour() < 10 ) r.prepend( "0" ); 289 if ( t.hour() < 10 ) r.prepend( "0" );
290 r.append( ":" ); 290 r.append( ":" );
291 if ( t.minute() < 10 ) r.append( "0" ); 291 if ( t.minute() < 10 ) r.append( "0" );
292 r.append(QString::number(t.minute())); 292 r.append(QString::number(t.minute()));
293 return r; 293 return r;