Browse Source

- Selective download should be fixed

- updated polish translation
adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
035f2bdf18
  1. 8
      Changelog
  2. 5
      src/GUI.cpp
  3. BIN
      src/lang/qbittorrent_pl.qm
  4. 99
      src/lang/qbittorrent_pl.ts
  5. 77
      src/properties_imp.cpp
  6. 2
      src/properties_imp.h

8
Changelog

@ -1,12 +1,12 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.7.0 * Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.7.0
- FEATURE: Based on new libtorrent v0.11 (a lot of bugfixes, new features) - FEATURE: Based on new libtorrent v0.11 (a lot of bugfixes, new features)
- FEATURE: Added DHT (Trackerless) support - FEATURE: Added DHT (Trackerless - Decentralized BT) support
- FEATURE: Added support for incremental download (slower but good for previewing)
- FEATURE: Audio/Video File previewing while downloading - 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: 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: 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: New context menu on main window (Add, Start all, Pause all, Exit...)
- FEATURE: Now supports one new search engines (MegaNova) - FEATURE: Now supports one new search engines (MegaNova)
- FEATURE: Rewritten search engine plugin (by fab31) - FEATURE: Rewritten search engine plugin (by fab31)

5
src/GUI.cpp

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

BIN
src/lang/qbittorrent_pl.qm

Binary file not shown.

99
src/lang/qbittorrent_pl.ts

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

77
src/properties_imp.cpp

@ -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, 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, SIZE), QVariant((qlonglong)torrentInfo.file_at(i).size));
PropListModel->setData(PropListModel->index(row, PROGRESS), QVariant((double)fp[i])); 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 // Incremental download
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+QString(torrentInfo.name().c_str())+".incremental")){ if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+QString(torrentInfo.name().c_str())+".incremental")){
incrementalDownload->setChecked(true); incrementalDownload->setChecked(true);
@ -147,12 +141,6 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr
updateProgressTimer = new QTimer(this); updateProgressTimer = new QTimer(this);
connect(updateProgressTimer, SIGNAL(timeout()), this, SLOT(updateProgress())); connect(updateProgressTimer, SIGNAL(timeout()), this, SLOT(updateProgress()));
updateProgressTimer->start(2000); 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(){ properties::~properties(){
@ -161,6 +149,40 @@ properties::~properties(){
delete PropListModel; 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(){ void properties::updateProgress(){
std::vector<float> fp; std::vector<float> fp;
h.file_progress(fp); h.file_progress(fp);
@ -181,19 +203,24 @@ void properties::setRowColor(int row, QString color){
// double click on it. // double click on it.
void properties::toggleSelectedState(const QModelIndex& index){ void properties::toggleSelectedState(const QModelIndex& index){
int row = index.row(); int row = index.row();
if(h.is_piece_filtered(row)){ if(selectionBitmask.at(row)){
// File is selected // 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 // Update list infos
setRowColor(row, "green"); setRowColor(row, "green");
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(true)); PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(true));
}else{ }else{
// File is not selected // 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 // Update list infos
setRowColor(row, "red"); setRowColor(row, "red");
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(false)); PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(false));
} }
h.filter_files(selectionBitmask);
// Save filtered pieces to a file to remember them // Save filtered pieces to a file to remember them
saveFilteredPieces(); saveFilteredPieces();
} }
@ -220,9 +247,12 @@ void properties::on_select_clicked(){
foreach(index, selectedIndexes){ foreach(index, selectedIndexes){
if(index.column() == NAME){ if(index.column() == NAME){
int row = index.row(); int row = index.row();
if(h.is_piece_filtered(row)){ if(selectionBitmask.at(row)){
// File is selected // 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 // Update list infos
setRowColor(row, "green"); setRowColor(row, "green");
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(true)); PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(true));
@ -244,9 +274,12 @@ void properties::on_unselect_clicked(){
foreach(index, selectedIndexes){ foreach(index, selectedIndexes){
if(index.column() == NAME){ if(index.column() == NAME){
int row = index.row(); int row = index.row();
if(!h.is_piece_filtered(row)){ if(!selectionBitmask.at(row)){
// File is selected // 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 // Update list infos
setRowColor(row, "red"); setRowColor(row, "red");
PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(false)); PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(false));
@ -270,11 +303,11 @@ void properties::saveFilteredPieces(){
return; return;
} }
for(int i=0; i<torrentInfo.num_files(); ++i){ 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")); pieces_file.write(QByteArray("1\n"));
hasFilteredPieces = true;
}else{ }else{
pieces_file.write(QByteArray("0\n")); pieces_file.write(QByteArray("0\n"));
hasFilteredPieces = true;
} }
} }
pieces_file.close(); pieces_file.close();

2
src/properties_imp.h

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

Loading…
Cancel
Save