| 22 | } |
| 23 | |
| 24 | std::tuple<QString, qint64> calculateFileSize(const QFileInfo& file) |
| 25 | { |
| 26 | if (file.isDir()) { |
| 27 | auto dir = QDir(file.absoluteFilePath()); |
| 28 | dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot); |
| 29 | auto count = dir.count(); |
| 30 | auto str = QObject::tr("item"); |
| 31 | if (count != 1) |
| 32 | str = QObject::tr("items"); |
| 33 | return { QString("%1 %2").arg(QString::number(count), str), count }; |
| 34 | } |
| 35 | return { StringUtils::humanReadableFileSize(file.size(), true), file.size() }; |
| 36 | } |
| 37 | |
| 38 | void Resource::parseFile() |
| 39 | { |