Compare commits

...

21 Commits

Author SHA1 Message Date
Christophe Dumez
b46d8934ed Fix escaping in VERSION 2010-03-04 11:19:50 +00:00
Christophe Dumez
493b537215 tagged v2.1.6 release 2010-03-04 08:55:18 +00:00
Christophe Dumez
fae08f7014 Bump to v2.1.6 2010-03-04 08:45:36 +00:00
Christophe Dumez
31d65ddf77 Fix headless compilation 2010-03-04 08:36:35 +00:00
Christophe Dumez
4cd9cfdb59 BUGFIX: Command-line parameters are no longer required to be in UTF-8 2010-03-04 08:34:45 +00:00
Christophe Dumez
8d55368f6a BUGFIX: Only one log window can be opened at a time 2010-03-04 08:23:16 +00:00
Christophe Dumez
2a07fc0dea Fix memory leak in RSS 2010-03-04 08:14:21 +00:00
Christophe Dumez
be6099a797 BUGFIX: Fix ratio calculation for directly seeded torrents (Thanks phorane) 2010-02-17 08:13:47 +00:00
Christophe Dumez
b131b139f7 Fix save path display in properties 2010-02-14 15:24:54 +00:00
Christophe Dumez
c40455dbbf Revert useless 64bit patch 2010-02-10 23:22:33 +00:00
Christophe Dumez
75f0d86710 Added LIBS += -L/usr/lib64 for 64bit 2010-02-10 22:28:47 +00:00
Christophe Dumez
33447bf9fb Update release date 2010-02-10 21:34:13 +00:00
Christophe Dumez
a9365bc126 - Fix possible race condition in search engine 2010-02-10 21:21:43 +00:00
Christophe Dumez
f54b65a56d Add back CONFIG += link_pkgconfig or it causes crashes 2010-02-10 21:14:11 +00:00
Christophe Dumez
f9abbea1cc - Update helper version 2010-02-10 20:15:55 +00:00
Christophe Dumez
c267f6911d BUGFIX: Improved HTTP gzip compression detection in downloader 2010-02-10 20:07:00 +00:00
Christophe Dumez
dd51d39f5b BUGFIX: Only one program preferences dialog is allowed at a time 2010-02-09 23:36:03 +00:00
Christophe Dumez
a3e90e1c05 Fix memory leak in RSS 2010-02-09 21:22:09 +00:00
Christophe Dumez
6bd1d2551b - Bump to v2.1.5 2010-02-09 20:53:50 +00:00
Christophe Dumez
cf0c359abf BUGFIX: Fix actions on selected torrents (non-selected torrents could be affected) 2010-02-09 20:48:48 +00:00
Christophe Dumez
461cca2f52 Link against boost and ssl to fix issues with gold linker 2010-02-09 12:05:39 +00:00
23 changed files with 144 additions and 102 deletions

View File

@@ -1,3 +1,19 @@
* Thu Mar 4 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.6
- BUGFIX: Fix Web UI authentication with Konqueror
- BUGFIX: Fix save path display in properties
- BUGFIX: Fix ratio calculation for directly seeded torrents (Thanks phorane)
- BUGFIX: Fix memory leak in RSS parser
- BUGFIX: Only one log window can be opened at a time
- BUGFIX: Command-line parameters are no longer required to be in UTF-8
* Web Feb 10 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.5
- BUGFIX: Fix actions on selected torrents (non-selected torrents could be affected)
- BUGFIX: Only one program preferences dialog is allowed at a time
- BUGFIX: Link against boost and ssl to fix issues with gold linker
- BUGFIX: Fix memory leak in RSS
- BUGFIX: Improved HTTP gzip compression detection in downloader
- BUGFIX: Fix possible race condition in search engine
* Mon Feb 8 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.4
- BUGFIX: Fix file prioritizing in a torrent
- BUGFIX: Make sure seeding torrents display a progress of 100%

10
configure vendored
View File

