void DownloadView::onLoadFinished() { DownloadItem *item = qobject_cast<DownloadItem*>(sender()); QString file_name = item->fileName(); if (file_name.endsWith(".pdf") || file_name.endsWith(".epub") || file_name.endsWith(".txt") || file_name.endsWith(".pdb") || file_name.endsWith(".rtf") || file_name.endsWith(".mobi")) { latest_file_name_ = file_name; } if (download_manager_ != 0 && download_manager_->stillDownloading()) { return; } noticeLoadFinish(); }
QImage TransferThumbnailImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) { int width = requestedSize.width() > 0 ? requestedSize.width() : 200; int height = requestedSize.height() > 0 ? requestedSize.height() :100; if (size) *size = QSize(width, height); //Default image QImage image(width, height,QImage::Format_ARGB32); image.fill(qRgba(0, 0, 0, 0)); int transferId = id.toInt(); //Load from file DownloadItem* download = theApp->models()->downloadsModel()->get(transferId); Q_ASSERT(download); if(download == NULL) return image; QString type = theUtils->getFileExtension(download->fileName()); return theUtils->getFileTypeImage(type,width,height); }