1
mirror of https://github.com/qbittorrent/qBittorrent synced 2024-11-17 03:48:39 +01:00

- Selective download should be fixed

- updated polish translation
This commit is contained in:
Christophe Dumez 2006-10-08 00:37:51 +00:00
parent c32fe3a41d
commit 035f2bdf18
6 changed files with 115 additions and 76 deletions

View File

@ -1,12 +1,12 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.7.0
- FEATURE: Based on new libtorrent v0.11 (a lot of bugfixes, new features)
- FEATURE: Added DHT (Trackerless) support
- FEATURE: Added support for incremental download (slower but good for previewing)
- FEATURE: Added DHT (Trackerless - Decentralized BT) support
- FEATURE: Audio/Video File previewing while downloading
- FEATURE: Tracker authentication support
- FEATURE: Added support for incremental download (slower but great for previewing)
- FEATURE: Added Tracker authentication support
- FEATURE: Defined qBittorrent fingerprint so that it doesn't use libtorrent fingerprint anymore
- FEATURE: Display an explicit error message when a download from url fails
- FEATURE: Allow the download multiple torrents from their url at once
- FEATURE: Allow the download multiple torrents from urls at once
- FEATURE: New context menu on main window (Add, Start all, Pause all, Exit...)
- FEATURE: Now supports one new search engines (MegaNova)
- FEATURE: Rewritten search engine plugin (by fab31)

View File

@ -735,16 +735,19 @@ bool GUI::loadFilteredPieces(torrent_handle &h){
std::cout << "Error: Corrupted pieces file\n";
return has_filtered_pieces;
}
std::vector<bool> selectionBitmask;
for(int i=0; i<torrentInfo.num_files(); ++i){
int isFiltered = pieces_selection_list.at(i).toInt();
if( isFiltered < 0 || isFiltered > 1){
isFiltered = 0;
}
h.filter_piece(i, pieces_selection_list.at(i).toInt());
selectionBitmask.push_back(isFiltered);
// h.filter_piece(i, isFiltered);
if(isFiltered){
has_filtered_pieces = true;
}
}
h.filter_files(selectionBitmask);
return has_filtered_pieces;
}

Binary file not shown.

View File

