| 304 | } |
| 305 | |
| 306 | void ComputeMaxDateWidth() |
| 307 | { |
| 308 | // Generate a time object for a relatively wide time: 2000-02-20 00:00:00 |
| 309 | std::tm tm; |
| 310 | tm.tm_sec = 0; |
| 311 | tm.tm_min = 0; |
| 312 | tm.tm_hour = 0; |
| 313 | tm.tm_mday = 20; |
| 314 | tm.tm_mon = 2; |
| 315 | tm.tm_year = 100; |
| 316 | tm.tm_wday = 5; |
| 317 | tm.tm_yday = 51; |
| 318 | tm.tm_isdst = -1; |
| 319 | |
| 320 | std::time_t long_time = mktime(&tm); |
| 321 | |
| 322 | // Check how this date is represented (e.g. 2000-02-20, or 00/02/20) |
| 323 | std::string date = Platform::FormatShortDate(long_time); |
| 324 | maxDateWidth = getStringWidth(date.c_str(), FontStyle::medium) + kDateTimeGap; |
| 325 | |
| 326 | // Some locales do not use leading zeros for months and days, so let's try October, too. |
| 327 | tm.tm_mon = 10; |
| 328 | tm.tm_yday = 294; |
| 329 | long_time = mktime(&tm); |
| 330 | |
| 331 | // Again, check how this date is represented (e.g. 2000-10-20, or 00/10/20) |
| 332 | date = Platform::FormatShortDate(long_time); |
| 333 | maxDateWidth = std::max(maxDateWidth, getStringWidth(date.c_str(), FontStyle::medium) + kDateTimeGap); |
| 334 | |
| 335 | // Time appears to be universally represented with two digits for minutes, so 12:00 or 00:00 should be |
| 336 | // representable. |
| 337 | std::string time = Platform::FormatTime(long_time); |
| 338 | maxTimeWidth = getStringWidth(time.c_str(), FontStyle::medium) + kDateTimeGap; |
| 339 | } |
| 340 | |
| 341 | void LoadPreview() |
| 342 | { |
nothing calls this directly
no test coverage detected