equal
deleted
inserted
replaced
233 |
233 |
234 // get file size as string |
234 // get file size as string |
235 static QString FileSizeStr(const QString & path) |
235 static QString FileSizeStr(const QString & path) |
236 { |
236 { |
237 qint64 size = QFileInfo(path).size(); |
237 qint64 size = QFileInfo(path).size(); |
|
238 |
|
239 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) |
238 return QLocale().formattedDataSize(size); |
240 return QLocale().formattedDataSize(size); |
|
241 #else |
|
242 qint64 KiB = 1024; |
|
243 qint64 MiB = 1024*KiB; |
|
244 qint64 GiB = 1024*MiB; |
|
245 QString sizeStr; |
|
246 float fsize = (float) size; |
|
247 if (size >= GiB) |
|
248 return QString("%1 GiB").arg(QLocale().toString(fsize/GiB, 'f', 2)); |
|
249 if (size >= MiB) |
|
250 return QString("%1 MiB").arg(QLocale().toString(fsize/MiB, 'f', 2)); |
|
251 if (size >= KiB) |
|
252 return QString("%1 KiB").arg(QLocale().toString(fsize/KiB, 'f', 2)); |
|
253 return PageVideos::tr("%1 bytes", "", size).arg(QString::number(size)); |
|
254 #endif |
239 } |
255 } |
240 |
256 |
241 // set file size in file list in specified row |
257 // set file size in file list in specified row |
242 void PageVideos::updateSize(int row) |
258 void PageVideos::updateSize(int row) |
243 { |
259 { |