@ -128,19 +128,19 @@ Wszystkie prawa zastrżeżone © 2006 Christophe Dumez&lt;br&gt;(new line)
</message>
<message>
<source>Birthday:</source>
<translation type="unfinished"></translation>
<translation>Urodzony:</translation>
</message>
<message>
<source>Occupation:</source>
<translation type="unfinished"></translation>
<translation>Zawód:</translation>
</message>
<message>
<source>03/05/1985</source>
<translation type="unfinished">03/05/1985</translation>
<translation>03/05/1985</translation>
</message>
<message>
<source>Student in computer science</source>
<translation type="unfinished"></translation>
<translation>Student informatyki</translation>
</message>
</context>
<context>
@ -422,23 +422,23 @@ Wszystkie prawa zastrżeżone © 2006 Christophe Dumez&lt;br&gt;(new line)
</message>
<message>
<source>DHT (Trackerless):</source>
<translation type="unfinished"></translation>
<translation>DHT (Trackerless):</translation>
</message>
<message>
<source>Disable DHT (Trackerless) support</source>
<translation type="unfinished"></translation>
<translation>Wyłącz obsługę DHT (trackerless)</translation>
</message>
<message>
<source>Automatically clear finished downloads</source>
<translation type="unfinished"></translation>
<translation>Automatycznie usuń zakończone</translation>
</message>
<message>
<source>Preview program</source>
<translation type="unfinished"></translation>
<translation>Otwórz za pomocą</translation>
</message>
<message>
<source>Audio/Video player:</source>
<translation type="unfinished"></translation>
<translation>Odtwarzacz multimedialny:</translation>
</message>
</context>
<context>
@ -817,35 +817,36 @@ Changelog:
</message>
<message>
<source>Preview process already running</source>
<translation type="unfinished"></translation>
<translation>Podgląd jest już uruchomiony</translation>
</message>
<message>
<source>There is already another preview process running.
Please close the other one first.</source>
<translation type="unfinished"></translation>
<translation>Podgląd jest już uruchomiony.
Zamknij najpierw okno podglądu.</translation>
</message>
<message>
<source>Couldn&apos;t download</source>
<comment>Couldn&apos;t download &lt;file&gt;</comment>
<translation type="unfinished"></translation>
<translation>Nie można pobrać</translation>
</message>
<message>
<source>reason:</source>
<comment>Reason why the download failed</comment>
<translation type="unfinished"></translation>
<translation>powód:</translation>
</message>
<message>
<source>Downloading</source>
<comment>Example: Downloading www.example.com/test.torrent</comment>
<translation type="unfinished">Pobieranie</translation>
<translation>Pobieranie</translation>
</message>
<message>
<source>Please wait...</source>
<translation type="unfinished"></translation>
<translation>Proszę czekać...</translation>
</message>
<message>
<source>Transfers</source>
<translation type="unfinished"></translation>
<translation>Prędkość</translation>
</message>
</context>
<context>
@ -1048,26 +1049,26 @@ Please close the other one first.</source>
</message>
<message>
<source>Transfers</source>
<translation type="unfinished"></translation>
<translation>Prędkość</translation>
</message>
<message>
<source>Preview file</source>
<translation type="unfinished"></translation>
<translation>Podgląd pliku</translation>
</message>
<message>
<source>Clear log</source>
<translation type="unfinished"></translation>
<translation>Wyczyść logi</translation>
</message>
</context>
<context>
<name>PropListDelegate</name>
<message>
<source>False</source>
<translation type="unfinished">Nie</translation>
<translation>Nie</translation>
</message>
<message>
<source>True</source>
<translation type="unfinished">Tak</translation>
<translation>Tak</translation>
</message>
</context>
<context>
@ -1109,62 +1110,62 @@ Please close the other one first.</source>
</message>
<message>
<source>Preview impossible</source>
<translation type="unfinished"></translation>
<translation>Nie ma możliwość podglądu</translation>
</message>
<message>
<source>Sorry, we can&apos;t preview this file</source>
<translation type="unfinished"></translation>
<translation>Przepraszamy, podgląd pliku jest niedostępny</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished">Nazwa</translation>
<translation>Nazwa</translation>
</message>
<message>
<source>Size</source>
<translation type="unfinished">Rozmiar</translation>
<translation>Rozmiar</translation>
</message>
<message>
<source>Progress</source>
<translation type="unfinished">Postęp</translation>
<translation>Postęp</translation>
</message>
<message>
<source>No URL entered</source>
<translation type="unfinished"></translation>
<translation>Nie wprowadzono adresu URL</translation>
</message>
<message>
<source>Please type at least one URL.</source>
<translation type="unfinished"></translation>
<translation>Proszę podać przynajmniej jeden adres URL.</translation>
</message>
</context>
<context>
<name>authentication</name>
<message>
<source>Tracker authentication</source>
<translation type="unfinished"></translation>
<translation>Autoryzacja do tracker-a</translation>
</message>
<message>
<source>Tracker:</source>
<translation type="unfinished"></translation>
<translation>Tracker:</translation>
</message>
<message>
<source>Login</source>
<translation type="unfinished"></translation>
<translation>Login</translation>
</message>
<message>
<source>Username:</source>
<translation type="unfinished"></translation>
<translation>Nazwa użytkownika:</translation>
</message>
<message>
<source>Password:</source>
<translation type="unfinished">Hasło:</translation>
<translation>Hasło:</translation>
</message>
<message>
<source>Log in</source>
<translation type="unfinished"></translation>
<translation>Zaloguj</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Anuluj</translation>
<translation>Anuluj</translation>
</message>
</context>
<context>
@ -1277,23 +1278,23 @@ Please close the other one first.</source>
<name>downloadFromURL</name>
<message>
<source>Download Torrents from URLs</source>
<translation type="unfinished"></translation>
<translation>Pobierz Torrenty z adresów URL</translation>
</message>
<message>
<source>Only one URL per line</source>
<translation type="unfinished"></translation>
<translation>W linii możesz podać tylko jeden adres URL</translation>
</message>
<message>
<source>Download</source>
<translation type="unfinished">Pobierz</translation>
<translation>Pobierz</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Anuluj</translation>
<translation>Anuluj</translation>
</message>
<message>
<source>Download from urls</source>
<translation type="unfinished"></translation>
<translation>Pobierz z adresów</translation>
</message>
</context>
<context>
@ -1439,30 +1440,30 @@ Please close the other one first.</source>
</message>
<message>
<source>Choose your favourite preview program</source>
<translation type="unfinished"></translation>
<translation>Wybierz program którym zawsze chcesz otwierać dany typ plików</translation>
</message>
</context>
<context>
<name>preview</name>
<message>
<source>Preview selection</source>
<translation type="unfinished"></translation>
<translation>Podgląd wybranego</translation>
</message>
<message>
<source>File preview</source>
<translation type="unfinished"></translation>
<translation>Podgląd pliku</translation>
</message>
<message>
<source>The following files support previewing, &lt;br&gt;please select one of them:</source>
<translation type="unfinished"></translation>
<translation>Istnieje możliwość podglądu następujących typów plików, &lt;br&gt; proszę wybrać jeden z nich:</translation>
</message>
<message>
<source>Preview</source>
<translation type="unfinished"></translation>
<translation>Podgląd</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Anuluj</translation>
<translation>Anuluj</translation>
</message>
</context>
<context>
@ -1641,15 +1642,15 @@ Please close the other one first.</source>
</message>
<message>
<source>Options</source>
<translation type="unfinished">Opcje</translation>
<translation>Opcje</translation>
</message>
<message>
<source>Download in correct order (slower but good for previewing)</source>
<translation type="unfinished"></translation>
<translation>Pobierz w ustalonej kolejności (wolniejsze ale lepsze przy korzystaniu z opcji poglądu)</translation>
</message>
<message>
<source>Share Ratio:</source>
<translation type="unfinished"></translation>
<translation>Ratio:</translation>
</message>
</context>
</TS>

