130 std::function<qint64(
const QString & )> dirSize;
131 dirSize = [&dirSize](
const QString & dirPath ) -> qint64
136 const QStringList filePaths = dir.entryList( QDir::Files | QDir::System | QDir::Hidden );
137 for (
const QString &filePath : filePaths )
139 QFileInfo fi( dir, filePath );
143 const QStringList childDirPaths = dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::NoSymLinks );
144 for (
const QString &childDirPath : childDirPaths )
146 size += dirSize( dirPath + QDir::separator() + childDirPath );
153 QStorageInfo storageInfo( cacheDir );
154 bytesFree = storageInfo.bytesFree() + dirSize( cacheDir );
158 qint64 available10MB = bytesFree / 1024 / ( 1024LL * 10 );
159 qint64 cacheSize10MB = 0;
160 if ( available10MB > 2500 )
167 if ( available10MB > 700 )
170 cacheSize10MB += ( available10MB - 700 ) * 0.025;
173 if ( available10MB > 50 )
176 cacheSize10MB += ( available10MB - 50 ) * 0.075;
180#if defined( Q_OS_ANDROID )
184 cacheSize10MB += std::max( 2LL,
static_cast<qint64
>( available10MB * 0.16 ) );
187 cacheSize10MB += std::max( 5LL,
static_cast<qint64
>( available10MB * 0.30 ) );
190 cacheSize = cacheSize10MB * 10 * 1024 * 1024;