mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Code clean up
This commit is contained in:
parent
f379084b68
commit
4828a05ced
@ -79,16 +79,9 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
|
|||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
const QString default_dir = settings.value(QString::fromUtf8("TorrentImport/LastContentDir"), QDir::homePath()).toString();
|
const QString default_dir = settings.value(QString::fromUtf8("TorrentImport/LastContentDir"), QDir::homePath()).toString();
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
|
||||||
file_storage fs = t->files();
|
|
||||||
#endif
|
|
||||||
if(t->num_files() == 1) {
|
if(t->num_files() == 1) {
|
||||||
// Single file torrent
|
// Single file torrent
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
|
||||||
const QString file_name = misc::fileName(misc::toQStringU(fs.file_path(t->file_at(0)));
|
|
||||||
#else
|
|
||||||
const QString file_name = misc::toQStringU(t->file_at(0).path.filename());
|
const QString file_name = misc::toQStringU(t->file_at(0).path.filename());
|
||||||
#endif
|
|
||||||
qDebug("Torrent has only one file: %s", qPrintable(file_name));
|
qDebug("Torrent has only one file: %s", qPrintable(file_name));
|
||||||
QString extension = misc::file_extension(file_name);
|
QString extension = misc::file_extension(file_name);
|
||||||
qDebug("File extension is : %s", qPrintable(extension));
|
qDebug("File extension is : %s", qPrintable(extension));
|
||||||
@ -154,11 +147,7 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
|
|||||||
// Check file sizes
|
// Check file sizes
|
||||||
torrent_info::file_iterator it; t->begin_files();
|
torrent_info::file_iterator it; t->begin_files();
|
||||||
for(it = t->begin_files(); it != t->end_files(); it++) {
|
for(it = t->begin_files(); it != t->end_files(); it++) {
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
|
||||||
const QString rel_path = misc::toQStringU(fs.file_path(*it));
|
|
||||||
#else
|
|
||||||
const QString rel_path = misc::toQStringU(it->path.string());
|
const QString rel_path = misc::toQStringU(it->path.string());
|
||||||
#endif
|
|
||||||
if(QFile(QDir::cleanPath(content_dir.absoluteFilePath(rel_path))).size() != it->size) {
|
if(QFile(QDir::cleanPath(content_dir.absoluteFilePath(rel_path))).size() != it->size) {
|
||||||
qDebug("%s is %lld",
|
qDebug("%s is %lld",
|
||||||
qPrintable(QDir::cleanPath(content_dir.absoluteFilePath(rel_path))), (long long int) QFile(QDir::cleanPath(content_dir.absoluteFilePath(rel_path))).size());
|
qPrintable(QDir::cleanPath(content_dir.absoluteFilePath(rel_path))), (long long int) QFile(QDir::cleanPath(content_dir.absoluteFilePath(rel_path))).size());
|
||||||
@ -264,15 +253,8 @@ void TorrentImportDlg::initializeFilesPath()
|
|||||||
{
|
{
|
||||||
m_filesPath.clear();
|
m_filesPath.clear();
|
||||||
// Loads files path in the torrent
|
// Loads files path in the torrent
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
|
||||||
file_storage fs = t->files();
|
|
||||||
#endif
|
|
||||||
for(int i=0; i<t->num_files(); ++i) {
|
for(int i=0; i<t->num_files(); ++i) {
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
|
||||||
m_filesPath << misc::toQStringU(fs.file_path(t->file_at(i))).replace("\\", "/");
|
|
||||||
#else
|
|
||||||
m_filesPath << misc::toQStringU(t->file_at(i).path.string()).replace("\\", "/");
|
m_filesPath << misc::toQStringU(t->file_at(i).path.string()).replace("\\", "/");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user