View File

@ -130,14 +130,8 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr
PropListModel->setData(PropListModel->index(row, NAME), QVariant(torrentInfo.file_at(i).path.leaf().c_str()));
PropListModel->setData(PropListModel->index(row, SIZE), QVariant((qlonglong)torrentInfo.file_at(i).size));
PropListModel->setData(PropListModel->index(row, PROGRESS), QVariant((double)fp[i]));
if(h.is_piece_filtered(i)){
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(false));
setRowColor(row, "red");
}else{
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(true));
setRowColor(row, "green");
}
}
loadFilteredPieces();
// Incremental download
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+QString(torrentInfo.name().c_str())+".incremental")){
incrementalDownload->setChecked(true);
@ -147,12 +141,6 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr
updateProgressTimer = new QTimer(this);
connect(updateProgressTimer, SIGNAL(timeout()), this, SLOT(updateProgress()));
updateProgressTimer->start(2000);
std::vector<bool> filters = h.filtered_pieces();
// std::cout << "filtered pieces: ";
// for(int i=0; i<torrentInfo.num_files(); ++i){
// std::cout << filters.at(i) << " ";
// }
// std::cout << '\n';
}
properties::~properties(){
@ -161,6 +149,40 @@ properties::~properties(){
delete PropListModel;
}
void properties::loadFilteredPieces(){
torrent_info torrentInfo = h.get_torrent_info();
QString fileName = QString(torrentInfo.name().c_str());
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileName+".pieces");
// Read saved file
if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){
selectionBitmask.assign(torrentInfo.num_files(), 0);
return;
}
QByteArray pieces_selection = pieces_file.readAll();
pieces_file.close();
QList<QByteArray> pieces_selection_list = pieces_selection.split('\n');
if(pieces_selection_list.size() != torrentInfo.num_files()+1){
std::cout << "Error: Corrupted pieces file\n";
selectionBitmask.assign(torrentInfo.num_files(), 0);
return;
}
for(int i=0; i<torrentInfo.num_files(); ++i){
int isFiltered = pieces_selection_list.at(i).toInt();
if( isFiltered < 0 || isFiltered > 1){
isFiltered = 0;
}
selectionBitmask.push_back(isFiltered);
// h.filter_piece(i, isFiltered);
if(isFiltered){
PropListModel->setData(PropListModel->index(i, SELECTED), QVariant(false));
setRowColor(i, "red");
}else{
PropListModel->setData(PropListModel->index(i, SELECTED), QVariant(true));
setRowColor(i, "green");
}
}
}
void properties::updateProgress(){
std::vector<float> fp;
h.file_progress(fp);
@ -181,19 +203,24 @@ void properties::setRowColor(int row, QString color){
// double click on it.
void properties::toggleSelectedState(const QModelIndex& index){
int row = index.row();
if(h.is_piece_filtered(row)){
if(selectionBitmask.at(row)){
// File is selected
h.filter_piece(row, false);
selectionBitmask.erase(selectionBitmask.begin()+row);
selectionBitmask.insert(selectionBitmask.begin()+row, 0);
// h.filter_piece(row, false);
// Update list infos
setRowColor(row, "green");
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(true));
}else{
// File is not selected
h.filter_piece(row, true);
selectionBitmask.erase(selectionBitmask.begin()+row);
selectionBitmask.insert(selectionBitmask.begin()+row, 1);
// h.filter_piece(row, true);
// Update list infos
setRowColor(row, "red");
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(false));
}
h.filter_files(selectionBitmask);
// Save filtered pieces to a file to remember them
saveFilteredPieces();
}
@ -220,9 +247,12 @@ void properties::on_select_clicked(){
foreach(index, selectedIndexes){
if(index.column() == NAME){
int row = index.row();
if(h.is_piece_filtered(row)){
if(selectionBitmask.at(row)){
// File is selected
h.filter_piece(row, false);
selectionBitmask.erase(selectionBitmask.begin()+row);
selectionBitmask.insert(selectionBitmask.begin()+row, 0);
h.filter_files(selectionBitmask);
// h.filter_piece(row, false);
// Update list infos
setRowColor(row, "green");
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(true));
@ -244,9 +274,12 @@ void properties::on_unselect_clicked(){
foreach(index, selectedIndexes){
if(index.column() == NAME){
int row = index.row();
if(!h.is_piece_filtered(row)){
if(!selectionBitmask.at(row)){
// File is selected
h.filter_piece(row, true);
selectionBitmask.erase(selectionBitmask.begin()+row);
selectionBitmask.insert(selectionBitmask.begin()+row, 1);
h.filter_files(selectionBitmask);
// h.filter_piece(row, true);
// Update list infos
setRowColor(row, "red");
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(false));
@ -270,11 +303,11 @@ void properties::saveFilteredPieces(){
return;
}
for(int i=0; i<torrentInfo.num_files(); ++i){
if(h.is_piece_filtered(i)){
if(selectionBitmask.at(i)){
pieces_file.write(QByteArray("1\n"));
hasFilteredPieces = true;
}else{
pieces_file.write(QByteArray("0\n"));
hasFilteredPieces = true;
}
}
pieces_file.close();

View File

@ -38,6 +38,7 @@ class properties : public QDialog, private Ui::properties{
PropListDelegate *PropDelegate;
QStandardItemModel *PropListModel;
QTimer *updateProgressTimer;
std::vector<bool> selectionBitmask;
protected slots:
void on_select_clicked();
@ -48,6 +49,7 @@ class properties : public QDialog, private Ui::properties{
void toggleSelectedState(const QModelIndex& index);
void saveFilteredPieces();
void updateProgress();
void loadFilteredPieces();
signals:
void changedFilteredPieces(torrent_handle h, bool compact_mode);