@@ -359,12 +359,18 @@ public:
return false;
for(int n = 0; n < incs.count(); ++n)
conf->addIncludePath(incs[n]);
if(!libs.isEmpty())
conf->addLib(libs);
//if(!libs.isEmpty())
// conf->addLib(libs);
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other))
printf("\nWarning: libtorrent-rasterbar v%s was detected. Some feature will be disabled because they require v%s.\n", version.toLocal8Bit().data(), adv_ver.toUtf8().data());
else
conf->addDefine("LIBTORRENT_0_15");
// Get linking parameters
QStringList params;
QByteArray staticlibs;
params << "--static" << "--libs" << "libtorrent-rasterbar";
conf->doCommand("pkg-config", params, &staticlibs);
conf->addLib(staticlibs.trimmed());
return true;
}
};

View File

@@ -20,12 +20,18 @@ public:
return false;
for(int n = 0; n < incs.count(); ++n)
conf->addIncludePath(incs[n]);
if(!libs.isEmpty())
conf->addLib(libs);
//if(!libs.isEmpty())
// conf->addLib(libs);
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other))
printf("\nWarning: libtorrent-rasterbar v%s was detected. Some feature will be disabled because they require v%s.\n", version.toLocal8Bit().data(), adv_ver.toUtf8().data());
else
conf->addDefine("LIBTORRENT_0_15");
// Get linking parameters
QStringList params;
QByteArray staticlibs;
params << "--static" << "--libs" << "libtorrent-rasterbar";
conf->doCommand("pkg-config", params, &staticlibs);
conf->addLib(staticlibs.trimmed());
return true;
}
};

View File

