1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-14 11:52:15 +02:00

Compare commits

...

40 Commits

Author SHA1 Message Date
Christophe Dumez
33147d842c Update changelog 2012-06-24 16:49:24 +03:00
Christophe Dumez
11e0b7c9b5 Support custom save path / label for RSS feeds using magnet links 2012-06-24 16:46:41 +03:00
Christophe Dumez
e8cd92e245 Update Changelog 2012-06-24 16:31:04 +03:00
Christophe Dumez
a757953b76 Fix issue with unreversible "Minimize to tray" 2012-06-24 16:27:24 +03:00
Christophe Dumez
a26da65419 Update Changelog 2012-06-24 15:04:52 +03:00
Christophe Dumez
1d9ef166bd Fix torrent loading on Mac OS X (closes #1011229) 2012-06-24 15:03:12 +03:00
Christophe Dumez
81a5201e41 Several Mac manifest file improvements 2012-06-24 14:37:08 +03:00
Christophe Dumez
9f9354af12 Update Mac plist file so that qBittorrent is properly detected as a torrent app 2012-06-24 11:39:24 +03:00
Christophe Dumez
ac1ebf4e13 Bump version to v2.9.10 2012-06-24 11:19:24 +03:00
Christophe Dumez
b9ccd3e74f Update Changelog 2012-06-24 10:45:55 +03:00
Christophe Dumez
4177a37d63 Fix compilation errors due to recent merge from master 2012-06-24 10:44:52 +03:00
Christophe Dumez
24a73c05b9 Mac compilation fix 2012-06-24 10:32:56 +03:00
Christophe Dumez
960d8d1bc9 Add support for RSS feeds using magnet links (Closes #1016379) 2012-06-24 10:32:10 +03:00
Tillmann Karras
da69983e64 missing 'e' in updateQueueingSystem 2012-06-20 20:18:18 +03:00
Tillmann Karras
6db7d36e4d Change MIME type for PNG images to image/png 2012-06-20 20:17:52 +03:00
Tillmann Karras
571963b1bd Make mascot image URL relative 2012-06-20 20:16:17 +03:00
Christophe Dumez
9e50e1ba7e Update Changelog 2012-06-10 20:17:27 +03:00
Christophe Dumez
82af132d8a Web UI: Stop using absolute URLs in ajax requests (closes #1011226) 2012-06-10 20:15:57 +03:00
Christian Kandeler
80dd666107 Fix compilation with namespaced Qt. 2012-05-30 22:31:18 +03:00
Christian Kandeler
ac50f0cdc2 Fix shadow builds under UNIX. 2012-05-30 22:29:48 +03:00
Christophe Dumez
bf685773e6 BUGFIX: Do not display .!qB file extensions in Web UI 2012-05-29 18:34:57 +03:00
Christophe Dumez
a0ada5c3ba Update changelog 2012-05-27 21:42:16 +03:00
Frédéric Brière
220fd4a7b8 Don't trip on absence of global ratio in QBtSession::processBigRatios()
QBtSession::processBigRatios() must fetch the global ratio, if
applicable, before checking for NO_RATIO_LIMIT.

LP: #835217
2012-05-27 21:41:14 +03:00
Christophe Dumez
d5622da576 Update Changelog 2012-05-26 10:30:53 +03:00
Christophe Dumez
55be2aa9a0 Remove 100kb limit for torrent file size in Web UI 2012-05-26 10:30:24 +03:00
Christophe Dumez
96f619b486 BUGFIX: Fix possible crash when showing torrent content (closes #1002586) 2012-05-22 21:20:23 +03:00
Christophe Dumez
89a1eb1bca Update Changelog 2012-05-20 19:31:40 +03:00
Christophe Dumez
de228fe074 Fix style of left panel 2012-05-20 19:29:21 +03:00
Christophe Dumez
8846f52ce1 Fix compilation error 2012-05-20 19:28:29 +03:00
Christophe Dumez
545ce42d4e Bump version to v2.9.9 2012-05-20 18:50:46 +03:00
Christophe Dumez
faf8b0e3f5 Update Changelog 2012-05-20 17:31:44 +03:00
Christophe Dumez
70a0b3cff3 Fix KickAssTorrents plugin 2012-05-20 17:28:32 +03:00
Christophe Dumez
24ab195d2f Make sure the hide/show text in the tray icon menu is correct 2012-05-20 16:54:12 +03:00
Christophe Dumez
4bd2641d70 Update Changelog 2012-05-20 16:06:53 +03:00
Christophe Dumez
7c5779eee0 RSS: Better cookies support 2012-05-20 16:05:42 +03:00
Christophe Dumez
0bbe4426c2 BUGFIX: More reliable RSS feed parsing (closes #1001777) 2012-05-20 14:10:46 +03:00
Christophe Dumez
595a190508 Options: Make sure first tab is initially selected 2012-05-17 18:41:21 +03:00
Christophe Dumez
ec30fe2498 Never disable the properties panel 2012-05-17 17:13:55 +03:00
Christophe Dumez
4d80d6ef5c Remove focus from widgets on left panel 2012-05-17 16:50:05 +03:00
Christophe Dumez
3d53e641c1 Fix compilation on Mac OS 2012-05-05 14:45:30 +03:00
40 changed files with 265 additions and 136 deletions

View File

@@ -1,3 +1,22 @@
* Sun Jun 24 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.10
- BUGFIX: Fix possible crash when showing torrent content (closes #1002586)
- BUGFIX: Add support for RSS feeds using magnet links (closes #1016379)
- BUGFIX: Remove 100kb limit for torrent file size in Web UI
- BUGFIX: Fix ratio limiting bug (closes #835217)
- BUGFIX: Do not display .!qB file extensions in Web UI
- BUGFIX: Stop using absolute URLs in Web UI ajax requests (closes #1011226)
- BUGFIX: Fix torrent association and loading on Mac OS X (closes #1011229)
- BUGFIX: Fix unreversible "Minimize to tray" on some window managers (closes #917825)
* Sun May 20 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.9
- BUGFIX: More reliable RSS feed parsing (closes #1001777)
- BUGFIX: Better support for cookies in RSS
- BUGFIX: Make sure show/hide text in tray icon menu is correct
- COSMETIC: Improve style of left panel
- COSMETIC: Never disable properties panel
- COSMETIC: Make sure first tab is initially selected in options dialog
- COSMETIC: Fix a few focus issues on Mac OS X
* Sat May 5 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.8
- BUGFIX: Various UI style fixes
- BUGFIX: Fix compilation with gcc 4.7

View File

@@ -5,6 +5,7 @@ DATADIR = /usr/local/share
# Use pkg-config to get all necessary libtorrent DEFINES
CONFIG += link_pkgconfig
PKGCONFIG += libtorrent-rasterbar
DEFINES += BOOST_ASIO_DYN_LINK
# Special include/libs paths (macports)
INCLUDEPATH += /usr/include/openssl /usr/include /opt/local/include/boost /opt/local/include

View File

@@ -13,10 +13,6 @@
<string>qBitTorrentDocument</string>
<key>CFBundleTypeName</key>
<string>BitTorrent Document</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/x-bittorrent</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
@@ -40,21 +36,55 @@
<string>BitTorrent Magnet URL</string>
</dict>
</array>
<key>CFBundleName</key>
<string>qBittorrent</string>
<key>CFBundleIconFile</key>
<string>qbittorrent_mac.icns</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>2.9.8</string>
<key>CFBundleShortVersionString</key>
<string>2.9.10</string>
<key>CFBundleSignature</key>
<string>????</string>
<string>qBit</string>
<key>CFBundleExecutable</key>
<string>qbittorrent</string>
<key>CFBundleIdentifier</key>
<string>org.qbittorrent</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
<key>NSAppleScriptEnabled</key>
<string>YES</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2006-2012 Christophe Dumez</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.item</string>
<string>com.bittorrent.torrent</string>
</array>
<key>UTTypeDescription</key>
<string>BitTorrent Document</string>
<key>UTTypeIconFile</key>
<string>qBitTorrentDocument</string>
<key>UTTypeIdentifier</key>
<string>org.bittorrent.torrent</string>
<key>UTTypeReferenceURL</key>
<string>http://www.bittorrent.org/beps/bep_0000.html</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>TORR</string>
<key>public.filename-extension</key>
<array>
<string>torrent</string>
</array>
<key>public.mime-type</key>
<string>application/x-bittorrent</string>
</dict>
</dict>
</array>
</dict>
</plist>

View File

@@ -32,7 +32,6 @@
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkProxy>
#include <QNetworkCookie>
#include <QNetworkCookieJar>
#include "downloadthread.h"
@@ -109,39 +108,21 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
reply->deleteLater();
}
#ifndef DISABLE_GUI
void DownloadThread::loadCookies(const QString &host_name, QString url) {
const QList<QByteArray> raw_cookies = RssSettings().getHostNameCookies(host_name);
QNetworkCookieJar *cookie_jar = m_networkManager.cookieJar();
QList<QNetworkCookie> cookies;
qDebug("Loading cookies for host name: %s", qPrintable(host_name));
foreach(const QByteArray& raw_cookie, raw_cookies) {
QList<QByteArray> cookie_parts = raw_cookie.split('=');
if(cookie_parts.size() == 2) {
qDebug("Loading cookie: %s", raw_cookie.constData());
cookies << QNetworkCookie(cookie_parts.first(), cookie_parts.last());
}
}
cookie_jar->setCookiesFromUrl(cookies, url);
m_networkManager.setCookieJar(cookie_jar);
}
#endif
void DownloadThread::downloadTorrentUrl(const QString &url) {
void DownloadThread::downloadTorrentUrl(const QString &url, const QList<QNetworkCookie>& cookies)
{
// Process request
QNetworkReply *reply = downloadUrl(url);
QNetworkReply *reply = downloadUrl(url, cookies);
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64)));
}
QNetworkReply* DownloadThread::downloadUrl(const QString &url){
QNetworkReply* DownloadThread::downloadUrl(const QString &url, const QList<QNetworkCookie>& cookies) {
// Update proxy settings
applyProxySettings();
#ifndef DISABLE_GUI
// Load cookies
QString host_name = QUrl::fromEncoded(url.toUtf8()).host();
if(!host_name.isEmpty())
loadCookies(host_name, url);
#endif
// Set cookies
if (!cookies.empty()) {
qDebug("Setting %d cookies for url: %s", cookies.size(), qPrintable(url));
m_networkManager.cookieJar()->setCookiesFromUrl(cookies, url);
}
// Process download request
qDebug("url is %s", qPrintable(url));
const QUrl qurl = QUrl::fromEncoded(url.toUtf8());

View File

@@ -32,6 +32,7 @@
#define DOWNLOADTHREAD_H
#include <QNetworkReply>
#include <QNetworkCookie>
#include <QObject>
#include <QHash>
#include <QSslError>
@@ -45,8 +46,8 @@ class DownloadThread : public QObject {
public:
DownloadThread(QObject* parent = 0);
QNetworkReply* downloadUrl(const QString &url);
void downloadTorrentUrl(const QString &url);
QNetworkReply* downloadUrl(const QString &url, const QList<QNetworkCookie>& raw_cookies = QList<QNetworkCookie>());
void downloadTorrentUrl(const QString &url, const QList<QNetworkCookie>& raw_cookies = QList<QNetworkCookie>());
//void setProxy(QString IP, int port, QString username, QString password);
signals:
@@ -63,9 +64,6 @@ private slots:
private:
QString errorCodeToString(QNetworkReply::NetworkError status);
void applyProxySettings();
#ifndef DISABLE_GUI
void loadCookies(const QString &host_name, QString url);
#endif
private:
QNetworkAccessManager m_networkManager;

View File

@@ -37,8 +37,8 @@ QT_BEGIN_NAMESPACE
namespace Ui {
class ExecutionLog;
}
class LogListWidget;
QT_END_NAMESPACE
class LogListWidget;
class ExecutionLog : public QWidget
{

View File

@@ -307,6 +307,9 @@ int main(int argc, char *argv[]){
QObject::connect(&app, SIGNAL(messageReceived(const QString&)),
&window, SLOT(processParams(const QString&)));
app.setActivationWindow(&window);
#ifdef Q_WS_MAC
static_cast<QMacApplication*>(&app)->setReadyToProcessEvents();
#endif // Q_WS_MAC
#else
// Load Headless class
HeadlessLoader loader(torrentCmdLine);

View File

@@ -145,6 +145,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), this, SLOT(finishedTorrent(QTorrentHandle)));
connect(QBtSession::instance(), SIGNAL(trackerAuthenticationRequired(QTorrentHandle)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle)));
connect(QBtSession::instance(), SIGNAL(newDownloadedTorrent(QString, QString)), this, SLOT(processDownloadedFiles(QString, QString)));
connect(QBtSession::instance(), SIGNAL(newMagnetLink(QString)), this, SLOT(processNewMagnetLink(QString)));
connect(QBtSession::instance(), SIGNAL(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString)));
connect(QBtSession::instance(), SIGNAL(alternativeSpeedsModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool)));
connect(QBtSession::instance(), SIGNAL(recursiveTorrentDownloadPossible(QTorrentHandle)), this, SLOT(askRecursiveTorrentDownloadConfirmation(QTorrentHandle)));
@@ -701,20 +702,12 @@ void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
return;
}
show();
if(isMinimized()) {
if(isMaximized()) {
showMaximized();
}else{
showNormal();
}
}
raise();
activateWindow();
}else{
hide();
}
}
actionToggleVisibility->setText(isVisible() ? tr("Hide") : tr("Show"));
}
// Display About Dialog
@@ -818,7 +811,7 @@ bool MainWindow::event(QEvent * e) {
// Iconify if there is no modal window
if(!has_modal_window) {
qDebug("Minimize to Tray enabled, hiding!");
e->accept();
e->ignore();
QTimer::singleShot(0, this, SLOT(hide()));
return true;
}
@@ -993,6 +986,17 @@ void MainWindow::processDownloadedFiles(QString path, QString url) {
}
}
void MainWindow::processNewMagnetLink(const QString& link)
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
if (useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
dialog->showLoadMagnetURI(link);
} else
QBtSession::instance()->addMagnetUri(link);
}
void MainWindow::optionsSaved() {
loadPreferences();
}
@@ -1209,12 +1213,17 @@ void MainWindow::updateAltSpeedsBtn(bool alternative) {
actionUse_alternative_speed_limits->setChecked(alternative);
}
void MainWindow::updateTrayIconMenu()
{
actionToggleVisibility->setText(isVisible() ? tr("Hide") : tr("Show"));
}
QMenu* MainWindow::getTrayIconMenu() {
if(myTrayIconMenu)
return myTrayIconMenu;
// Tray icon Menu
myTrayIconMenu = new QMenu(this);
actionToggleVisibility->setText(isVisible() ? tr("Hide") : tr("Show"));
connect(myTrayIconMenu, SIGNAL(aboutToShow()), SLOT(updateTrayIconMenu()));
myTrayIconMenu->addAction(actionToggleVisibility);
myTrayIconMenu->addSeparator();
myTrayIconMenu->addAction(actionOpen);

View File

@@ -111,6 +111,7 @@ protected slots:
void notifyOfUpdate(QString);
void showConnectionSettings();
void minimizeWindow();
void updateTrayIconMenu();
// Keyboard shortcuts
void createKeyboardShortcuts();
void displayTransferTab() const;
@@ -128,6 +129,7 @@ protected slots:
void addTorrent(QString path);
void addUnauthenticatedTracker(const QPair<QTorrentHandle,QString> &tracker);
void processDownloadedFiles(QString path, QString url);
void processNewMagnetLink(const QString& link);
void finishedTorrent(const QTorrentHandle& h) const;
void askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h);
// Options slots

View File

@@ -72,7 +72,7 @@
<bool>false</bool>
</property>
<property name="currentRow">
<number>-1</number>
<number>0</number>
</property>
<item>
<property name="text">
@@ -1419,7 +1419,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>395</width>
<width>363</width>
<height>480</height>
</rect>
</property>

View File

@@ -70,7 +70,6 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
trackerDownButton->setIcon(IconProvider::instance()->getIcon("go-down"));
state = VISIBLE;
setEnabled(false);
// Set Properties list model
PropListModel = new TorrentFilesFilterModel();
@@ -204,7 +203,6 @@ void PropertiesWidget::clear() {
PropListModel->model()->clear();
showPiecesAvailability(false);
showPiecesDownloaded(false);
setEnabled(false);
}
QTorrentHandle PropertiesWidget::getCurrentTorrent() const {
@@ -241,7 +239,6 @@ void PropertiesWidget::loadTorrentInfos(const QTorrentHandle &_h) {
clear();
return;
}
setEnabled(true);
try {
// Save path
@@ -655,7 +652,7 @@ void PropertiesWidget::deleteSelectedUrlSeeds(){
bool PropertiesWidget::applyPriorities() {
qDebug("Saving files priorities");
const std::vector<int> priorities = PropListModel->model()->getFilesPriorities(h.get_torrent_info().num_files());
const std::vector<int> priorities = PropListModel->model()->getFilesPriorities();
// Save first/last piece first option state
bool first_last_piece_first = h.first_last_piece_first();
// Prioritize the files

View File

@@ -34,11 +34,21 @@
#include "qmacapplication.h"
QMacApplication::QMacApplication(QString appid, int &argc, char** argv) :
QtSingleApplication(appid, argc, argv)
QtSingleApplication(appid, argc, argv),
m_readyToProcessEvents(false)
{
qDebug("Constructing a QMacApplication to receive file open events");
}
void QMacApplication::setReadyToProcessEvents()
{
m_readyToProcessEvents = true;
if (!m_torrentsQueue.isEmpty()) {
emit newFileOpenMacEvent(m_torrentsQueue.join("|"));
m_torrentsQueue.clear();
}
}
bool QMacApplication::event(QEvent * ev) {
switch (ev->type()) {
case QEvent::FileOpen:
@@ -49,7 +59,10 @@ bool QMacApplication::event(QEvent * ev) {
path = static_cast<QFileOpenEvent *>(ev)->url().toString();
}
qDebug("Received a mac file open event: %s", qPrintable(path));
emit newFileOpenMacEvent(path);
if (m_readyToProcessEvents)
emit newFileOpenMacEvent(path);
else
m_torrentsQueue.append(path);
return true;
}
default:

View File

@@ -31,12 +31,14 @@
#define QMACAPPLICATION_H
#include "qtsingleapplication.h"
#include <QStringList>
class QMacApplication : public QtSingleApplication
{
Q_OBJECT
public:
explicit QMacApplication(QString appid, int &argc, char** argv);
void setReadyToProcessEvents();
signals:
void newFileOpenMacEvent(const QString &path);
@@ -44,6 +46,9 @@ signals:
protected:
bool event(QEvent *);
private:
bool m_readyToProcessEvents;
QStringList m_torrentsQueue;
};
#endif // QMACAPPLICATION_H

View File

@@ -181,7 +181,7 @@ QBtSession::QBtSession()
const QString peer_id = "qB";
// Construct session
s = new session(fingerprint(peer_id.toLocal8Bit().constData(), version.at(0), version.at(1), version.at(2), version.at(3)), 0);
std::cout << "Peer ID: " << fingerprint(peer_id.toLocal8Bit().constData(), version.at(0), version.at(1), version.at(2), version.at(3)).to_string() << std::endl;
//std::cout << "Peer ID: " << fingerprint(peer_id.toLocal8Bit().constData(), version.at(0), version.at(1), version.at(2), version.at(3)).to_string() << std::endl;
addConsoleMessage("Peer ID: "+misc::toQString(fingerprint(peer_id.toLocal8Bit().constData(), version.at(0), version.at(1), version.at(2), version.at(3)).to_string()));
// Set severity level of libtorrent session
@@ -280,10 +280,10 @@ void QBtSession::processBigRatios() {
const QString hash = h.hash();
const qreal ratio = getRealRatio(hash);
qreal ratio_limit = TorrentPersistentData::getRatioLimit(hash);
if(ratio_limit == TorrentPersistentData::NO_RATIO_LIMIT)
continue;
if(ratio_limit == TorrentPersistentData::USE_GLOBAL_RATIO)
ratio_limit = global_ratio_limit;
if(ratio_limit == TorrentPersistentData::NO_RATIO_LIMIT)
continue;
qDebug("Ratio: %f (limit: %f)", ratio, ratio_limit);
Q_ASSERT(ratio_limit >= 0.f);
if(ratio <= MAX_RATIO && ratio >= ratio_limit) {
@@ -445,7 +445,7 @@ void QBtSession::configureSession() {
// * Session settings
session_settings sessionSettings = s->settings();
sessionSettings.user_agent = "qBittorrent "VERSION;
std::cout << "HTTP user agent is " << sessionSettings.user_agent << std::endl;
//std::cout << "HTTP user agent is " << sessionSettings.user_agent << std::endl;
addConsoleMessage(tr("HTTP user agent is %1").arg(misc::toQString(sessionSettings.user_agent)));
sessionSettings.upnp_ignore_nonrouters = true;
@@ -972,7 +972,17 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed) {
add_torrent_params p = initializeAddTorrentParams(hash);
// Get save path
const QString savePath(getSavePath(hash, false));
QString savePath;
if (!resumed && savepathLabel_fromurl.contains(magnet_uri)) {
QPair<QString, QString> savePath_label = savepathLabel_fromurl.take(magnet_uri);
if(!savePath_label.first.isEmpty())
savePath = savePath_label.first;
// Remember label
if(!savePath_label.second.isEmpty())
TorrentTempData::setLabel(hash, savePath_label.second);
}
if (savePath.isEmpty())
savePath = getSavePath(hash, false);
if(!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash) && resumed) {
qDebug("addMagnetURI: Temp folder is enabled.");
QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
@@ -2757,7 +2767,8 @@ QString QBtSession::getSavePath(const QString &hash, bool fromScanDir, QString f
// Take an url string to a torrent file,
// download the torrent file to a tmp location, then
// add it to download list
void QBtSession::downloadFromUrl(const QString &url) {
void QBtSession::downloadFromUrl(const QString &url, const QList<QNetworkCookie>& cookies)
{
addConsoleMessage(tr("Downloading '%1', please wait...", "e.g: Downloading 'xxx.torrent', please wait...").arg(url)
#ifndef DISABLE_GUI
, QPalette::WindowText
@@ -2765,7 +2776,7 @@ void QBtSession::downloadFromUrl(const QString &url) {
);
//emit aboutToDownloadFromUrl(url);
// Launch downloader thread
downloader->downloadTorrentUrl(url);
downloader->downloadTorrentUrl(url, cookies);
}
void QBtSession::downloadFromURLList(const QStringList& urls) {
@@ -2774,14 +2785,22 @@ void QBtSession::downloadFromURLList(const QStringList& urls) {
}
}
void QBtSession::addMagnetSkipAddDlg(QString uri) {
void QBtSession::addMagnetInteractive(const QString& uri)
{
emit newMagnetLink(uri);
}
void QBtSession::addMagnetSkipAddDlg(const QString& uri, const QString& save_path, const QString& label) {
if (!save_path.isEmpty() || !label.isEmpty())
savepathLabel_fromurl[uri] = qMakePair(save_path, label);
addMagnetUri(uri, false);
}
void QBtSession::downloadUrlAndSkipDialog(QString url, QString save_path, QString label) {
//emit aboutToDownloadFromUrl(url);
const QUrl qurl = QUrl::fromEncoded(url.toUtf8());
savepathLabel_fromurl[qurl] = qMakePair(save_path, label);
if (!save_path.isEmpty() || !label.isEmpty())
savepathLabel_fromurl[qurl] = qMakePair(save_path, label);
url_skippingDlg << qurl;
// Launch downloader thread
downloader->downloadTorrentUrl(url);

View File

@@ -41,6 +41,7 @@
#endif
#include <QPointer>
#include <QTimer>
#include <QNetworkCookie>
#include <libtorrent/version.hpp>
#include <libtorrent/session.hpp>
@@ -107,7 +108,7 @@ public slots:
QTorrentHandle addMagnetUri(QString magnet_uri, bool resumed=false);
void loadSessionState();
void saveSessionState();
void downloadFromUrl(const QString &url);
void downloadFromUrl(const QString &url, const QList<QNetworkCookie>& cookies = QList<QNetworkCookie>());
void deleteTorrent(const QString &hash, bool delete_local_files = false);
void startUpTorrents();
void recheckTorrent(const QString &hash);
@@ -163,7 +164,8 @@ public slots:
#endif
void addPeerBanMessage(QString msg, bool from_ipfilter);
void processDownloadedFile(QString, QString);
void addMagnetSkipAddDlg(QString uri);
void addMagnetSkipAddDlg(const QString& uri, const QString& save_path = QString(), const QString& label = QString());
void addMagnetInteractive(const QString& uri);
void downloadFromURLList(const QStringList& urls);
void configureSession();
void banIP(QString ip);
@@ -204,6 +206,7 @@ signals:
void trackerError(const QString &hash, QString time, QString msg);
void trackerAuthenticationRequired(const QTorrentHandle& h);
void newDownloadedTorrent(QString path, QString url);
void newMagnetLink(const QString& link);
void updateFileSize(const QString &hash);
void downloadFromUrlFailure(QString url, QString reason);
void torrentFinishedChecking(const QTorrentHandle& h);

View File

@@ -124,13 +124,14 @@ void RSSImp::on_actionManage_cookies_triggered() {
Q_ASSERT(!m_feedList->selectedItems().empty());
// Get feed hostname
QString feed_url = m_feedList->getItemID(m_feedList->selectedItems().first());
QString feed_hostname = QUrl::fromEncoded(feed_url.toLocal8Bit()).host();
QString feed_hostname = QUrl::fromEncoded(feed_url.toUtf8()).host();
qDebug("RSS Feed hostname is: %s", qPrintable(feed_hostname));
Q_ASSERT(!feed_hostname.isEmpty());
bool ok = false;
RssSettings settings;
QList<QByteArray> raw_cookies = CookiesDlg::askForCookies(this, settings.getHostNameCookies(feed_hostname), &ok);
if(ok) {
if (ok) {
qDebug() << "Settings cookies for host name: " << feed_hostname;
settings.setHostNameCookies(feed_hostname, raw_cookies);
}
}
@@ -325,10 +326,28 @@ void RSSImp::downloadTorrent() {
foreach(const QListWidgetItem* item, selected_items) {
const RssArticle article = m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString())
->getItem(item->data(Article::IdRole).toString());
if(article.hasAttachment()) {
QBtSession::instance()->downloadFromUrl(article.torrentUrl());
} else {
QBtSession::instance()->downloadFromUrl(article.link());
QString torrentLink = article.hasAttachment() ? article.torrentUrl() : article.link();
// Check if it is a magnet link
if (torrentLink.startsWith("magnet:", Qt::CaseInsensitive))
QBtSession::instance()->addMagnetInteractive(torrentLink);
else {
// Load possible cookies
QList<QNetworkCookie> cookies;
QString feed_url = m_feedList->getItemID(m_feedList->selectedItems().first());
QString feed_hostname = QUrl::fromEncoded(feed_url.toUtf8()).host();
const QList<QByteArray> raw_cookies = RssSettings().getHostNameCookies(feed_hostname);
foreach (const QByteArray& raw_cookie, raw_cookies) {
QList<QByteArray> cookie_parts = raw_cookie.split('=');
if (cookie_parts.size() == 2) {
qDebug("Loading cookie: %s = %s", cookie_parts.first().constData(), cookie_parts.last().constData());
cookies << QNetworkCookie(cookie_parts.first(), cookie_parts.last());
}
}
qDebug("Loaded %d cookies for RSS item\n", cookies.size());
QBtSession::instance()->downloadFromUrl(torrentLink, cookies);
}
}
}

View File

@@ -229,6 +229,13 @@ RssArticle::RssArticle(RssFeed* parent, QXmlStreamReader& xml)
}
}
}
// If guid is empty, fall back to some other identifier
if (d->guid.isEmpty()) {
if (!d->link.isEmpty())
d->guid = d->link;
else if (!d->title.isEmpty())
d->guid = d->title;
}
}
RssArticle::RssArticle(RssFeed* parent, const QString &guid) {

View File

@@ -314,7 +314,10 @@ void RssFeed::downloadMatchingArticleTorrents() {
item.markAsRead();
// Download the torrent
QBtSession::instance()->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(item.title()).arg(displayName()));
QBtSession::instance()->downloadUrlAndSkipDialog(torrent_url, matching_rule.savePath(), matching_rule.label());
if (torrent_url.startsWith("magnet:", Qt::CaseInsensitive))
QBtSession::instance()->addMagnetSkipAddDlg(torrent_url, matching_rule.savePath(), matching_rule.label());
else
QBtSession::instance()->downloadUrlAndSkipDialog(torrent_url, matching_rule.savePath(), matching_rule.label());
}
}
}

View File

@@ -1,4 +1,4 @@
#VERSION: 1.21
#VERSION: 1.22
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
# Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@ class kickasstorrents(object):
self.results = []
def download_torrent(self, info):
print download_file(info)
print download_file(info, info)
def search(self, what, cat='all'):
ret = []

View File

@@ -1,4 +1,4 @@
#VERSION: 1.21
#VERSION: 1.22
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
# Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@ class kickasstorrents(object):
self.results = []
def download_torrent(self, info):
print(download_file(info))
print(download_file(info, info))
def search(self, what, cat='all'):
ret = []

View File

@@ -421,7 +421,8 @@ void SearchEngine::downloadTorrent(QString engine_url, QString torrent_url) {
qDebug("Converting bc link to magnet link");
torrent_url = misc::bcLinkToMagnet(torrent_url);
}
if(torrent_url.startsWith("magnet:")) {
qDebug() << Q_FUNC_INFO << torrent_url;
if (torrent_url.startsWith("magnet:")) {
QStringList urls;
urls << torrent_url;
mp_mainWindow->downloadFromURLList(urls);

View File

@@ -501,10 +501,8 @@ void torrentAdditionDialog::updateDiskSpaceLabels() {
// Determine torrent size
qulonglong torrent_size = 0;
if(t->num_files() > 1) {
const unsigned int nbFiles = t->num_files();
const std::vector<int> priorities = PropListModel->model()->getFilesPriorities(nbFiles);
for(unsigned int i=0; i<nbFiles; ++i) {
const std::vector<int> priorities = PropListModel->model()->getFilesPriorities();
for(unsigned int i=0; i<priorities.size(); ++i) {
if(priorities[i] > 0)
torrent_size += t->file_at(i).size;
}
@@ -598,7 +596,7 @@ bool torrentAdditionDialog::allFiltered() const {
void torrentAdditionDialog::savePiecesPriorities(){
qDebug("Saving pieces priorities");
Q_ASSERT(!is_magnet);
const std::vector<int> priorities = PropListModel->model()->getFilesPriorities(t->num_files());
const std::vector<int> priorities = PropListModel->model()->getFilesPriorities();
TorrentTempData::setFilesPriority(hash, priorities);
}

View File

@@ -338,11 +338,10 @@ class TorrentFilesModel: public QAbstractItemModel {
private:
TorrentFileItem *rootItem;
TorrentFileItem **files_index;
std::vector<TorrentFileItem *> files_index;
public:
TorrentFilesModel(QObject *parent=0): QAbstractItemModel(parent) {
files_index = 0;
QList<QVariant> rootData;
rootData << tr("Name") << tr("Size") << tr("Progress") << tr("Priority");
rootItem = new TorrentFileItem(rootData);
@@ -350,13 +349,16 @@ public:
~TorrentFilesModel() {
qDebug() << Q_FUNC_INFO << "ENTER";
delete [] files_index;
delete rootItem;
qDebug() << Q_FUNC_INFO << "EXIT";
}
void updateFilesProgress(std::vector<libtorrent::size_type> fp) {
void updateFilesProgress(const std::vector<libtorrent::size_type>& fp) {
emit layoutAboutToBeChanged();
if (fp.size() != files_index.size())
return;
for(unsigned int i=0; i<fp.size(); ++i) {
Q_ASSERT(fp[i] >= 0);
files_index[i]->setProgress(fp[i]);
@@ -366,6 +368,10 @@ public:
void updateFilesPriorities(const std::vector<int> &fprio) {
emit layoutAboutToBeChanged();
if (fprio.size() != files_index.size())
return;
for(unsigned int i=0; i<fprio.size(); ++i) {
//qDebug("Called updateFilesPriorities with %d", fprio[i]);
files_index[i]->setPriority(fprio[i]);
@@ -373,9 +379,9 @@ public:
emit dataChanged(index(0,0), index(rowCount(), columnCount()));
}
std::vector<int> getFilesPriorities(unsigned int nbFiles) const {
std::vector<int> getFilesPriorities() const {
std::vector<int> prio;
for(unsigned int i=0; i<nbFiles; ++i) {
for(unsigned int i=0; i<files_index.size(); ++i) {
//qDebug("Called getFilesPriorities: %d", files_index[i]->getPriority());
prio.push_back(files_index[i]->getPriority());
}
@@ -541,10 +547,7 @@ public:
void clear() {
qDebug("clear called");
beginResetModel();
if(files_index) {
delete [] files_index;
files_index = 0;
}
files_index.clear();
rootItem->deleteAllChildren();
endResetModel();
}
@@ -555,7 +558,7 @@ public:
emit layoutAboutToBeChanged();
// Initialize files_index array
qDebug("Torrent contains %d files", t.num_files());
files_index = new TorrentFileItem*[t.num_files()];
files_index.reserve(t.num_files());
TorrentFileItem *parent = this->rootItem;
TorrentFileItem *root_folder = parent;
@@ -582,8 +585,7 @@ public:
current_parent = new_parent;
}
// Actually create the file
TorrentFileItem *f = new TorrentFileItem(t, fentry, current_parent, i);
files_index[i] = f;
files_index.push_back(new TorrentFileItem(t, fentry, current_parent, i));
}
emit layoutChanged();
}

View File

@@ -42,6 +42,7 @@
#include <QStandardItemModel>
#include <QMessageBox>
#include <QScrollBar>
#include <QLabel>
#include "transferlistdelegate.h"
#include "transferlistwidget.h"
@@ -62,6 +63,7 @@ public:
// Accept drop
setAcceptDrops(true);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
setStyleSheet("QListWidget { background: transparent; border: 0 }");
}
// Redefine addItem() to make sure the list stays sorted
@@ -158,13 +160,14 @@ public:
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// Height is fixed (sizeHint().height() is used)
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
setStyleSheet("QListWidget { background: transparent; border: 0 }");
}
protected:
QSize sizeHint() const {
QSize size = QListWidget::sizeHint();
// Height should be exactly the height of the content
size.setHeight(contentsSize().height() + 2 * frameWidth());
size.setHeight(contentsSize().height() + 2 * frameWidth() + 6);
return size;
}
@@ -190,10 +193,23 @@ public:
// Construct lists
vLayout = new QVBoxLayout();
vLayout->setContentsMargins(0, 4, 0, 4);
QFont font;
font.setBold(true);
font.setCapitalization(QFont::SmallCaps);
QLabel *torrentsLabel = new QLabel(tr("Torrents"));
torrentsLabel->setIndent(2);
torrentsLabel->setFont(font);
vLayout->addWidget(torrentsLabel);
statusFilters = new StatusFiltersWidget(this);
vLayout->addWidget(statusFilters);
statusFilters->setFocusPolicy(Qt::NoFocus);
QLabel *labelsLabel = new QLabel(tr("Labels"));
labelsLabel->setIndent(2);
labelsLabel->setFont(font);
vLayout->addWidget(labelsLabel);
labelFilters = new LabelFiltersList(this);
vLayout->addWidget(labelFilters);
labelFilters->setFocusPolicy(Qt::NoFocus);
setLayout(vLayout);
labelFilters->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
statusFilters->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

View File

@@ -109,7 +109,10 @@ QList<QVariantMap> EventManager::getPropFilesInfo(QString hash) const {
h.file_progress(fp);
for(int i=0; i<h.num_files(); ++i) {
QVariantMap file;
file["name"] = h.filename_at(i);
QString fileName = h.filename_at(i);
if (fileName.endsWith(".!qB"))
fileName.chop(4);
file["name"] = fileName;
libtorrent::size_type size = h.filesize_at(i);
file["size"] = misc::friendlyUnit((double)size);
if(size > 0)

View File

@@ -1,4 +1,4 @@
<img src="../images/skin/mascot.png" align="right"></img>
<img src="images/skin/mascot.png" align="right"></img>
<p>qBittorrent ${VERSION} (Web UI)</p>
<p>Copyright (c) 2011 <a href="mailto:chris@qbittorrent.org">Christophe Dumez</a></p>
<p>Homepage: <a href="http://www.qbittorrent.com">http://www.qbittorrent.com</a></p>

View File

@@ -12,7 +12,7 @@
$('addTrackersButton').addEvent('click', function(e){
new Event(e).stop();
var hash = new URI().getData('hash');
new Request({url: '/command/addTrackers', method: 'post', data: {hash: hash, urls: $('trackersUrls').value},
new Request({url: 'command/addTrackers', method: 'post', data: {hash: hash, urls: $('trackersUrls').value},
onComplete: function() {
window.parent.document.getElementById('trackersPage').parentNode.removeChild(window.parent.document.getElementById('trackersPage'));
}

View File

@@ -45,9 +45,9 @@ window.addEvent('domready', function(){
});
$('confirmBtn').addEvent('click', function(e){
new Event(e).stop();
var cmd = '/command/delete';
var cmd = 'command/delete';
if($('deleteFromDiskCB').get('checked'))
cmd = '/command/deletePerm';
cmd = 'command/deletePerm';
new Request({url: cmd,
method: 'post',
data: {hashes: hashes.join('|')},

View File

@@ -25,7 +25,7 @@
setDlLimit = function() {
var limit = $("dllimitUpdatevalue").get('html').toInt() * 1024;
if(hash == "global") {
new Request({url: '/command/setGlobalDlLimit',
new Request({url: 'command/setGlobalDlLimit',
method: 'post',
data: {'limit': limit},
onComplete: function() {
@@ -33,7 +33,7 @@
}
}).send();
} else {
new Request({url: '/command/setTorrentDlLimit',
new Request({url: 'command/setTorrentDlLimit',
method: 'post',
data: {'hash': hash, 'limit': limit},
onComplete: function() {
@@ -51,4 +51,4 @@
</script>
</body>
</html>
</html>

View File

@@ -196,7 +196,7 @@
<fieldset class="settings">
<legend>_(Torrent Queueing)</legend>
<input type="checkbox" id="queueing_checkbox" onclick="updateQueuingSystem();"/>
<input type="checkbox" id="queueing_checkbox" onclick="updateQueueingSystem();"/>
<label for="queueing_checkbox">_(Torrent Queueing)</label><br/>
<div class="formRow">
<label for="max_active_dl_value" style="margin-left: 20px;" class="leftLabelLarge">_(Maximum active downloads:)</label>
@@ -1043,7 +1043,7 @@ applyPreferences = function() {
// Send it to qBT
var json_str = JSON.encode(settings);
new Request({url: '/command/setPreferences',
new Request({url: 'command/setPreferences',
method: 'post',
data: {'json': json_str,
},

View File

@@ -88,7 +88,7 @@ var allCBUnchecked = function() {
var setFilePriority = function(id, priority) {
if(current_hash == "") return;
new Request({url: '/command/setFilePrio', method: 'post', data: {'hash': current_hash, 'id': id, 'priority': priority}}).send();
new Request({url: 'command/setFilePrio', method: 'post', data: {'hash': current_hash, 'id': id, 'priority': priority}}).send();
// Display or add combobox
if(priority > 0) {
$('comboPrio'+id).set("value", 1);

View File

@@ -15,7 +15,7 @@ function hideAll() {
<iframe id="upload_frame" name="upload_frame" style="width:1px;height:1px;border:0px;" src="javascript:false;"></iframe>
<center>
<h1 class="vcenter"><img class="vcenter" title="Download local torrent" src="theme/list-add"/>_(Download local torrent)</h1>
<form action="/command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame">
<form action="command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame">
<input type="file" name="torrentfile" id="torrentfile" size="40"/><br/><br/>
<input type="submit" value="_(Download)" id="upButton"/>
</form>

Some files were not shown because too many files have changed in this diff Show More