You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-10-21 13:52:16 +02:00
Compare commits
1 Commits
release-2.
...
release-2.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
89c9a646ad |
16
Changelog
16
Changelog
@@ -1,19 +1,3 @@
|
||||
* 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
10
configure
vendored
@@ -359,18 +359,12 @@ 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;
|
||||
}
|
||||
};
|
||||
|
@@ -20,18 +20,12 @@ 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;
|
||||
}
|
||||
};
|
||||
|
22
src/GUI.cpp
22
src/GUI.cpp
@@ -217,10 +217,7 @@ GUI::~GUI() {
|
||||
delete status_bar;
|
||||
delete transferList;
|
||||
delete guiUpdater;
|
||||
if (console)
|
||||
delete console;
|
||||
if(options)
|
||||
delete options;
|
||||
|
||||
if(rssWidget)
|
||||
delete rssWidget;
|
||||
delete searchEngine;
|
||||
@@ -396,7 +393,7 @@ void GUI::readParamsOnSocket() {
|
||||
if(clientConnection) {
|
||||
QByteArray params = clientConnection->readAll();
|
||||
if(!params.isEmpty()) {
|
||||
processParams(QString::fromLocal8Bit(params.constData()).split("\n"));
|
||||
processParams(QString::fromUtf8(params.data()).split(QString::fromUtf8("\n")));
|
||||
qDebug("Received parameters from another instance");
|
||||
}
|
||||
clientConnection->deleteLater();
|
||||
@@ -423,11 +420,7 @@ void GUI::on_actionSet_global_upload_limit_triggered() {
|
||||
}
|
||||
|
||||
void GUI::on_actionShow_console_triggered() {
|
||||
if(!console) {
|
||||
console = new consoleDlg(this, BTSession);
|
||||
} else {
|
||||
console->setFocus();
|
||||
}
|
||||
new consoleDlg(this, BTSession);
|
||||
}
|
||||
|
||||
void GUI::on_actionSet_global_download_limit_triggered() {
|
||||
@@ -915,13 +908,8 @@ void GUI::createTrayIcon() {
|
||||
|
||||
// Display Program Options
|
||||
void GUI::on_actionOptions_triggered() {
|
||||
if(!options) {
|
||||
options = new options_imp(this);
|
||||
connect(options, SIGNAL(status_changed()), this, SLOT(optionsSaved()));
|
||||
} else {
|
||||
// Get focus
|
||||
options->setFocus();
|
||||
}
|
||||
options = new options_imp(this);
|
||||
connect(options, SIGNAL(status_changed()), this, SLOT(optionsSaved()));
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
|
@@ -55,7 +55,6 @@ class TransferListFiltersWidget;
|
||||
class QSplitter;
|
||||
class PropertiesWidget;
|
||||
class StatusBar;
|
||||
class consoleDlg;
|
||||
|
||||
class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
Q_OBJECT
|
||||
@@ -69,7 +68,6 @@ private:
|
||||
QTabWidget *tabs;
|
||||
StatusBar *status_bar;
|
||||
QPointer<options_imp> options;
|
||||
QPointer<consoleDlg> console;
|
||||
QPointer<QSystemTrayIcon> systrayIcon;
|
||||
QPointer<QTimer> systrayCreator;
|
||||
QMenu *myTrayIconMenu;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Categories=Qt;Network;P2P;
|
||||
Comment=V2.1.6
|
||||
Comment=V2.1.4
|
||||
Exec=qbittorrent %f
|
||||
GenericName=Bittorrent client
|
||||
GenericName[bg]=Торент клиент
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
@@ -1232,14 +1232,14 @@ bool Bittorrent::enableDHT(bool b) {
|
||||
|
||||
float Bittorrent::getRealRatio(QString hash) const{
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
Q_ASSERT(h.total_done() >= 0);
|
||||
Q_ASSERT(h.all_time_download() >= 0);
|
||||
Q_ASSERT(h.all_time_upload() >= 0);
|
||||
if(h.total_done() == 0) {
|
||||
if(h.all_time_download() == 0) {
|
||||
if(h.all_time_upload() == 0)
|
||||
return 0;
|
||||
return 101;
|
||||
}
|
||||
float ratio = (float)h.all_time_upload()/(float)h.total_done();
|
||||
float ratio = (float)h.all_time_upload()/(float)h.all_time_download();
|
||||
Q_ASSERT(ratio >= 0.);
|
||||
if(ratio > 100.)
|
||||
ratio = 100.;
|
||||
|
@@ -103,7 +103,6 @@ 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);
|
||||
}
|
||||
|
@@ -282,9 +282,7 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.has_metadata()) {
|
||||
// Save path
|
||||
QString p = TorrentPersistentData::getSavePath(hash);
|
||||
if(p.isEmpty()) p = h.save_path();
|
||||
data["save_path"] = p;
|
||||
data["save_path"] = TorrentPersistentData::getSavePath(hash);
|
||||
// Creation date
|
||||
data["creation_date"] = h.creation_date();
|
||||
// Comment
|
||||
|
@@ -138,7 +138,6 @@ 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);
|
||||
|
@@ -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;
|
||||
|
11
src/main.cpp
11
src/main.cpp
@@ -40,7 +40,6 @@
|
||||
#include "qgnomelook.h"
|
||||
#include <QMotifStyle>
|
||||
#include <QCDEStyle>
|
||||
#include <QPushButton>
|
||||
#ifdef Q_WS_WIN
|
||||
#include <QWindowsXPStyle>
|
||||
#endif
|
||||
@@ -113,7 +112,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 =msgBox.addButton(tr("I Agree"), QMessageBox::AcceptRole);
|
||||
QAbstractButton *agree_button =(QAbstractButton*)msgBox.addButton(tr("I Agree"), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
if(msgBox.clickedButton() == agree_button) {
|
||||
// Save the answer
|
||||
@@ -256,12 +255,12 @@ int main(int argc, char *argv[]){
|
||||
|
||||
// Check for executable parameters
|
||||
if(argc > 1){
|
||||
if(QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--version")){
|
||||
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--version")){
|
||||
std::cout << "qBittorrent " << VERSION << '\n';
|
||||
delete app;
|
||||
return 0;
|
||||
}
|
||||
if(QString::fromLocal8Bit(argv[1]) == QString::fromUtf8("--help")){
|
||||
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--help")){
|
||||
UsageDisplay::displayUsage(argv[0]);
|
||||
delete app;
|
||||
return 0;
|
||||
@@ -269,11 +268,11 @@ int main(int argc, char *argv[]){
|
||||
|
||||
for(int i=1; i<argc; ++i) {
|
||||
#ifndef DISABLE_GUI
|
||||
if(QString::fromLocal8Bit(argv[i]) == QString::fromUtf8("--no-splash")) {
|
||||
if(QString::fromUtf8(argv[i]) == QString::fromUtf8("--no-splash")) {
|
||||
no_splash = true;
|
||||
} else {
|
||||
#endif
|
||||
if(QString::fromLocal8Bit(argv[i]).startsWith("--webui-port=")) {
|
||||
if(QString::fromUtf8(argv[i]).startsWith("--webui-port=")) {
|
||||
QStringList parts = QString::fromUtf8(argv[i]).split("=");
|
||||
if(parts.size() == 2) {
|
||||
bool ok = false;
|
||||
|
@@ -208,10 +208,7 @@ Bittorrent* PropertiesWidget::getBTSession() const {
|
||||
|
||||
void PropertiesWidget::updateSavePath(QTorrentHandle& _h) {
|
||||
if(h.is_valid() && h == _h) {
|
||||
QString p = TorrentPersistentData::getSavePath(h.hash());
|
||||
if(p.isEmpty())
|
||||
p = h.save_path();
|
||||
save_path->setText(p);
|
||||
save_path->setText(TorrentPersistentData::getSavePath(h.hash()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,10 +223,7 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
|
||||
|
||||
try {
|
||||
// Save path
|
||||
QString p = TorrentPersistentData::getSavePath(h.hash());
|
||||
if(p.isEmpty())
|
||||
p = h.save_path();
|
||||
save_path->setText(p);
|
||||
save_path->setText(TorrentPersistentData::getSavePath(h.hash()));
|
||||
// Creation date
|
||||
lbl_creationDate->setText(h.creation_date());
|
||||
// Hash
|
||||
|
@@ -336,11 +336,6 @@ 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;
|
||||
|
@@ -107,7 +107,6 @@ 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;
|
||||
|
@@ -391,8 +391,6 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -92,7 +92,6 @@ public:
|
||||
enum FileType {STREAM, FOLDER};
|
||||
|
||||
RssFile(): QObject() {}
|
||||
virtual ~RssFile() {}
|
||||
|
||||
virtual unsigned int getNbUnRead() const = 0;
|
||||
virtual FileType getType() const = 0;
|
||||
|
@@ -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.31
|
||||
#VERSION: 1.3
|
||||
|
||||
# Author:
|
||||
# Christophe DUMEZ (chris@qbittorrent.org)
|
||||
@@ -84,14 +84,15 @@ def download_file(url, referer=None):
|
||||
req.add_header('referer', referer)
|
||||
response = urllib2.urlopen(req)
|
||||
dat = response.read()
|
||||
# Check if it is gzipped
|
||||
if dat[:2] == '\037\213':
|
||||
# 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:
|
||||
# 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()
|
||||
|
@@ -210,7 +210,6 @@ void SearchEngine::on_search_button_clicked(){
|
||||
search_button->setText("Search");
|
||||
return;
|
||||
}
|
||||
searchProcess->waitForFinished();
|
||||
// Reload environment variables (proxy)
|
||||
searchProcess->setEnvironment(QProcess::systemEnvironment());
|
||||
|
||||
|
@@ -11,10 +11,10 @@ CONFIG += qt \
|
||||
thread
|
||||
|
||||
# Update this VERSION for each release
|
||||
DEFINES += VERSION=\\\"v2.1.6\\\"
|
||||
DEFINES += VERSION=\\\"v2.1.4\\\"
|
||||
DEFINES += VERSION_MAJOR=2
|
||||
DEFINES += VERSION_MINOR=1
|
||||
DEFINES += VERSION_BUGFIX=6
|
||||
DEFINES += VERSION_BUGFIX=4
|
||||
# NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL
|
||||
DEFINES += VERSION_TYPE=NORMAL
|
||||
|
||||
@@ -105,7 +105,6 @@ contains(DEFINES, DISABLE_GUI) {
|
||||
unix:QMAKE_LFLAGS_SHAPP += -rdynamic
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += "libtorrent-rasterbar"
|
||||
|
||||
QT += network
|
||||
!contains(DEFINES, DISABLE_GUI) {
|
||||
QT += xml
|
||||
|
@@ -567,25 +567,19 @@ void TransferListWidget::torrentDoubleClicked(QModelIndex index) {
|
||||
}
|
||||
}
|
||||
|
||||
QStringList TransferListWidget::getSelectedTorrentsHashes() const {
|
||||
QStringList hashes;
|
||||
void TransferListWidget::startSelectedTorrents() {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
hashes << getHashFromRow(mapToSource(index).row());
|
||||
}
|
||||
return hashes;
|
||||
}
|
||||
|
||||
void TransferListWidget::startSelectedTorrents() {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
// Get the file hash
|
||||
int row = mapToSource(index).row();
|
||||
QString hash = getHashFromRow(row);
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.is_paused()) {
|
||||
h.resume();
|
||||
resumeTorrent(getRowFromHash(hash), false);
|
||||
resumeTorrent(row, false);
|
||||
}
|
||||
}
|
||||
if(!hashes.empty())
|
||||
if(!selectedIndexes.empty())
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@@ -601,15 +595,18 @@ void TransferListWidget::startAllTorrents() {
|
||||
}
|
||||
|
||||
void TransferListWidget::pauseSelectedTorrents() {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
// Get the file hash
|
||||
int row = mapToSource(index).row();
|
||||
QString hash = getHashFromRow(row);
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && !h.is_paused()) {
|
||||
h.pause();
|
||||
pauseTorrent(getRowFromHash(hash), false);
|
||||
pauseTorrent(row, false);
|
||||
}
|
||||
}
|
||||
if(!hashes.empty())
|
||||
if(!selectedIndexes.empty())
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@@ -626,10 +623,15 @@ void TransferListWidget::pauseAllTorrents() {
|
||||
|
||||
void TransferListWidget::deleteSelectedTorrents() {
|
||||
if(main_window->getCurrentTabIndex() != TAB_TRANSFER) return;
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
if(!hashes.empty()) {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
if(!selectedIndexes.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);
|
||||
@@ -642,9 +644,9 @@ void TransferListWidget::deleteSelectedTorrents() {
|
||||
|
||||
// FIXME: Should work only if the tab is displayed
|
||||
void TransferListWidget::increasePrioSelectedTorrents() {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
|
||||
if(h.is_valid() && !h.is_seed()) {
|
||||
h.queue_position_up();
|
||||
}
|
||||
@@ -654,9 +656,9 @@ void TransferListWidget::increasePrioSelectedTorrents() {
|
||||
|
||||
// FIXME: Should work only if the tab is displayed
|
||||
void TransferListWidget::decreasePrioSelectedTorrents() {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
|
||||
if(h.is_valid() && !h.is_seed()) {
|
||||
h.queue_position_down();
|
||||
}
|
||||
@@ -665,19 +667,19 @@ void TransferListWidget::decreasePrioSelectedTorrents() {
|
||||
}
|
||||
|
||||
void TransferListWidget::buySelectedTorrents() const {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
|
||||
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;
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
|
||||
if(h.is_valid() && h.has_metadata())
|
||||
magnet_uris << misc::toQString(make_magnet_uri(h.get_torrent_info()));
|
||||
}
|
||||
@@ -689,10 +691,10 @@ void TransferListWidget::hidePriorityColumn(bool hide) {
|
||||
}
|
||||
|
||||
void TransferListWidget::openSelectedTorrentsFolder() const {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
QStringList pathsList;
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
|
||||
if(h.is_valid()) {
|
||||
QString savePath = h.root_path();
|
||||
if(!pathsList.contains(savePath)) {
|
||||
@@ -704,10 +706,10 @@ void TransferListWidget::openSelectedTorrentsFolder() const {
|
||||
}
|
||||
|
||||
void TransferListWidget::previewSelectedTorrents() {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
QStringList pathsList;
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(mapToSource(index).row()));
|
||||
if(h.is_valid() && h.has_metadata()) {
|
||||
new previewSelect(this, h);
|
||||
}
|
||||
@@ -715,11 +717,14 @@ void TransferListWidget::previewSelectedTorrents() {
|
||||
}
|
||||
|
||||
void TransferListWidget::setDlLimitSelectedTorrents() {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
QStringList hashes;
|
||||
QList<QTorrentHandle> selected_torrents;
|
||||
bool first = true;
|
||||
bool all_same_limit = true;
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
// Get the file hash
|
||||
QString hash = getHashFromRow(mapToSource(index).row());
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && !h.is_seed()) {
|
||||
selected_torrents << h;
|
||||
@@ -748,11 +753,14 @@ void TransferListWidget::setDlLimitSelectedTorrents() {
|
||||
}
|
||||
|
||||
void TransferListWidget::setUpLimitSelectedTorrents() {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
QStringList hashes;
|
||||
QList<QTorrentHandle> selected_torrents;
|
||||
bool first = true;
|
||||
bool all_same_limit = true;
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
// Get the file hash
|
||||
QString hash = getHashFromRow(mapToSource(index).row());
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid()) {
|
||||
selected_torrents << h;
|
||||
@@ -781,9 +789,13 @@ void TransferListWidget::setUpLimitSelectedTorrents() {
|
||||
}
|
||||
|
||||
void TransferListWidget::recheckSelectedTorrents() {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
BTSession->recheckTorrent(hash);
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -851,8 +863,10 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&){
|
||||
|
||||
#ifdef LIBTORRENT_0_15
|
||||
void TransferListWidget::toggleSelectedTorrentsSuperSeeding() {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
// Get the file hash
|
||||
QString hash = getHashFromRow(mapToSource(index).row());
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.has_metadata()) {
|
||||
h.super_seeding(!h.super_seeding());
|
||||
@@ -862,8 +876,10 @@ void TransferListWidget::toggleSelectedTorrentsSuperSeeding() {
|
||||
#endif
|
||||
|
||||
void TransferListWidget::toggleSelectedTorrentsSequentialDownload() {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
// Get the file hash
|
||||
QString hash = getHashFromRow(mapToSource(index).row());
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.has_metadata()) {
|
||||
h.set_sequential_download(!h.is_sequential_download());
|
||||
@@ -872,8 +888,10 @@ void TransferListWidget::toggleSelectedTorrentsSequentialDownload() {
|
||||
}
|
||||
|
||||
void TransferListWidget::toggleSelectedFirstLastPiecePrio() {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
// Get the file hash
|
||||
QString hash = getHashFromRow(mapToSource(index).row());
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.has_metadata()) {
|
||||
h.prioritize_first_last_piece(!h.first_last_piece_first());
|
||||
@@ -919,8 +937,12 @@ void TransferListWidget::renameSelectedTorrent() {
|
||||
}
|
||||
|
||||
void TransferListWidget::setSelectionLabel(QString label) {
|
||||
QStringList hashes = getSelectedTorrentsHashes();
|
||||
foreach(const QString &hash, hashes) {
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
QStringList hashes;
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
hashes << getHashFromRow(mapToSource(index).row());
|
||||
}
|
||||
foreach(const QString& hash, hashes) {
|
||||
Q_ASSERT(!hash.isEmpty());
|
||||
int row = getRowFromHash(hash);
|
||||
QString old_label = listModel->data(listModel->index(row, TR_LABEL)).toString();
|
||||
|
@@ -71,7 +71,6 @@ protected:
|
||||
bool loadColWidthList();
|
||||
void saveLastSortedColumn();
|
||||
void loadLastSortedColumn();
|
||||
QStringList getSelectedTorrentsHashes() const;
|
||||
|
||||
protected slots:
|
||||
int updateTorrent(int row);
|
||||
|
Reference in New Issue
Block a user