128 std::function<qint64(
const QString & )> dirSize;
129 dirSize = [&dirSize](
const QString & dirPath ) -> qint64
134 const QStringList filePaths = dir.entryList( QDir::Files | QDir::System | QDir::Hidden );
135 for (
const QString &filePath : filePaths )
137 QFileInfo fi( dir, filePath );
141 const QStringList childDirPaths = dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::NoSymLinks );
142 for (
const QString &childDirPath : childDirPaths )
144 size += dirSize( dirPath + QDir::separator() + childDirPath );
151 QStorageInfo storageInfo( cacheDir );
152 bytesFree = storageInfo.bytesFree() + dirSize( cacheDir );
156 qint64 available10MB = bytesFree / 1024 / ( 1024LL * 10 );
157 qint64 cacheSize10MB = 0;
158 if ( available10MB > 2500 )
165 if ( available10MB > 700 )
168 cacheSize10MB += ( available10MB - 700 ) * 0.025;
171 if ( available10MB > 50 )
174 cacheSize10MB += ( available10MB - 50 ) * 0.075;
178#if defined( Q_OS_ANDROID )
182 cacheSize10MB += std::max( 2LL,
static_cast<qint64
>( available10MB * 0.16 ) );
185 cacheSize10MB += std::max( 5LL,
static_cast<qint64
>( available10MB * 0.30 ) );
188 cacheSize = cacheSize10MB * 10 * 1024 * 1024;