From 376df3218dec493dea11c20ffc8265bab22b5c6c Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Sun, 16 Nov 2014 18:28:16 +0300 Subject: [PATCH 1/2] Set piece size to (max) 4Mb instead of empty string when created torrent is very large. --- src/torrentcreator/torrentcreatordlg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/torrentcreator/torrentcreatordlg.cpp b/src/torrentcreator/torrentcreatordlg.cpp index 96743ee84..114f4c3f4 100644 --- a/src/torrentcreator/torrentcreatordlg.cpp +++ b/src/torrentcreator/torrentcreatordlg.cpp @@ -238,7 +238,7 @@ void TorrentCreatorDlg::updateOptimalPieceSize() break; } ++i; - }while(isetCurrentIndex(i); } From 98a900e67d14352f81dc86bb9ecc1c2ce58e0762 Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Sun, 16 Nov 2014 18:32:20 +0300 Subject: [PATCH 2/2] Fix emptying of piece size combobox when user checks "auto" checkbox. The function computePathSize returns -1 if file isn't found, not 0. --- src/torrentcreator/torrentcreatordlg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/torrentcreator/torrentcreatordlg.cpp b/src/torrentcreator/torrentcreatordlg.cpp index 114f4c3f4..167758201 100644 --- a/src/torrentcreator/torrentcreatordlg.cpp +++ b/src/torrentcreator/torrentcreatordlg.cpp @@ -220,9 +220,9 @@ void TorrentCreatorDlg::on_checkAutoPieceSize_clicked(bool checked) void TorrentCreatorDlg::updateOptimalPieceSize() { - quint64 torrent_size = fsutils::computePathSize(textInputPath->text()); + qint64 torrent_size = fsutils::computePathSize(textInputPath->text()); qDebug("Torrent size is %lld", torrent_size); - if (torrent_size == 0) return; + if (torrent_size < 0) return; int i = 0; qulonglong nb_pieces = 0; do {