288 } |
288 } |
289 |
289 |
290 assert (false); |
290 assert (false); |
291 return 0.0; |
291 return 0.0; |
292 } |
292 } |
|
293 |
|
294 |
|
295 // ============================================================================= |
|
296 // |
|
297 QString prettyFileSize (qint64 size) |
|
298 { |
|
299 QString result; |
|
300 |
|
301 if (size < 1024) |
|
302 return QString::number (size) + " bytes"; |
|
303 else if (size < (1024 * 1024)) |
|
304 return QString::number ((double) size / 1024, 'f', 1) + " Kb"; |
|
305 else if (size < (1024 * 1024 * 1024)) |
|
306 return QString::number ((double) size / (1024 * 1024), 'f', 1) + " Mb"; |
|
307 else |
|
308 return QString::number ((double) size / (1024 * 1024 * 1024), 'f', 1) + " Gb"; |
|
309 } |