QString getDownloadFilename(QString title, QString url) { QString fileprefix = GetConfDir(); QDir dir(fileprefix); if (!dir.exists()) dir.mkdir(fileprefix); fileprefix += "/cache/metadata-thumbcache"; dir = QDir(fileprefix); if (!dir.exists()) dir.mkdir(fileprefix); QByteArray titlearr(title.toLatin1()); quint16 titleChecksum = qChecksum(titlearr.data(), titlearr.length()); QByteArray urlarr(url.toLatin1()); quint16 urlChecksum = qChecksum(urlarr.data(), urlarr.length()); QUrl qurl(url); QString ext = QFileInfo(qurl.path()).suffix(); QString basefilename = QString("thumbnail_%1_%2.%3") .arg(QString::number(urlChecksum)) .arg(QString::number(titleChecksum)).arg(ext); QString outputfile = QString("%1/%2").arg(fileprefix).arg(basefilename); return outputfile; }
QString GetDownloadFilename(QString title, QString url) { QByteArray urlarr(url.toLatin1()); quint16 urlChecksum = qChecksum(urlarr.data(), urlarr.length()); QByteArray titlearr(title.toLatin1()); quint16 titleChecksum = qChecksum(titlearr.data(), titlearr.length()); QUrl qurl(url); QString ext = QFileInfo(qurl.path()).suffix(); QString basefilename = QString("download_%1_%2.%3") .arg(QString::number(urlChecksum)) .arg(QString::number(titleChecksum)).arg(ext); return basefilename; }