From 117448fb0b79c179c2bb640201a27691f8927d98 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 6 Oct 2006 18:07:01 +0000 Subject: [PATCH] + - FEATURE: Now remembers filtered pieces in a torrent on restart + - FEATURE: Now updating pieces progress in real time in torrent properties + - BUGFIX: Fixed memory leaks in torrent properties Updated italian and German translation --- Changelog | 5 +- TODO | 5 +- src/GUI.cpp | 148 +++++++++++++++++- src/GUI.h | 3 + src/downloadThread.h | 2 +- src/lang/qbittorrent_de.qm | Bin 15006 -> 17504 bytes src/lang/qbittorrent_de.ts | 95 ++++++------ src/lang/qbittorrent_it.qm | Bin 15804 -> 18119 bytes src/lang/qbittorrent_it.ts | 302 +++++++------------------------------ src/properties_imp.cpp | 57 ++++++- src/properties_imp.h | 10 +- 11 files changed, 321 insertions(+), 306 deletions(-) diff --git a/Changelog b/Changelog index 394e3d201..5057f2576 100644 --- a/Changelog +++ b/Changelog @@ -14,6 +14,8 @@ - FEATURE: Individual share ratio is now displayed in each torrent properties. - FEATURE: Tuned default settings to improve download speed - FEATURE: Downloading from an URL will retry 10 times if too many users. + - FEATURE: Now remembers filtered pieces in a torrent on restart + - FEATURE: Now updating pieces progress in real time in torrent properties - I18N: Added Norwegian translation - BUGFIX: Fixed a memory leak when pressing OK in torrent properties - BUGFIX: Improved code so that GUI never freeze during downloading from an url @@ -30,7 +32,8 @@ - BUGFIX: Fixed Isohunt search engine - BUGFIX: Fixed download from URL function (was buggy) - BUGFIX: Fixed download button in search engine - - BUGFIX: Switched to full allocation mode to fix selective download + - BUGFIX: Fixed selective download + - BUGFIX: Fixed memory leaks in torrent properties - COSMETIC: Now displaying the number of downloads in tab title - COSMETIC: Redesigned download from url dialog - COSMETIC: Added a message to warn user that we started download from an url diff --git a/TODO b/TODO index 35b93693d..32647a07e 100644 --- a/TODO +++ b/TODO @@ -34,9 +34,6 @@ // Before 0.7.0 - Test tracker authentication - Wait for libtorrent v0.11rc release -- Fix this when deletingSelection sometimes: - terminate called after throwing an instance of 'libtorrent::invalid_handle' - what(): invalid torrent handle used - Abandon +- Fix selective download diff --git a/src/GUI.cpp b/src/GUI.cpp index 53569da2c..41bf02aae 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -719,6 +719,56 @@ void GUI::saveWindowSize() const{ } } +bool GUI::loadFilteredPieces(torrent_handle &h){ + bool has_filtered_pieces = false; + 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)){ + return has_filtered_pieces; + } + QByteArray pieces_selection = pieces_file.readAll(); + pieces_file.close(); + QList pieces_selection_list = pieces_selection.split('\n'); + if(pieces_selection_list.size() != torrentInfo.num_files()+1){ + std::cout << "Error: Corrupted pieces file\n"; + return has_filtered_pieces; + } + for(int i=0; i 1){ + isFiltered = 0; + } + h.filter_piece(i, pieces_selection_list.at(i).toInt()); + if(isFiltered){ + has_filtered_pieces = true; + } + } + return has_filtered_pieces; +} + +bool GUI::hasFilteredPieces(const QString& fileName){ + QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileName+".pieces"); + // Read saved file + if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){ + return false; + } + QByteArray pieces_selection = pieces_file.readAll(); + pieces_file.close(); + QList pieces_selection_list = pieces_selection.split('\n'); + for(int i=0; i 1){ + isFiltered = 0; + } + if(isFiltered){ + return true; + } + } + return false; +} + void GUI::loadWindowSize(){ qDebug("Loading window size"); QFile lastWindowSize(misc::qBittorrentPath()+"lastWindowSize.txt"); @@ -1075,6 +1125,8 @@ void GUI::saveFastResumeData() const{ bencode(std::ostream_iterator(out), resumeData); } } + // Remove torrent + s->remove_torrent(h); } qDebug("Fast resume data saved"); } @@ -1111,7 +1163,7 @@ void GUI::deleteAll(){ torrents = torrentBackup.entryList(); QString torrent; foreach(torrent, torrents){ - if(torrent.endsWith(".fastresume") || torrent.endsWith(".torrent") || torrent.endsWith(".paused") || torrent.endsWith(".incremental")){ + if(torrent.endsWith(".fastresume") || torrent.endsWith(".torrent") || torrent.endsWith(".pieces") || torrent.endsWith(".paused") || torrent.endsWith(".incremental")){ torrentBackup.remove(torrent); } } @@ -1175,6 +1227,7 @@ void GUI::deleteSelection(){ torrentBackup.remove(fileName+".fastresume"); torrentBackup.remove(fileName+".paused"); torrentBackup.remove(fileName+".incremental"); + torrentBackup.remove(fileName+".pieces"); // Update info bar setInfoBar("'" + fileName +"' "+tr("removed.", " removed.")); --nbTorrents; @@ -1276,9 +1329,17 @@ void GUI::addTorrents(const QStringList& pathsList, bool fromScanDir, const QStr } int row = DLListModel->rowCount(); // Adding files to bittorrent session - h = s->add_torrent(t, fs::path(saveDir.path().toStdString()), resume_data, false); + if(hasFilteredPieces(QString(t.name().c_str()))){ + h = s->add_torrent(t, fs::path(saveDir.path().toStdString()), resume_data, false); + qDebug("Full allocation mode"); + }else{ + h = s->add_torrent(t, fs::path(saveDir.path().toStdString()), resume_data, true); + qDebug("Compact allocation mode"); + } h.set_max_connections(60); h.set_max_uploads(-1); + // Load filtered pieces + loadFilteredPieces(h); //qDebug("Added to session"); torrent_status torrentStatus = h.status(); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress)); @@ -1378,6 +1439,88 @@ void GUI::addTorrents(const QStringList& pathsList, bool fromScanDir, const QStr } } +void GUI::reloadTorrent(const torrent_handle &h, bool compact_mode){ + QDir saveDir(options->getSavePath()), torrentBackup(misc::qBittorrentPath() + "BT_backup"); + QString fileName = QString(h.get_torrent_info().name().c_str()); + qDebug("Reloading torrent: %s", fileName.toStdString().c_str()); + torrent_handle new_h; + entry resumeData; + torrent_info t = h.get_torrent_info(); + // Checking if torrentBackup Dir exists + // create it if it is not + if(! torrentBackup.exists()){ + torrentBackup.mkpath(torrentBackup.path()); + } + // Write fast resume data + // Pause download (needed before fast resume writing) + h.pause(); + // Extracting resume data + if (h.has_metadata()){ + // get fast resume data + resumeData = h.write_resume_data(); + } + int row = -1; + // Delete item from download list + for(int i=0; irowCount(); ++i){ + if(DLListModel->data(DLListModel->index(i, NAME)).toString()==fileName){ + row = i; + break; + } + } + Q_ASSERT(row != -1); + DLListModel->removeRow(row); + // Remove torrent + s->remove_torrent(h); + handles.remove(fileName); + // Add torrent again to session + unsigned short timeout = 0; + while(h.is_valid() && timeout < 6){ + SleeperThread::msleep(1000); + ++timeout; + } + if(h.is_valid()){ + std::cout << "Error: Couldn't reload the torrent\n"; + return; + } + new_h = s->add_torrent(t, fs::path(saveDir.path().toStdString()), resumeData, compact_mode); + if(compact_mode){ + qDebug("Using compact allocation mode"); + }else{ + qDebug("Using full allocation mode"); + } + handles.insert(QString(t.name().c_str()), new_h); + new_h.set_max_connections(60); + new_h.set_max_uploads(-1); + // Load filtered pieces + loadFilteredPieces(new_h); + // Adding torrent to download list + DLListModel->insertRow(row); + DLListModel->setData(DLListModel->index(row, NAME), QVariant(t.name().c_str())); + DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)t.total_size())); + DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.)); + DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.)); + DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); + // Pause torrent if it was paused last time + if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+QString(t.name().c_str())+".paused")){ + DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Paused"))); + DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/paused.png")), Qt::DecorationRole); + setRowColor(row, "red"); + }else{ + DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Connecting..."))); + DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole); + setRowColor(row, "grey"); + } + // Pause torrent if it was paused last time + if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileName+".paused")){ + new_h.pause(); + } + // Incremental download + if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileName+".incremental")){ + qDebug("Incremental download enabled for %s", fileName.toStdString().c_str()); + new_h.set_sequenced_download_threshold(15); + } +} + // As program parameters, we can get paths or urls. // This function parse the parameters and call // the right addTorrent function, considering @@ -1409,6 +1552,7 @@ void GUI::showProperties(const QModelIndex &index){ torrent_handle h = handles.value(fileName); QStringList errors = trackerErrors.value(fileName, QStringList(tr("None"))); properties *prop = new properties(this, h, errors); + connect(prop, SIGNAL(changedFilteredPieces(torrent_handle, bool)), this, SLOT(reloadTorrent(torrent_handle, bool))); prop->show(); } diff --git a/src/GUI.h b/src/GUI.h index 7388bee07..5b42e022b 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -153,6 +153,9 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void addUnauthenticatedTracker(QPair tracker); void processDownloadedFile(QString url, QString file_path, int return_code, QString errorBuffer); void downloadFromURLList(const QStringList& url_list); + bool loadFilteredPieces(torrent_handle &h); + bool hasFilteredPieces(const QString& fileName); + void reloadTorrent(const torrent_handle &h, bool compact_mode = true); // Search slots void on_search_button_clicked(); void on_stop_search_button_clicked(); diff --git a/src/downloadThread.h b/src/downloadThread.h index 1faf8effd..f1c371ba2 100644 --- a/src/downloadThread.h +++ b/src/downloadThread.h @@ -119,7 +119,7 @@ class downloadThread : public QThread { QFile::remove(filePath.c_str()); return; } - int retries = 0; + unsigned short retries = 0; bool to_many_users = false; do{ // Perform Download diff --git a/src/lang/qbittorrent_de.qm b/src/lang/qbittorrent_de.qm index ba5ef0dd9d066eed510196bf2c3c87e9b0ee7d60..fa19d01441d0c2f41431719091d2bf9e563f7c60 100644 GIT binary patch delta 4181 zcmb7`3s_ZE7RT4Q_n!MW_k}z}9^wU&Hy02QyP0o8%^^k51}74P03R2Jha`?&6?8Ni zGfrYE`GuyEl3Lfww3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)Hr3kuJ| zRmSHUP(tTHW4Uk)UND|LhaQOL<(V#YeRQn+kbM%~kTad-L@^n1&c-CTNq%Wz6s(s^ zI_Bg4#|+8tflWlQg>qviUWnZ(zvHfeqq5qPM-&$#e^WH&8u>wT0NiQvl{UjJQ_w2( zLfki|#%=_P_ck@}7=)#!-s3~C#ne}Qk0@b*=|2*HuP*ehWmMk3j8Q@Y zSF1IF?Hctz!M|jc${D4~?y!7S2!EbsYL%NYzKSi?tbP!=nNbv{S*fx=t+0+_b&umu zjJiJB!YIQr9ZF|xt8y#JtR9UUWt8rOHq|@vG*g`vrYuX!Qo53QnM7r#pRal$IiFGT oXJ1lR%!y%?p}E28M{{kg8kb_yGI`3-?CEM%T0f({oIb+*4<= Birthday: - + Geburtstag: Occupation: - + Beschäftigung: 03/05/1985 - 03/05/1985 + 03.05.1985 Student in computer science - + Informatikstudent @@ -361,23 +361,23 @@ Copyright (c) 2006 Christophe Dumez<br> DHT (Trackerless): - + DHT (Trackerlos): Disable DHT (Trackerless) support - + Deaktiviere DHT (Trackerlos) Unterstützung Automatically clear finished downloads - + Abgeschlossene Downloads automatisch beseitigen Preview program - + Vorschau Programm Audio/Video player: - + Audio/Video Player: @@ -759,35 +759,36 @@ Changelog: Preview process already running - + Preview Prozess läuft bereits There is already another preview process running. Please close the other one first. - + Ein anderer Preview Prozess läuft zu Zeit. +Bitte schliessen Sie diesen zuerst. Couldn't download Couldn't download <file> - + Konnte Datei nicht downloaden reason: Reason why the download failed - + Grund: Downloading Example: Downloading www.example.com/test.torrent - Lade + Lade Please wait... - + Bitte warten... Transfers - + Transfer @@ -982,15 +983,15 @@ Please close the other one first. Transfers - + Transfer Preview file - + Vorschau Datei Clear log - + Log löschen @@ -1043,62 +1044,62 @@ Please close the other one first. Preview impossible - + Vorschau unmöglich Sorry, we can't preview this file - + Bedauere, wir können keine Vorschau für diese Datei erstellen Name - Name + Name Size - Grösse + Grösse Progress - Fortschritt + Fortschritt No URL entered - + Keine URL eingegeben Please type at least one URL. - + Bitte geben Sie mindestens eine URL an. authentication Tracker authentication - + Tracker Authentifizierung Tracker: - + Tracker: Login - + Login Username: - + Benutzername: Password: - Kennwort: + Kennwort: Log in - + Einloggen Cancel - Abbrechen + Abbrechen @@ -1211,23 +1212,23 @@ Please close the other one first. downloadFromURL Download Torrents from URLs - + Torrents von URLs laden Only one URL per line - + Nur eine URL pro Zeile Download - + Lade Cancel - Abbrechen + Abbrechen Download from urls - + Von URLs laden @@ -1373,30 +1374,30 @@ Please close the other one first. Choose your favourite preview program - + Wählen Sie ihr bevorzugtes Vorschau Programm preview Preview selection - + Vorschau auswahl File preview - + Datei vorschauen The following files support previewing, <br>please select one of them: - + Die folgenden Dateien unterstützen Vorschau, <br>bitte wählen Sie eine: Preview - + Vorschau Cancel - Abbrechen + Abbrechen @@ -1615,15 +1616,15 @@ Please close the other one first. Options - Optionen + Optionen Download in correct order (slower but good for previewing) - + In richtiger Reihenfolge herunterladen (langsamer, aber besser zum Vorschauen) Share Ratio: - + Share Verhältnis: diff --git a/src/lang/qbittorrent_it.qm b/src/lang/qbittorrent_it.qm index 1044ff9afb4198c74469b83eac3faa01cc19cac4..9acf1c592bbcb6faf0390167a391e67897969aa5 100644 GIT binary patch delta 4305 zcma);33O9c8ppqvtP2xD2)kzrLpM30IJNSXhaq|OmJbLQl z5<^>wlh@Q?x*pm^YPx|^gi74Pz>`jjV3+;!Qv>&p1%~FPLpb|kyuWXe)$nxN|SAs;LkL9 z^&KL$k#e`K1Uu8z0Z>StMo*PPfVz<8&a;CXXrXaD_zBhByhWtZQo{upu5l*OyJxYH zW;)&6js=?Kboc!X@Pd$e)y%-Kg1`nZ|E28d_%q(`DIdS~4v{fRIc;YPImtL)nYUGifo)1#e+V{ystI=PTiIQ@*lB0Rg5Ll&9jV!RyNFnTv?p8C30dyb5Nj0$SjSb_-R#GJhaypRO9; zJQAFts(KTOv|pgA**OE;qIzk>K5)O6mzYi>Uz2CRH`7apYTKUIF}_$;pU7ONI#O@} zd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|0sk=rJDtosK_kjHwJd?m^%v);Hc}j1^*_sq6;oi$>&1)$@L+%^2N|%CPiKp_LeIL275A7Xc{db z6V0ailuvU|E+Ug$+uy@(Lfz4mftFY}2S3Lgr>j%~=>%xi|c~bZy`G@dIWu;{k!(<|ZzVhEZyycaV&#(o}a-H>r4Al9A`d9+Xq#2FQEj(q!Y%%gj)DQ@P8M$KQa&K39 zt1s7%kIX}s=Tjl;IOWQ#k*^sgCZSNHTpQoPXrqak`?O8IlN2cbl*CmhpOhaa`JgB= S6Vd3;q|2|9_s9oR{QeII50V1_ diff --git a/src/lang/qbittorrent_it.ts b/src/lang/qbittorrent_it.ts index 449b38b67..b3dfd1afb 100644 --- a/src/lang/qbittorrent_it.ts +++ b/src/lang/qbittorrent_it.ts @@ -66,26 +66,18 @@ <br> Copyright © 2006 by Christophe Dumez<br> <br> <u>Home Page:</u> <i>http://www.qbittorrent.org</i><br> - Un client bittorrent in Qt4 e libtorrent. Scritto in c++.<br><br>Copyright © 2006 di Christophe Dumez<br> -<br> <u>Home Page:</u> <i>http://www.qbittorrent.org</i><br> - - - A bittorrent client using Qt4 and libtorrent, programmed in C++.<br> -<br> -Copyright © 2006 by Christophe Dumez<br> -<br> <u>Home Page:</u> <i>http://www.qbittorrent.org</i><br> - Un client bittorrent in Qt4 e libtorrent. Scritto in C++.<br> + Un client bittorrent in Qt4 e libtorrent. Scritto in C++.<br> <br> Copyright © 2006 di Christophe Dumez<br> <br> <u>Home Page:</u> <i>http://www.qbittorrent.org</i><br> Birthday: - + Compleanno: Occupation: - + Occupazione: 03/05/1985 @@ -93,6 +85,13 @@ Copyright © 2006 di Christophe Dumez<br> Student in computer science + Studente di informatica + + + A bittorrent client using Qt4 and libtorrent, programmed in C++.<br> +<br> +Copyright © 2006 by Christophe Dumez<br> +<br> <u>Home Page:</u> <i>http://www.qbittorrent.org</i><br> @@ -141,10 +140,6 @@ Copyright © 2006 di Christophe Dumez<br> ... ... - - Kb/s - Kb/s - Disable Disabilitare @@ -217,14 +212,6 @@ Copyright © 2006 di Christophe Dumez<br> Share ratio: Percentuale di condivisione: - - 1 KB DL = - 1 KB DL = - - - KB UP max. - KB UP max. - Activate IP Filtering Attivare filtraggio IP @@ -289,10 +276,6 @@ Copyright © 2006 di Christophe Dumez<br> Ask for confirmation on exit Chiedi conferma ed esci - - Clear finished downloads on exit - Cancella i download finiti all'uscita - Go to systray when minimizing window Riduci alla systray quando si minimizza la finestra @@ -327,23 +310,23 @@ Copyright © 2006 di Christophe Dumez<br> DHT (Trackerless): - + DHT (senza tracker): Disable DHT (Trackerless) support - + Disabilita il supporto DHT Automatically clear finished downloads - + Cancella automaticamente i download terminati Preview program - + Programma di anteprima Audio/Video player: - + Player audio/video: @@ -352,10 +335,6 @@ Copyright © 2006 di Christophe Dumez<br> Open Torrent Files Apri file torrent - - Unknown - Sconosciuto - This file is either corrupted or this isn't a torrent. Questo file è corrotto o non è un torrent @@ -376,14 +355,6 @@ Copyright © 2006 di Christophe Dumez<br> Are you sure you want to delete the selected item(s) in download list? Sei sicuro di voler cancellare gli elementi selezionati dalla lista dei download? - - paused - In pausa - - - started - Iniziato - Finished Finito @@ -412,10 +383,6 @@ Copyright © 2006 di Christophe Dumez<br> All Downloads Resumed. Tutti i download ripresi. - - DL Speed: - Velocità Download: - started. Iniziato. @@ -472,10 +439,6 @@ Copyright © 2006 di Christophe Dumez<br> qBittorrent qBittorrent - - qBittorrent - qBittorrent - Are you sure? -- qBittorrent Sei sicuro? -- qBittorrent @@ -528,22 +491,6 @@ Copyright © 2006 di Christophe Dumez<br> Searching... Ricerca... - - Could not create search plugin. - Impossibile creare il plugin di ricerca - - - Stopped - Fermato - - - Torrent file URL - URL del file Torrent - - - Torrent file URL: - URL del file Torrent - Are you sure you want to quit? -- qBittorrent Sicuro di voler uscire? -- qBittorrent @@ -552,26 +499,10 @@ Copyright © 2006 di Christophe Dumez<br> Are you sure you want to quit qbittorrent? Sicuro di voler uscire da qBittorrent? - - Timed out - Time out - - - Error during search... - Errore nella ricerca... - KiB/s Kb/s - - KiB/s - Kb/s - - - Stalled - In stallo - Search is finished Ricerca completata @@ -588,10 +519,6 @@ Copyright © 2006 di Christophe Dumez<br> Search returned no results La ricerca non ha prodotto risultati - - Search is Finished - Ricerca finita - Search plugin update -- qBittorrent Aggiornamento del plugin di ricerca -- qBittorrent @@ -668,35 +595,41 @@ Changelog: Preview process already running - + Processo di anteprima già in esecuzione There is already another preview process running. Please close the other one first. - + C'è già un altro processo di anteprima avviato. Per favore chiuderlo. Couldn't download Couldn't download <file> - + Impossibile scaricare reason: Reason why the download failed - + motivo: Downloading - Example: Downloading www.example.com/test.torrent - Scaricando + +Example: Downloading www.example.com/test.torrent + Scaricando Please wait... - + Attendere prego... Transfers - + Trasferimenti + + + Downloading + Example: Downloading www.example.com/test.torrent + Scaricando @@ -713,34 +646,6 @@ Please close the other one first. Total UP Speed: Velocità totale upload: - - Name - Nome - - - Size - Dimensione - - - % DL - % scaricato - - - DL Speed - Velocità download - - - UP Speed - velocità upload - - - Status - Status - - - ETA - ETA - &Options &Opzioni @@ -809,10 +714,6 @@ Please close the other one first. Connection Status Status connessione - - Downloads - Downloads - Search Ricerca @@ -841,18 +742,6 @@ Please close the other one first. Stop Stop - - Seeds - Seeds - - - Leechers - Leechers - - - Search Engine - Motore di ricerca - Download from URL Download da URL @@ -873,10 +762,6 @@ Please close the other one first. Create torrent Crea torrent - - Ratio: - Percentuale: - Update search plugin Aggiorna plugin di ricerca @@ -887,15 +772,15 @@ Please close the other one first. Transfers - + Trasferimenti Preview file - + Anteprima file Clear log - + Cancella log @@ -909,13 +794,6 @@ Please close the other one first. Vero - - QTextEdit - - Clear - Pulisci - - Ui @@ -930,21 +808,13 @@ Please close the other one first. I would like to thank the following people who volunteered to translate qBittorrent: Vorrei ringraziare le seguenti persone che si sono rese volontarie per tradurre qBittorrent: - - <ul><li>I would like to thank sourceforge.net for hosting qBittorrent project.</li> - <ul><li>Voglio inoltre ringraziare Sourceforge.Net per ospitare i files relativi al progetto.</li> - - - <li>I also like to thank Jeffery Fernandez (developer@jefferyfernandez.id.au), our RPM packager, for his great work.</li></ul> - <li>Voglio anche ringraziare Jeffery Fernandez (developer@jefferyfernandez.id.au), il nostro creatore di RPM, per il suo grande lavoro.</li></ul> - Preview impossible - + Anteprima impossibile Sorry, we can't preview this file - + Spiacenti, non è possibile fare un'anteprima di questo file Name @@ -960,30 +830,30 @@ Please close the other one first. No URL entered - + Nessuna URL inserita Please type at least one URL. - + Per favore inserire almeno un URL. authentication Tracker authentication - + Autenticazione del tracker Tracker: - + Tracker: Login - + Login Username: - + Nome utente: Password: @@ -991,11 +861,11 @@ Please close the other one first. Log in - + Log in Cancel - + Annulla @@ -1008,22 +878,6 @@ Please close the other one first. Create Torrent file Crea file torrent - - Destination torrent file: - Torrent file di destinazione: - - - Input file or directory: - File o directory di input: - - - Announce url (Tracker): - URL del tracker: - - - Comment: - Commento: - ... ... @@ -1108,11 +962,11 @@ Please close the other one first. downloadFromURL Download Torrents from URLs - + Scarica torrent da URL Only one URL per line - + Solo un URL per linea Download @@ -1120,11 +974,11 @@ Please close the other one first. Cancel - + Annulla Download from urls - + Download da URL @@ -1154,12 +1008,6 @@ Please close the other one first. tebibytes (1024 gibibytes) Tb - - m - -minutes - m - h hours @@ -1170,12 +1018,6 @@ minutes days gg - - h - -hours - h - Unknown Sconosciuto @@ -1277,30 +1119,30 @@ hours Choose your favourite preview program - + Scegliere il programma d'anteprima preferito preview Preview selection - + Anteprima della selezione File preview - + Anteprima del file The following files support previewing, <br>please select one of them: - + I seguenti files supportano l'anteprima, <br>per favore scegliere uno d'essi: Preview - + Anteprima Cancel - + Annulla @@ -1309,10 +1151,6 @@ hours Torrent Properties Proprietà del torrent - - Main Infos - Informazioni principali - File Name Nome del file @@ -1321,38 +1159,14 @@ hours Current Session Sessione corrente - - Total Uploaded: - Totale Upload: - - - Total Downloaded: - Totale Download: - Download state: Stato download: - - Current Tracker: - Tracker corrente: - - - Number of Peers: - Numero di peer: - - - Torrent Content - Contenuto del torrent - OK OK - - Total Failed: - Totale fallito: - Finished Finito @@ -1421,14 +1235,6 @@ hours You can select here precisely which files you want to download in current torrent. Qua puoi scegliere quali file del torrent scaricare. - - False - Falso - - - True - Vero - Tracker Tracker @@ -1483,11 +1289,11 @@ hours Download in correct order (slower but good for previewing) - + Scarica nel giusto ordine (più lento ma migliore per le anteprime) Share Ratio: - + Percentuale di condivisione: diff --git a/src/properties_imp.cpp b/src/properties_imp.cpp index 1a47b04e2..8d085ac82 100644 --- a/src/properties_imp.cpp +++ b/src/properties_imp.cpp @@ -24,14 +24,13 @@ #include "PropListDelegate.h" // Constructor -properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErrors): QDialog(parent){ +properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErrors): QDialog(parent), h(h){ setupUi(this); // set icons unselect->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png"))); select->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png"))); setAttribute(Qt::WA_DeleteOnClose); - this->h = h; // Set Properties list model PropListModel = new QStandardItemModel(0,4); PropListModel->setHeaderData(NAME, Qt::Horizontal, tr("File Name")); @@ -145,6 +144,30 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr }else{ incrementalDownload->setChecked(false); } + updateProgressTimer = new QTimer(this); + connect(updateProgressTimer, SIGNAL(timeout()), this, SLOT(updateProgress())); + updateProgressTimer->start(2000); + std::vector filters = h.filtered_pieces(); +// std::cout << "filtered pieces: "; +// for(int i=0; i fp; + h.file_progress(fp); + torrent_info torrentInfo = h.get_torrent_info(); + for(int i=0; isetData(PropListModel->index(i, PROGRESS), QVariant((double)fp[i])); + } } // Set the color of a row in data model @@ -171,6 +194,8 @@ void properties::toggleSelectedState(const QModelIndex& index){ setRowColor(row, "red"); PropListModel->setData(PropListModel->index(row, SELECTED), QVariant(false)); } + // Save filtered pieces to a file to remember them + saveFilteredPieces(); } void properties::on_incrementalDownload_stateChanged(int){ @@ -204,6 +229,8 @@ void properties::on_select_clicked(){ } } } + // Save filtered pieces to a file to remember them + saveFilteredPieces(); } void properties::on_okButton_clicked(){ @@ -226,4 +253,30 @@ void properties::on_unselect_clicked(){ } } } + // Save filtered pieces to a file to remember them + saveFilteredPieces(); +} + +void properties::saveFilteredPieces(){ + torrent_info torrentInfo = h.get_torrent_info(); + bool hasFilteredPieces = false; + QString fileName = QString(torrentInfo.name().c_str()); + QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileName+".pieces"); + // First, remove old file + pieces_file.remove(); + // Write new files + if(!pieces_file.open(QIODevice::WriteOnly | QIODevice::Text)){ + std::cout << "Error: Could not save filtered pieces\n"; + return; + } + for(int i=0; i #include +#include class PropListDelegate; @@ -36,6 +37,7 @@ class properties : public QDialog, private Ui::properties{ torrent_handle h; PropListDelegate *PropDelegate; QStandardItemModel *PropListModel; + QTimer *updateProgressTimer; protected slots: void on_select_clicked(); @@ -44,10 +46,16 @@ class properties : public QDialog, private Ui::properties{ void on_incrementalDownload_stateChanged(int); void setRowColor(int row, QString color); void toggleSelectedState(const QModelIndex& index); + void saveFilteredPieces(); + void updateProgress(); + + signals: + void changedFilteredPieces(torrent_handle h, bool compact_mode); public: // Constructor - properties(QWidget *parent = 0, torrent_handle h = torrent_handle(), QStringList trackerErrors = QStringList()); + properties(QWidget *parent, torrent_handle h, QStringList trackerErrors = QStringList()); + ~properties(); }; #endif