author | zecke <zecke> | 2004-02-20 00:50:32 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-20 00:50:32 (UTC) |
commit | 060b4fc7a3fd5c1b5f745167fe084f7486719b7e (patch) (unidiff) | |
tree | 76f02084f4b088a04f09cb57977b35695860cb0d | |
parent | e54e1cb01c3da0655fc6e86bd9d169b002a63e66 (diff) | |
download | opie-060b4fc7a3fd5c1b5f745167fe084f7486719b7e.zip opie-060b4fc7a3fd5c1b5f745167fe084f7486719b7e.tar.gz opie-060b4fc7a3fd5c1b5f745167fe084f7486719b7e.tar.bz2 |
Update the API Documentation for DateFormat and TimeString utility classes
Add a Translator hint what M, D, Y mean
-rw-r--r-- | library/dummy_api_docu.cpp | 250 | ||||
-rw-r--r-- | library/timestring.cpp | 4 | ||||
-rw-r--r-- | library/timestring.h | 12 |
3 files changed, 263 insertions, 3 deletions
diff --git a/library/dummy_api_docu.cpp b/library/dummy_api_docu.cpp index f2153df..97d28e8 100644 --- a/library/dummy_api_docu.cpp +++ b/library/dummy_api_docu.cpp | |||
@@ -322,48 +322,298 @@ | |||
322 | * \class WindowDecorationInterface::WindowData | 322 | * \class WindowDecorationInterface::WindowData |
323 | * | 323 | * |
324 | * Window informations like the QRect, Palette, Caption | 324 | * Window informations like the QRect, Palette, Caption |
325 | * and flag | 325 | * and flag |
326 | */ | 326 | */ |
327 | 327 | ||
328 | /** | 328 | /** |
329 | * \fn int WindowDecorationInterface::metric(Metric m,const WindowData* ) | 329 | * \fn int WindowDecorationInterface::metric(Metric m,const WindowData* ) |
330 | * | 330 | * |
331 | * Return the width for the item out of Metric. | 331 | * Return the width for the item out of Metric. |
332 | * Normally you will case Metric and default: should call the interface | 332 | * Normally you will case Metric and default: should call the interface |
333 | * method. Also return 0 | 333 | * method. Also return 0 |
334 | */ | 334 | */ |
335 | 335 | ||
336 | /** | 336 | /** |
337 | * \fn void WindowDecorationInterface::drawArea( Area a, QPainter* , const WindowData* )const | 337 | * \fn void WindowDecorationInterface::drawArea( Area a, QPainter* , const WindowData* )const |
338 | * | 338 | * |
339 | * draw the Area specefic in a to the QPainter | 339 | * draw the Area specefic in a to the QPainter |
340 | */ | 340 | */ |
341 | 341 | ||
342 | /** | 342 | /** |
343 | * \fn void WindowDecorationInterface::drawButton(Button b,QPainter*p ,const WindowData* d, int x, int y, int w,int h, QWSButton::State s)const | 343 | * \fn void WindowDecorationInterface::drawButton(Button b,QPainter*p ,const WindowData* d, int x, int y, int w,int h, QWSButton::State s)const |
344 | * | 344 | * |
345 | * @param b The Button to be drawn | 345 | * @param b The Button to be drawn |
346 | * @param p The painter to draw at | 346 | * @param p The painter to draw at |
347 | * @param d The Window Data | 347 | * @param d The Window Data |
348 | * @param x The X position of the button | 348 | * @param x The X position of the button |
349 | * @param y The Y position of the button | 349 | * @param y The Y position of the button |
350 | * @param w The width of the button | 350 | * @param w The width of the button |
351 | * @param h The height of the button | 351 | * @param h The height of the button |
352 | * @param s The state of the button | 352 | * @param s The state of the button |
353 | */ | 353 | */ |
354 | 354 | ||
355 | /** | 355 | /** |
356 | * \fn QRegion WindowDecorationInterface::mask( const WindowData* )const | 356 | * \fn QRegion WindowDecorationInterface::mask( const WindowData* )const |
357 | * | 357 | * |
358 | * The mask of the Decoration. | 358 | * The mask of the Decoration. |
359 | * | 359 | * |
360 | * \code | 360 | * \code |
361 | * int th = metric(TitleHeight,wd); | 361 | * int th = metric(TitleHeight,wd); |
362 | * QRect rect( wd->rect ); | 362 | * QRect rect( wd->rect ); |
363 | * QRect r(rect.left() - metric(LeftBorder,wd), | 363 | * QRect r(rect.left() - metric(LeftBorder,wd), |
364 | * rect.top() - th - metric(TopBorder,wd), | 364 | * rect.top() - th - metric(TopBorder,wd), |
365 | * rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd), | 365 | * rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd), |
366 | * rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd)); | 366 | * rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd)); |
367 | * return QRegion(r) - rect; | 367 | * return QRegion(r) - rect; |
368 | * \endcode | 368 | * \endcode |
369 | */ | 369 | */ |
370 | |||
371 | |||
372 | /** | ||
373 | * \class DateFormat | ||
374 | * \brief The format a Date and Time is composed | ||
375 | * | ||
376 | * Define how a Date and Time should be composed | ||
377 | * | ||
378 | * @see TimeString | ||
379 | */ | ||
380 | |||
381 | /** | ||
382 | * \enum DateFormat::Order | ||
383 | * The order of the Day,Month and Year | ||
384 | */ | ||
385 | /** | ||
386 | * \val DateFormat::Order::DayMonthYear | ||
387 | * First the Day, then the Month and the Year | ||
388 | */ | ||
389 | |||
390 | /** | ||
391 | * \val DateFormat::Order::MonthDayYear | ||
392 | * First the Month then Day and Year followed | ||
393 | */ | ||
394 | /** | ||
395 | * \val DateFormat::Order::YearMonthDay | ||
396 | * Year Month and then the Day | ||
397 | */ | ||
398 | |||
399 | /** | ||
400 | * \fn QString DateFormat::toNumberString()const | ||
401 | * Return the Order of Days as string (M/D/Y) in example | ||
402 | * this string can be shown to the user. | ||
403 | * It will extract three bits at a time and compose | ||
404 | * a string | ||
405 | */ | ||
406 | |||
407 | /** | ||
408 | * \fn QString DateFormat::toWordString()const | ||
409 | * Return the DateFormat as written words | ||
410 | * | ||
411 | */ | ||
412 | |||
413 | /** | ||
414 | * \fn DateFormat::DateFormat(QChar s,Order or) | ||
415 | * A Constructor. | ||
416 | * @param s The seperator for the short representation. As used by toNumberString | ||
417 | * @param or The order used for short and long dates | ||
418 | */ | ||
419 | |||
420 | /** | ||
421 | * \fn DateFormat::DateFormat(QChar s,Order so,Order lo) | ||
422 | * | ||
423 | * A different Constructor with different long and short representation | ||
424 | * @param s The seperator | ||
425 | * @param so The short order representation | ||
426 | * @param lo The long order representation | ||
427 | */ | ||
428 | |||
429 | |||
430 | /** | ||
431 | * \fn DateFormat::DateFormat(const DateFormat&) | ||
432 | * Copy c'tor | ||
433 | * | ||
434 | */ | ||
435 | |||
436 | /** | ||
437 | * \enum DateFormat::Verbosity | ||
438 | * The verbosity as used by DateFormat::numberDate() and DateFormat::wordDate() | ||
439 | * | ||
440 | * \enum val shortNumber Express the Year as 04 | ||
441 | * \enum val longNumber Express the Year as 2004 | ||
442 | * \enum val showWeekDay Use week day names | ||
443 | * \enum val longWord Use long word. If not set the week day will be stripped to the first three characters | ||
444 | * | ||
445 | * | ||
446 | * @see DateFormat::numberDate | ||
447 | * @see DateFormat::wordDate | ||
448 | */ | ||
449 | |||
450 | /** | ||
451 | * \fn QString DateFormat::numberDate(const QDate& d,int v)const | ||
452 | * | ||
453 | * Compose the QDate to a QString using the shortOrder() and | ||
454 | * the verbosity. The verbosity is only used to see if the | ||
455 | * year should be four positions or two positions wide. | ||
456 | * | ||
457 | * @param d The QDate to be expressed as string | ||
458 | * @param v Only DateFormat::Verbosity::shortNumber or | ||
459 | * DateFormat::Verbosity::longNumber is used. | ||
460 | * Use this to say if the year should be two or four | ||
461 | * positions wide | ||
462 | * | ||
463 | * @see DateFormat::wordDate() | ||
464 | */ | ||
465 | |||
466 | /** | ||
467 | * \fn QString DateFormat::wordDate(const QDate& d,int v )const | ||
468 | * Compose the QDate to a QString using the longOrder() options. | ||
469 | * The difference to numberDate() is the length of the resulting | ||
470 | * string. Weekday- and Monthnames are expressed as words as opposed to digits. | ||
471 | * | ||
472 | * | ||
473 | * @param d The Date to be used | ||
474 | * @param v The verbosity | ||
475 | */ | ||
476 | |||
477 | /** | ||
478 | * \fn void DateFormat::load(QDataStream&) | ||
479 | * load from the QDateStream. And set the values | ||
480 | * internally | ||
481 | */ | ||
482 | |||
483 | /** | ||
484 | * \fn void DateFormat::save(QDateStream&)const | ||
485 | * save this DateFormat into the QDataStream | ||
486 | */ | ||
487 | |||
488 | /** | ||
489 | *\fn QChar DateFormat::seperator()const | ||
490 | * The seperator used for the numberString() | ||
491 | */ | ||
492 | /** | ||
493 | * \fn DateFormat::Order DateFormat::shortOrder()const | ||
494 | * Return the DateFormat::Order for the shortOrder which will be used by numberString | ||
495 | */ | ||
496 | /** | ||
497 | * \fn DateFormat::Order DateFormat::longOrder()const | ||
498 | * Return the DateFormat::Order for the longOrder which will be used by the wordString | ||
499 | */ | ||
500 | |||
501 | /** | ||
502 | * \class TimeString | ||
503 | * \brief A frontend to DateFormat | ||
504 | * | ||
505 | * A utility class to use DateFormat more easily | ||
506 | * @todo For ODP add QDateTime and QTime operations honoring system settings | ||
507 | */ | ||
508 | |||
509 | /** | ||
510 | * \fn QString TimeString::shortDate(const QDate& d) | ||
511 | * Call the overloaded function with currentDateFormat() | ||
512 | * | ||
513 | * @param d The QDate to be transformed | ||
514 | * @see TimeString::shortDate(const QDate& d,DateFormat) | ||
515 | */ | ||
516 | /** | ||
517 | * \fn QString TimeString::dateString(const QDate& d); | ||
518 | * This function calls the overloaded function with currentDateFormat() | ||
519 | * | ||
520 | * @param d The QDate to be used | ||
521 | * @see TimeString::dateString(const QDate& d,DateFormat); | ||
522 | */ | ||
523 | /** | ||
524 | * \fn QString TimeString::longDateString(const QDate& d); | ||
525 | * | ||
526 | * This functions calls the olverloaded function with currentDateFormat() | ||
527 | * | ||
528 | * @param d The QDate to be used | ||
529 | * @see TimeString::longDateString(const QDate& d,DateFormat); | ||
530 | */ | ||
531 | /** | ||
532 | * \fn QString TimeString::dateString(const QDateTime&,bool,bool); | ||
533 | * @internal | ||
534 | */ | ||
535 | /** | ||
536 | * \fn QString TimeString::dateString(const QDateTime& t,bool) | ||
537 | * Do not use they do not honor system wide AMPM settings. | ||
538 | * Also | ||
539 | * | ||
540 | * @see numberDateString | ||
541 | * @see longNumberDateString | ||
542 | */ | ||
543 | /** | ||
544 | * \fn QString TimeString::numberDateString(const QDate& d, DateFormat f ) | ||
545 | * Return the date as String in number coding (DD/MM/YY) depending on the | ||
546 | * date format | ||
547 | * | ||
548 | * @param d The QDate to be used | ||
549 | * @param f The DateFormat to be used | ||
550 | */ | ||
551 | /** | ||
552 | * \fn QString TimeString::numberDateString(const QDate& d) | ||
553 | * This is an overloaded function and uses the currentDateFormat() | ||
554 | * of the system | ||
555 | * | ||
556 | * @see currentDateFormat() | ||
557 | * @param d The QDate to be used | ||
558 | */ | ||
559 | /** | ||
560 | * \fn QString TimeString::longNumberDateString(const QDate& d, DateFormat f ) | ||
561 | * Return the date as String in number coding (DD/MM/YYYY) depending on the | ||
562 | * date format. This uses the DateFormat::longNumber verbosity on the DateFormat::numberDate | ||
563 | * method | ||
564 | * | ||
565 | * @param d The QDate to be used | ||
566 | * @param f The DateFormat to be used | ||
567 | */ | ||
568 | /** | ||
569 | * \fn QString TimeString::longNumberDateString(const QDate& d) | ||
570 | * This is an overloaded function and uses the currentDateFormat() | ||
571 | * of the system. | ||
572 | * | ||
573 | * | ||
574 | * @see currentDateFormat() | ||
575 | * @see longNumberDateString(const QDate&,DateFormat) | ||
576 | * @param d The QDate to be used | ||
577 | */ | ||
578 | |||
579 | |||
580 | /** | ||
581 | * \fn QString TimeString::shortDate(const QDate& d,DateFormat f) | ||
582 | * Calls DateFormat::wordDate with d | ||
583 | * | ||
584 | * Example: '20 Feb 04' | ||
585 | * | ||
586 | * | ||
587 | * | ||
588 | * @param d The QDate used | ||
589 | * @param f DateFormat which will be used for composing | ||
590 | * @todo Make naming consistent with the two other functions calling wordDate | ||
591 | */ | ||
592 | |||
593 | /** | ||
594 | * \fn QString TimeString::dateString(const QDate& d,DateFormat f ) | ||
595 | * Calls and translates DateFormat::wordDate with d and | ||
596 | * DateFormat::longNumber|DateFormat::longWord | ||
597 | * This means we will translate the month name and have a 4 digit year (2004) | ||
598 | * | ||
599 | * Example: '20 Feb 2004' | ||
600 | * | ||
601 | * @param d The QDate. | ||
602 | * @param f The DateFormat which will be called | ||
603 | */ | ||
604 | |||
605 | /** | ||
606 | * \fn QSrring TimeString::longDateString(const QDate& d, DateFormat f ) | ||
607 | * Calls and translates DateFormat::wordDate with DateFormat::showWeekDay|DateFormat::longNumber|DateFormat::longWord. | ||
608 | * This means you will have a string with the week day name, monthname and a four digit year. | ||
609 | * | ||
610 | * Example: 'Fr, 20 Feb 2004' | ||
611 | * | ||
612 | * @param d The QDate | ||
613 | * | ||
614 | */ | ||
615 | |||
616 | /** | ||
617 | * \fn DateFormat currentDateFormat() | ||
618 | * Return the System DateFormat | ||
619 | */ | ||
diff --git a/library/timestring.cpp b/library/timestring.cpp index 8f60b72..2fd0191 100644 --- a/library/timestring.cpp +++ b/library/timestring.cpp | |||
@@ -22,100 +22,100 @@ | |||
22 | #include <qobject.h> | 22 | #include <qobject.h> |
23 | #include <qpe/qpeapplication.h> //for qApp | 23 | #include <qpe/qpeapplication.h> //for qApp |
24 | #include "config.h" | 24 | #include "config.h" |
25 | 25 | ||
26 | 26 | ||
27 | class TimeStringFormatKeeper : public QObject | 27 | class TimeStringFormatKeeper : public QObject |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | static DateFormat currentFormat() | 31 | static DateFormat currentFormat() |
32 | { | 32 | { |
33 | if ( !self ) | 33 | if ( !self ) |
34 | self = new TimeStringFormatKeeper; | 34 | self = new TimeStringFormatKeeper; |
35 | return self->format; | 35 | return self->format; |
36 | } | 36 | } |
37 | private slots: | 37 | private slots: |
38 | void formatChanged( DateFormat f ) | 38 | void formatChanged( DateFormat f ) |
39 | { | 39 | { |
40 | format = f; | 40 | format = f; |
41 | } | 41 | } |
42 | private: | 42 | private: |
43 | static TimeStringFormatKeeper *self; | 43 | static TimeStringFormatKeeper *self; |
44 | DateFormat format; | 44 | DateFormat format; |
45 | 45 | ||
46 | TimeStringFormatKeeper() | 46 | TimeStringFormatKeeper() |
47 | : QObject( qApp ) | 47 | : QObject( qApp ) |
48 | { | 48 | { |
49 | Config config("qpe"); | 49 | Config config("qpe"); |
50 | config.setGroup( "Date" ); | 50 | config.setGroup( "Date" ); |
51 | format = DateFormat(QChar(config.readEntry("Separator", "/")[0]), | 51 | format = DateFormat(QChar(config.readEntry("Separator", "/")[0]), |
52 | (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), | 52 | (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), |
53 | (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); | 53 | (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); |
54 | 54 | ||
55 | connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), | 55 | connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), |
56 | this, SLOT( formatChanged( DateFormat ) ) ); | 56 | this, SLOT( formatChanged( DateFormat ) ) ); |
57 | } | 57 | } |
58 | }; | 58 | }; |
59 | 59 | ||
60 | TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0; | 60 | TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0; |
61 | 61 | ||
62 | QString DateFormat::toNumberString() const | 62 | QString DateFormat::toNumberString() const |
63 | { | 63 | { |
64 | QString buf = ""; | 64 | QString buf = ""; |
65 | // for each part of the order | 65 | // for each part of the order |
66 | for (int i = 0; i < 3; i++) { | 66 | for (int i = 0; i < 3; i++) { |
67 | // switch on the relavent 3 bits. | 67 | // switch on the relavent 3 bits. |
68 | switch((_shortOrder >> (i * 3)) & 0x0007) { | 68 | switch((_shortOrder >> (i * 3)) & 0x0007) { |
69 | case 0x0001: | 69 | case 0x0001: |
70 | buf += QObject::tr( "D" ); | 70 | buf += QObject::tr( "D" , "Shortcut for Day"); |
71 | break; | 71 | break; |
72 | case 0x0002: | 72 | case 0x0002: |
73 | buf += QObject::tr( "M" ); | 73 | buf += QObject::tr( "M", "Shortcur for Month" ); |
74 | break; | 74 | break; |
75 | case 0x0004: | 75 | case 0x0004: |
76 | buf += QObject::tr( "Y" ); | 76 | buf += QObject::tr( "Y" ); |
77 | break; | 77 | break; |
78 | } | 78 | } |
79 | if (i < 2) | 79 | if (i < 2) |
80 | buf += _shortSeparator; | 80 | buf += _shortSeparator; |
81 | } | 81 | } |
82 | return buf; | 82 | return buf; |
83 | } | 83 | } |
84 | 84 | ||
85 | QString DateFormat::toWordString() const | 85 | QString DateFormat::toWordString() const |
86 | { | 86 | { |
87 | QString buf = ""; | 87 | QString buf = ""; |
88 | // for each part of the order | 88 | // for each part of the order |
89 | for (int i = 0; i < 3; i++) { | 89 | for (int i = 0; i < 3; i++) { |
90 | // switch on the relavent 3 bits. | 90 | // switch on the relavent 3 bits. |
91 | switch((_longOrder >> (i * 3)) & 0x0007) { | 91 | switch((_longOrder >> (i * 3)) & 0x0007) { |
92 | case 0x0001: | 92 | case 0x0001: |
93 | buf += QObject::tr( "day" ); | 93 | buf += QObject::tr( "day" ); |
94 | if (i < 2) { | 94 | if (i < 2) { |
95 | if ((_shortOrder << ((i+1) * 3)) & 0x0007) | 95 | if ((_shortOrder << ((i+1) * 3)) & 0x0007) |
96 | buf += ", "; | 96 | buf += ", "; |
97 | else | 97 | else |
98 | buf += " "; | 98 | buf += " "; |
99 | } | 99 | } |
100 | break; | 100 | break; |
101 | case 0x0002: | 101 | case 0x0002: |
102 | buf += QObject::tr( "month" ); | 102 | buf += QObject::tr( "month" ); |
103 | if (i < 2) | 103 | if (i < 2) |
104 | buf += " "; | 104 | buf += " "; |
105 | break; | 105 | break; |
106 | case 0x0004: | 106 | case 0x0004: |
107 | buf += QObject::tr( "year" ); | 107 | buf += QObject::tr( "year" ); |
108 | if (i < 2) | 108 | if (i < 2) |
109 | buf += ", "; | 109 | buf += ", "; |
110 | break; | 110 | break; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | return buf; | 113 | return buf; |
114 | } | 114 | } |
115 | 115 | ||
116 | QString DateFormat::numberDate(const QDate &d, int v) const | 116 | QString DateFormat::numberDate(const QDate &d, int v) const |
117 | { | 117 | { |
118 | QString buf = ""; | 118 | QString buf = ""; |
119 | 119 | ||
120 | int pad = 2; | 120 | int pad = 2; |
121 | 121 | ||
diff --git a/library/timestring.h b/library/timestring.h index 0335715..875c8bf 100644 --- a/library/timestring.h +++ b/library/timestring.h | |||
@@ -57,84 +57,94 @@ public: | |||
57 | } | 57 | } |
58 | 58 | ||
59 | // verbosity specifiers | 59 | // verbosity specifiers |
60 | enum Verbosity { | 60 | enum Verbosity { |
61 | shortNumber = 0x01, // default | 61 | shortNumber = 0x01, // default |
62 | longNumber = 0x02, | 62 | longNumber = 0x02, |
63 | 63 | ||
64 | padNumber = 0x04, | 64 | padNumber = 0x04, |
65 | 65 | ||
66 | shortWord = 0x08, // default | 66 | shortWord = 0x08, // default |
67 | longWord = 0x10, | 67 | longWord = 0x10, |
68 | 68 | ||
69 | showWeekDay = 0x20 | 69 | showWeekDay = 0x20 |
70 | }; | 70 | }; |
71 | 71 | ||
72 | QString toNumberString() const; // the M/D/Y string. | 72 | QString toNumberString() const; // the M/D/Y string. |
73 | QString toWordString() const; // the Month day, year string. | 73 | QString toWordString() const; // the Month day, year string. |
74 | 74 | ||
75 | QString numberDate(const QDate &d, int v = 0) const; | 75 | QString numberDate(const QDate &d, int v = 0) const; |
76 | QString wordDate(const QDate &d, int v = 0) const; | 76 | QString wordDate(const QDate &d, int v = 0) const; |
77 | 77 | ||
78 | #ifndef QT_NO_DATASTREAM | 78 | #ifndef QT_NO_DATASTREAM |
79 | void load(QDataStream&); | 79 | void load(QDataStream&); |
80 | void save(QDataStream&) const; | 80 | void save(QDataStream&) const; |
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | QChar separator() const { return _shortSeparator; }; | 83 | QChar separator() const { return _shortSeparator; }; |
84 | Order shortOrder() const { return _shortOrder; }; | 84 | Order shortOrder() const { return _shortOrder; }; |
85 | Order longOrder() const { return _longOrder; }; | 85 | Order longOrder() const { return _longOrder; }; |
86 | 86 | ||
87 | private: | 87 | private: |
88 | Order _shortOrder; | 88 | Order _shortOrder; |
89 | Order _longOrder; | 89 | Order _longOrder; |
90 | QChar _shortSeparator; | 90 | QChar _shortSeparator; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | #ifndef QT_NO_DATASTREAM | 93 | #ifndef QT_NO_DATASTREAM |
94 | QDataStream &operator<<(QDataStream &s, const DateFormat&df); | 94 | QDataStream &operator<<(QDataStream &s, const DateFormat&df); |
95 | QDataStream &operator>>(QDataStream &s, DateFormat&df); | 95 | QDataStream &operator>>(QDataStream &s, DateFormat&df); |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | class TimeString | 98 | class TimeString |
99 | { | 99 | { |
100 | public: | 100 | public: |
101 | 101 | ||
102 | //enum DateFormat { MonthDayYear, DayMonthYear, ISO8601, | 102 | //enum DateFormat { MonthDayYear, DayMonthYear, ISO8601, |
103 | //YearMonthDay = ISO8601 }; | 103 | //YearMonthDay = ISO8601 }; |
104 | 104 | ||
105 | 105 | /** | |
106 | * @name Convience functions which use currentDateFormat | ||
107 | */ | ||
108 | //@{ | ||
106 | static QString shortDate( const QDate &d ) | 109 | static QString shortDate( const QDate &d ) |
107 | { return shortDate( d, currentDateFormat() ); } | 110 | { return shortDate( d, currentDateFormat() ); } |
108 | static QString dateString( const QDate &d ) | 111 | static QString dateString( const QDate &d ) |
109 | { return dateString( d, currentDateFormat() ); } | 112 | { return dateString( d, currentDateFormat() ); } |
110 | static QString longDateString( const QDate &d ) | 113 | static QString longDateString( const QDate &d ) |
111 | { return longDateString( d, currentDateFormat() ); } | 114 | { return longDateString( d, currentDateFormat() ); } |
115 | //@} | ||
112 | static QString dateString( const QDateTime &dt, bool ampm, bool seconds ) | 116 | static QString dateString( const QDateTime &dt, bool ampm, bool seconds ) |
113 | { return dateString( dt, ampm, seconds, currentDateFormat() ); } | 117 | { return dateString( dt, ampm, seconds, currentDateFormat() ); } |
114 | 118 | ||
119 | |||
120 | /** @name Do not use as they don't honor system settings for AMPM | ||
121 | * | ||
122 | */ | ||
123 | //@{ | ||
115 | static QString dateString( const QDateTime &t, bool ampm = false ); | 124 | static QString dateString( const QDateTime &t, bool ampm = false ); |
116 | static QString timeString( const QTime &t, bool ampm, bool seconds ); | 125 | static QString timeString( const QTime &t, bool ampm, bool seconds ); |
117 | static QString timeString( const QTime &t, bool ampm = false ); | 126 | static QString timeString( const QTime &t, bool ampm = false ); |
118 | static QString shortTime( bool ampm, bool seconds ); | 127 | static QString shortTime( bool ampm, bool seconds ); |
119 | static QString shortTime( bool ampm = false ); | 128 | static QString shortTime( bool ampm = false ); |
129 | //@} | ||
120 | 130 | ||
121 | static QString numberDateString( const QDate &d, DateFormat ); | 131 | static QString numberDateString( const QDate &d, DateFormat ); |
122 | static QString numberDateString( const QDate &d ) | 132 | static QString numberDateString( const QDate &d ) |
123 | { return numberDateString( d, currentDateFormat() ); } | 133 | { return numberDateString( d, currentDateFormat() ); } |
124 | static QString longNumberDateString( const QDate &d, DateFormat ); | 134 | static QString longNumberDateString( const QDate &d, DateFormat ); |
125 | static QString longNumberDateString( const QDate &d ) | 135 | static QString longNumberDateString( const QDate &d ) |
126 | { return longNumberDateString( d, currentDateFormat() ); } | 136 | { return longNumberDateString( d, currentDateFormat() ); } |
127 | 137 | ||
128 | static QString shortDate( const QDate &, DateFormat ); | 138 | static QString shortDate( const QDate &, DateFormat ); |
129 | static QString dateString( const QDate &, DateFormat ); | 139 | static QString dateString( const QDate &, DateFormat ); |
130 | static QString longDateString( const QDate &, DateFormat ); | 140 | static QString longDateString( const QDate &, DateFormat ); |
131 | 141 | ||
132 | static DateFormat currentDateFormat(); | 142 | static DateFormat currentDateFormat(); |
133 | 143 | ||
134 | private: | 144 | private: |
135 | static QString dateString( const QDateTime &t, bool ampm, bool seconds, DateFormat ); | 145 | static QString dateString( const QDateTime &t, bool ampm, bool seconds, DateFormat ); |
136 | 146 | ||
137 | 147 | ||
138 | }; | 148 | }; |
139 | 149 | ||
140 | #endif | 150 | #endif |