Fix compile fail due to dependency in Qt 5.10 in pagevideos.cpp
authorWuzzy <Wuzzy2@mail.ru>
Wed, 28 Mar 2018 01:22:53 +0200
changeset 13289 6927e51acaef
parent 13288 ee8c6eb0ab47
child 13290 a3b07219a091
Fix compile fail due to dependency in Qt 5.10 in pagevideos.cpp
QTfrontend/ui/page/pagevideos.cpp
share/hedgewars/Data/Locale/hedgewars_de.ts
share/hedgewars/Data/Locale/hedgewars_en.ts
--- a/QTfrontend/ui/page/pagevideos.cpp	Tue Mar 27 23:01:22 2018 +0200
+++ b/QTfrontend/ui/page/pagevideos.cpp	Wed Mar 28 01:22:53 2018 +0200
@@ -235,7 +235,23 @@
 static QString FileSizeStr(const QString & path)
 {
     qint64 size = QFileInfo(path).size();
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
     return QLocale().formattedDataSize(size);
+#else
+    qint64 KiB = 1024;
+    qint64 MiB = 1024*KiB;
+    qint64 GiB = 1024*MiB;
+    QString sizeStr;
+    float fsize = (float) size;
+    if (size >= GiB)
+        return QString("%1 GiB").arg(QLocale().toString(fsize/GiB, 'f', 2));
+    if (size >= MiB)
+        return QString("%1 MiB").arg(QLocale().toString(fsize/MiB, 'f', 2));
+    if (size >= KiB)
+        return QString("%1 KiB").arg(QLocale().toString(fsize/KiB, 'f', 2));
+    return PageVideos::tr("%1 bytes", "", size).arg(QString::number(size));
+#endif
 }
 
 // set file size in file list in specified row
--- a/share/hedgewars/Data/Locale/hedgewars_de.ts	Tue Mar 27 23:01:22 2018 +0200
+++ b/share/hedgewars/Data/Locale/hedgewars_de.ts	Wed Mar 28 01:22:53 2018 +0200
@@ -2251,7 +2251,7 @@
     </message>
     <message numerus="yes">
         <source>%1 bytes</source>
-        <translation type="vanished">
+        <translation>
             <numerusform>%1 Byte</numerusform>
             <numerusform>%1 Bytes</numerusform>
         </translation>
--- a/share/hedgewars/Data/Locale/hedgewars_en.ts	Tue Mar 27 23:01:22 2018 +0200
+++ b/share/hedgewars/Data/Locale/hedgewars_en.ts	Wed Mar 28 01:22:53 2018 +0200
@@ -2139,7 +2139,7 @@
     </message>
     <message numerus="yes">
         <source>%1 bytes</source>
-        <translation type="vanished">
+        <translation>
             <numerusform>%1 byte</numerusform>
             <numerusform>%1 bytes</numerusform>
         </translation>