@@ -217,7 +217,10 @@ GUI::~GUI() {
delete status_bar;
delete transferList;
delete guiUpdater;
if (console)
delete console;
if(options)
delete options;
if(rssWidget)
delete rssWidget;
delete searchEngine;
@@ -393,7 +396,7 @@ void GUI::readParamsOnSocket() {
if(clientConnection) {
QByteArray params = clientConnection->readAll();
if(!params.isEmpty()) {
processParams(QString::fromUtf8(params.data()).split(QString::fromUtf8("\n")));
processParams(QString::fromLocal8Bit(params.constData()).split("\n"));
qDebug("Received parameters from another instance");
}
clientConnection->deleteLater();
@@ -420,7 +423,11 @@ void GUI::on_actionSet_global_upload_limit_triggered() {
}
void GUI::on_actionShow_console_triggered() {
new consoleDlg(this, BTSession);
if(!console) {
console = new consoleDlg(this, BTSession);
} else {
console->setFocus();
}
}
void GUI::on_actionSet_global_download_limit_triggered() {
@@ -908,8 +915,13 @@ void GUI::createTrayIcon() {
// Display Program Options
void GUI::on_actionOptions_triggered() {
options = new options_imp(this);
connect(options, SIGNAL(status_changed()), this, SLOT(optionsSaved()));
if(!options) {
options = new options_imp(this);
connect(options, SIGNAL(status_changed()), this, SLOT(optionsSaved()));
} else {
// Get focus
options->setFocus();
}
}
/*****************************************************

View File

@@ -55,6 +55,7 @@ class TransferListFiltersWidget;
class QSplitter;
class PropertiesWidget;
class StatusBar;
class consoleDlg;
class GUI : public QMainWindow, private Ui::MainWindow{
Q_OBJECT
@@ -68,6 +69,7 @@ private:
QTabWidget *tabs;
StatusBar *status_bar;
QPointer<options_imp> options;
QPointer<consoleDlg> console;
QPointer<QSystemTrayIcon> systrayIcon;
QPointer<QTimer> systrayCreator;
QMenu *myTrayIconMenu;

View File

@@ -1,6 +1,6 @@
[Desktop Entry]
Categories=Qt;Network;P2P;
Comment=V2.1.4
Comment=V2.1.6
Exec=qbittorrent %f
GenericName=Bittorrent client
GenericName[bg]=Торент клиент

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -1232,14 +1232,14 @@ bool Bittorrent::enableDHT(bool b) {
float Bittorrent::getRealRatio(QString hash) const{
QTorrentHandle h = getTorrentHandle(hash);
Q_ASSERT(h.all_time_download() >= 0);
Q_ASSERT(h.total_done() >= 0);
Q_ASSERT(h.all_time_upload() >= 0);
if(h.all_time_download() == 0) {
if(h.total_done() == 0) {
if(h.all_time_upload() == 0)
return 0;
return 101;
}
float ratio = (float)h.all_time_upload()/(float)h.all_time_download();
float ratio = (float)h.all_time_upload()/(float)h.total_done();
Q_ASSERT(ratio >= 0.);
if(ratio > 100.)
ratio = 100.;

View File

@@ -103,6 +103,7 @@ void downloadThread::downloadUrl(QString url){
// Spoof Firefox 3.5 user agent to avoid
// Web server banning
request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5");
request.setRawHeader("Accept-Encoding", "");
qDebug("Downloading %s...", request.url().toString().toLocal8Bit().data());
networkManager->get(request);
}

View File

@@ -282,7 +282,9 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
// Save path
data["save_path"] = TorrentPersistentData::getSavePath(hash);
QString p = TorrentPersistentData::getSavePath(hash);
if(p.isEmpty()) p = h.save_path();
data["save_path"] = p;
// Creation date
data["creation_date"] = h.creation_date();
// Comment

View File

@@ -138,6 +138,7 @@ void HttpConnection::respond() {
return;
}
QString auth = parser.value("Authorization");
qDebug("Auth: %s", auth.split(" ").first().toLocal8Bit().data());
if (QString::compare(auth.split(" ").first(), "Digest", Qt::CaseInsensitive) != 0 || !parent->isAuthorized(auth.toLocal8Bit(), parser.method())) {
// Update failed attempt counter
parent->client_failed_attempts.insert(socket->peerAddress().toString(), nb_fail+1);

View File

@@ -207,7 +207,7 @@ bool HttpServer::isAuthorized(QByteArray auth, QString method) const {
}
QByteArray prop_cnonce = regex_cnonce.cap(1).toLocal8Bit();
qDebug("prop cnonce is: %s", prop_cnonce.data());
QRegExp regex_qop(".*qop=(\\w+).*");
QRegExp regex_qop(".*qop=[\"]?(\\w+)[\"]?.*");
if(regex_qop.indexIn(auth) < 0) {
qDebug("AUTH-PROB: missing qop");
return false;

View File

@@ -40,6 +40,7 @@
#include "qgnomelook.h"
#include <QMotifStyle>
#include <QCDEStyle>
#include <QPushButton>
#ifdef Q_WS_WIN
#include <QWindowsXPStyle>
#endif
@@ -112,7 +113,7 @@ public:
msgBox.setText(tr("qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.\n\nNo further notices will be issued."));
msgBox.setWindowTitle(tr("Legal notice"));
msgBox.addButton(tr("Cancel"), QMessageBox::RejectRole);
QAbstractButton *agree_button =(QAbstractButton*)msgBox.addButton(tr("I Agree"), QMessageBox::AcceptRole);
QAbstractButton *agree_button =msgBox.addButton(tr("I Agree"), QMessageBox::AcceptRole);
msgBox.exec();
if(msgBox.clickedButton() == agree_button) {
// Save the answer
@@ -255,12 +256,12 @@ int main(int argc, char *argv[]){
// Check for executable parameters
if(argc > 1){
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--version")){
if(QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--version")){
std::cout << "qBittorrent " << VERSION << '\n';
delete app;
return 0;
}
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--help")){
if(QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--help")){
UsageDisplay::displayUsage(argv[0]);
delete app;
return 0;
@@ -268,11 +269,11 @@ int main(int argc, char *argv[]){
for(int i=1; i<argc; ++i) {
#ifndef DISABLE_GUI
if(QString::fromUtf8(argv[i]) == QString::fromUtf8("--no-splash")) {
if(QString::fromLocal8Bit(argv[i]) == QString::fromUtf8("--no-splash")) {
no_splash = true;
} else {
#endif
if(QString::fromUtf8(argv[i]).startsWith("--webui-port=")) {
if(QString::fromLocal8Bit(argv[i]).startsWith("--webui-port=")) {
QStringList parts = QString::fromUtf8(argv[i]).split("=");
if(parts.size() == 2) {
bool ok = false;

View File

@@ -208,7 +208,10 @@ Bittorrent* PropertiesWidget::getBTSession() const {
void PropertiesWidget::updateSavePath(QTorrentHandle& _h) {
if(h.is_valid() && h == _h) {
save_path->setText(TorrentPersistentData::getSavePath(h.hash()));
QString p = TorrentPersistentData::getSavePath(h.hash());
if(p.isEmpty())
p = h.save_path();
save_path->setText(p);
}
}
@@ -223,7 +226,10 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
try {
// Save path
save_path->setText(TorrentPersistentData::getSavePath(h.hash()));
QString p = TorrentPersistentData::getSavePath(h.hash());
if(p.isEmpty())
p = h.save_path();
save_path->setText(p);
// Creation date
lbl_creationDate->setText(h.creation_date());
// Hash

View File

@@ -336,6 +336,11 @@ bool QTorrentHandle::is_checking() const {
return h.status().state == torrent_status::checking_files || h.status().state == torrent_status::checking_resume_data;
}
size_type QTorrentHandle::total_done() {
Q_ASSERT(h.is_valid());
return h.status().total_done;
}
size_type QTorrentHandle::all_time_download() {
Q_ASSERT(h.is_valid());
return h.status().all_time_download;

View File

@@ -107,6 +107,7 @@ class QTorrentHandle {
size_type total_payload_upload();
size_type all_time_upload();
size_type all_time_download();
size_type total_done();
QStringList files_path() const;
int num_uploads() const;
bool is_seed() const;

View File

@@ -391,6 +391,8 @@ RssStream::RssStream(RssFolder* parent, RssManager *rssmanager, Bittorrent *BTSe
RssItem *rss_item = RssItem::fromHash(this, item);
if(rss_item->isValid()) {
(*this)[rss_item->getTitle()] = rss_item;
} else {
delete rss_item;
}
}
}

View File

@@ -92,6 +92,7 @@ public:
enum FileType {STREAM, FOLDER};
RssFile(): QObject() {}
virtual ~RssFile() {}
virtual unsigned int getNbUnRead() const = 0;
virtual FileType getType() const = 0;

View File

@@ -22,7 +22,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#VERSION: 1.3
#VERSION: 1.31
# Author:
# Christophe DUMEZ (chris@qbittorrent.org)
@@ -84,15 +84,14 @@ def download_file(url, referer=None):
req.add_header('referer', referer)
response = urllib2.urlopen(req)
dat = response.read()
# Check if data is gzip encoded
response_info = response.info()
content_encoding = response_info.get('Content-Encoding')
if content_encoding is not None and 'gzip' in content_encoding:
# Check if it is gzipped
if dat[:2] == '\037\213':
# Data is gzip encoded, decode it
compressedstream = StringIO.StringIO(dat)
gzipper = gzip.GzipFile(fileobj=compressedstream)
extracted_data = gzipper.read()
dat = extracted_data
# Write it to a file
file.write(dat)
file.close()

View File

@@ -210,6 +210,7 @@ void SearchEngine::on_search_button_clicked(){
search_button->setText("Search");
return;
}
searchProcess->waitForFinished();
// Reload environment variables (proxy)
searchProcess->setEnvironment(QProcess::systemEnvironment());

View File

@@ -11,10 +11,10 @@ CONFIG += qt \
thread
# Update this VERSION for each release
DEFINES += VERSION=\\\"v2.1.4\\\"
DEFINES += VERSION=\\\"v2.1.6\\\"
DEFINES += VERSION_MAJOR=2
DEFINES += VERSION_MINOR=1
DEFINES += VERSION_BUGFIX=4
DEFINES += VERSION_BUGFIX=6
# NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL
DEFINES += VERSION_TYPE=NORMAL
@@ -105,6 +105,7 @@ contains(DEFINES, DISABLE_GUI) {
unix:QMAKE_LFLAGS_SHAPP += -rdynamic
CONFIG += link_pkgconfig
PKGCONFIG += "libtorrent-rasterbar"
QT += network
!contains(DEFINES, DISABLE_GUI) {
QT += xml

View File

@@ -567,19 +567,25 @@ void TransferListWidget::torrentDoubleClicked(QModelIndex index) {
}
}
void TransferListWidget::startSelectedTorrents() {
QStringList TransferListWidget::getSelectedTorrentsHashes() const {
QStringList hashes;
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes) {
// Get the file hash
int row = mapToSource(index).row();
QString hash = getHashFromRow(row);
hashes << getHashFromRow(mapToSource(index).row());
}
return hashes;
}
void TransferListWidget::startSelectedTorrents() {
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.is_paused()) {
h.resume();
resumeTorrent(row, false);
resumeTorrent(getRowFromHash(hash), false);
}
}
if(!selectedIndexes.empty())
if(!hashes.empty())
refreshList();
}
@@ -595,18 +601,15 @@ void TransferListWidget::startAllTorrents() {
}
void TransferListWidget::pauseSelectedTorrents() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes) {
// Get the file hash
int row = mapToSource(index).row();
QString hash = getHashFromRow(row);
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && !h.is_paused()) {
h.pause();
pauseTorrent(row, false);
pauseTorrent(getRowFromHash(hash), false);
}
}
if(!selectedIndexes.empty())
if(!hashes.empty())
refreshList();
}
@@ -623,15 +626,10 @@ void TransferListWidget::pauseAllTorrents() {
void TransferListWidget::deleteSelectedTorrents() {
if(main_window->getCurrentTabIndex() != TAB_TRANSFER) return;
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
if(!selectedIndexes.empty()) {
QStringList hashes = getSelectedTorrentsHashes();
if(!hashes.empty()) {
bool delete_local_files = false;
if(DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files)) {
QStringList hashes;
foreach(const QModelIndex &index, selectedIndexes) {
// Get the file hash
hashes << getHashFromRow(mapToSource(index).row());
}
foreach(const QString &hash, hashes) {
int row = getRowFromHash(hash);
deleteTorrent(row, false);
@@ -644,9 +642,9 @@ void TransferListWidget::deleteSelectedTorrents() {
// FIXME: Should work only if the tab is displayed
void TransferListWidget::increasePrioSelectedTorrents() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes) {
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && !h.is_seed()) {
h.queue_position_up();
}
@@ -656,9 +654,9 @@ void TransferListWidget::increasePrioSelectedTorrents() {
// FIXME: Should work only if the tab is displayed
void TransferListWidget::decreasePrioSelectedTorrents() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes) {
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && !h.is_seed()) {
h.queue_position_down();
}
@@ -667,19 +665,19 @@ void TransferListWidget::decreasePrioSelectedTorrents() {
}
void TransferListWidget::buySelectedTorrents() const {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes) {
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid())
QDesktopServices::openUrl("http://match.sharemonkey.com/?info_hash="+h.hash()+"&n="+h.name()+"&cid=33");
}
}
void TransferListWidget::copySelectedMagnetURIs() const {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
QStringList magnet_uris;
foreach(const QModelIndex &index, selectedIndexes) {
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata())
magnet_uris << misc::toQString(make_magnet_uri(h.get_torrent_info()));
}
@@ -691,10 +689,10 @@ void TransferListWidget::hidePriorityColumn(bool hide) {
}
void TransferListWidget::openSelectedTorrentsFolder() const {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
QStringList pathsList;
foreach(const QModelIndex &index, selectedIndexes) {
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) {
QString savePath = h.root_path();
if(!pathsList.contains(savePath)) {
@@ -706,10 +704,10 @@ void TransferListWidget::openSelectedTorrentsFolder() const {
}
void TransferListWidget::previewSelectedTorrents() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
QStringList pathsList;
foreach(const QModelIndex &index, selectedIndexes) {
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
new previewSelect(this, h);
}
@@ -717,14 +715,11 @@ void TransferListWidget::previewSelectedTorrents() {
}
void TransferListWidget::setDlLimitSelectedTorrents() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
QStringList hashes;
QList<QTorrentHandle> selected_torrents;
bool first = true;
bool all_same_limit = true;
foreach(const QModelIndex &index, selectedIndexes) {
// Get the file hash
QString hash = getHashFromRow(mapToSource(index).row());
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && !h.is_seed()) {
selected_torrents << h;
@@ -753,14 +748,11 @@ void TransferListWidget::setDlLimitSelectedTorrents() {
}
void TransferListWidget::setUpLimitSelectedTorrents() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
QStringList hashes;
QList<QTorrentHandle> selected_torrents;
bool first = true;
bool all_same_limit = true;
foreach(const QModelIndex &index, selectedIndexes) {
// Get the file hash
QString hash = getHashFromRow(mapToSource(index).row());
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) {
selected_torrents << h;
@@ -789,13 +781,9 @@ void TransferListWidget::setUpLimitSelectedTorrents() {
}
void TransferListWidget::recheckSelectedTorrents() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes){
QString hash = getHashFromRow(mapToSource(index).row());
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) {
BTSession->recheckTorrent(h.hash());
}
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
BTSession->recheckTorrent(hash);
}
}
@@ -863,10 +851,8 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&){
#ifdef LIBTORRENT_0_15
void TransferListWidget::toggleSelectedTorrentsSuperSeeding() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes) {
// Get the file hash
QString hash = getHashFromRow(mapToSource(index).row());
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
h.super_seeding(!h.super_seeding());
@@ -876,10 +862,8 @@ void TransferListWidget::toggleSelectedTorrentsSuperSeeding() {
#endif
void TransferListWidget::toggleSelectedTorrentsSequentialDownload() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes) {
// Get the file hash
QString hash = getHashFromRow(mapToSource(index).row());
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
h.set_sequential_download(!h.is_sequential_download());
@@ -888,10 +872,8 @@ void TransferListWidget::toggleSelectedTorrentsSequentialDownload() {
}
void TransferListWidget::toggleSelectedFirstLastPiecePrio() {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
foreach(const QModelIndex &index, selectedIndexes) {
// Get the file hash
QString hash = getHashFromRow(mapToSource(index).row());
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
h.prioritize_first_last_piece(!h.first_last_piece_first());
@@ -937,12 +919,8 @@ void TransferListWidget::renameSelectedTorrent() {
}
void TransferListWidget::setSelectionLabel(QString label) {
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
QStringList hashes;
foreach(const QModelIndex &index, selectedIndexes) {
hashes << getHashFromRow(mapToSource(index).row());
}
foreach(const QString& hash, hashes) {
QStringList hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
Q_ASSERT(!hash.isEmpty());
int row = getRowFromHash(hash);
QString old_label = listModel->data(listModel->index(row, TR_LABEL)).toString();

View File

@@ -71,6 +71,7 @@ protected:
bool loadColWidthList();
void saveLastSortedColumn();
void loadLastSortedColumn();
QStringList getSelectedTorrentsHashes() const;
protected slots:
int updateTorrent(int row);