Commit 723a9c39 authored by Cristian Greco's avatar Cristian Greco

Imported Upstream version 2.9.6

parent 83ac9f98
......@@ -74,6 +74,7 @@ Translations authors:
copyright:
- Arabic: SDERAWI (abz8868@msn.com) and sn51234 (nesseyan@gmail.com)
- Armenian: Hrant Ohanyan (hrantohanyan@mail.am)
- Basque: Xabier Aramendi (azpidatziak@gmail.com)
- Belarusian: Mihas Varantsou (meequz@gmail.com)
- Brazilian: Nick Marinho (nickmarinho@gmail.com)
- Bulgarian: Tsvetan & Boyko Bankoff (emerge_life@users.sourceforge.net)
......
* Sat Mar 17 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.6
- BUGFIX: Fix download first/last pieces state reporting
- BUGFIX: Fix name of progress column in torrent content panel
- BUGFIX: Disable system tray icon on Mac OS X
- BUGFIX: RSS downloader should not ignore "Do not start automatically" rule (closes #946910)
- BUGFIX: Fix DHT port setting in Web UI (Closes #952182)
- BUGFIX: Fix possible Web UI authentication problem when using SSL (closes #941343)
- BUGFIX: Fix possible issues with folder removal when removing a torrent
- I18N: Add Basque translation
* Sat Feb 18 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.5
- BUGFIX: Fix crash when disabling then reenabling RSS
- BUGFIX: Fix duplicate torrent detection when adding a magnet link
......
......@@ -507,6 +507,7 @@ public:
#if LIBTORRENT_VERSION_MAJOR == 0 && LIBTORRENT_VERSION_MINOR < 16
required_libs << "filesystem" ;
#endif
required_libs << "thread";
QStringList libDirs;
if (!s.isEmpty())
libDirs << s;
......
......@@ -11,6 +11,8 @@ dist.commands += rm -fR ../$${PROJECT_NAME}-$${PROJECT_VERSION}/.git &&
dist.commands += rm -f ../$${PROJECT_NAME}-$${PROJECT_VERSION}/.gitignore &&
dist.commands += cd .. &&
dist.commands += tar czf $${PROJECT_NAME}-$${PROJECT_VERSION}.tar.gz $${PROJECT_NAME}-$${PROJECT_VERSION} &&
dist.commands += tar cf $${PROJECT_NAME}-$${PROJECT_VERSION}.tar $${PROJECT_NAME}-$${PROJECT_VERSION} &&
dist.commands += xz -f $${PROJECT_NAME}-$${PROJECT_VERSION}.tar &&
dist.commands += rm -fR $${PROJECT_NAME}-$${PROJECT_VERSION}
QMAKE_EXTRA_TARGETS += dist
......@@ -71,6 +71,7 @@ public:
#if LIBTORRENT_VERSION_MAJOR == 0 && LIBTORRENT_VERSION_MINOR < 16
required_libs << "filesystem" ;
#endif
required_libs << "thread";
QStringList libDirs;
if (!s.isEmpty())
libDirs << s;
......
......@@ -47,7 +47,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>2.9.5</string>
<string>2.9.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
......
......@@ -64,6 +64,7 @@ class about : public QDialog, private Ui::AboutDlg{
QString trans_txt = "<p>"+tr("I would like to thank the following people who volunteered to translate qBittorrent:")+"</p>";
trans_txt += QString::fromUtf8("<ul><li><u>Arabic:</u> SDERAWI (abz8868@msn.com) and sn51234 (nesseyan@gmail.com)</li>\
<li><u>Armenian:</u> Hrant Ohanyan (hrantohanyan@mail.am)</li>\
<li><u>Basque:</u> Xabier Aramendi (azpidatziak@gmail.com)</li>\
<li><u>Belarusian:</u> Mihas Varantsou (meequz@gmail.com)</li>\
<li><u>Brazilian:</u> Nick Marinho (nickmarinho@gmail.com)</li>\
<li><u>Bulgarian:</u> Tsvetan & Boyko Bankoff (emerge_life@users.sourceforge.net)</li>\
......
......@@ -35,5 +35,6 @@
<file>lang/qbittorrent_ro.qm</file>
<file>lang/qbittorrent_ka.qm</file>
<file>lang/qbittorrent_be.qm</file>
<file>lang/qbittorrent_eu.qm</file>
</qresource>
</RCC>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
This diff was suppressed by a .gitattributes entry.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -1002,9 +1002,9 @@ void MainWindow::loadPreferences(bool configure_session) {
QBtSession::instance()->addConsoleMessage(tr("Options were saved successfully."));
const Preferences pref;
const bool newSystrayIntegration = pref.systrayIntegration();
actionLock_qBittorrent->setEnabled(newSystrayIntegration);
if(newSystrayIntegration != (systrayIcon!=0)) {
if(newSystrayIntegration) {
actionLock_qBittorrent->setVisible(newSystrayIntegration);
if (newSystrayIntegration != (systrayIcon!=0)) {
if (newSystrayIntegration) {
// create the trayicon
if(!QSystemTrayIcon::isSystemTrayAvailable()) {
if(!configure_session) { // Program startup
......
......@@ -90,14 +90,6 @@ public:
return tmp.join("/");
}
static inline libtorrent::sha1_hash QStringToSha1(const QString& s) {
std::string str(s.toAscii().data());
std::istringstream i(str);
libtorrent::sha1_hash x;
i>>x;
return x;
}
static inline QString file_extension(const QString &filename) {
QString extension;
int point_index = filename.lastIndexOf(".");
......
......@@ -109,10 +109,14 @@ options_imp::options_imp(QWidget *parent):
// Load options
loadOptions();
// Disable systray integration if it is not supported by the system
if(!QSystemTrayIcon::isSystemTrayAvailable()){
#ifndef Q_WS_MAC
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
#endif
checkShowSystray->setChecked(false);
checkShowSystray->setEnabled(false);
#ifndef Q_WS_MAC
}
#endif
#if !defined(Q_WS_X11)
label_trayIconStyle->setVisible(false);
comboTrayIcon->setVisible(false);
......@@ -1272,6 +1276,7 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const
case QLocale::Arabic: return QString::fromUtf8("عربي");
case QLocale::Georgian: return QString::fromUtf8("ქართული");
case QLocale::Byelorussian: return QString::fromUtf8("Беларуская");
case QLocale::Basque: return QString::fromUtf8("Euskara");
case QLocale::Chinese: {
if(country == "cn")
return QString::fromUtf8("中文 (简体)");
......
......@@ -120,7 +120,11 @@ public:
}
bool systrayIntegration() const {
#ifdef Q_WS_MAC
return false;
#else
return value(QString::fromUtf8("Preferences/General/SystrayEnabled"), true).toBool();
#endif
}
void setSystrayIntegration(bool enabled) {
......
......@@ -90,6 +90,67 @@ const qreal QBtSession::MAX_RATIO = 9999.;
const int MAX_TRACKER_ERRORS = 2;
/* Converts a QString hash into a libtorrent sha1_hash */
static libtorrent::sha1_hash QStringToSha1(const QString& s) {
QByteArray raw = s.toAscii();
Q_ASSERT(raw.size() == 40);
libtorrent::sha1_hash ret;
from_hex(raw.constData(), 40, (char*)&ret[0]);
return ret;
}
/**
* Remove an empty folder tree.
*
* This function will also remove .DS_Store files on Mac OS and
* Thumbs.db on Windows.
*/
static bool smartRemoveEmptyFolderTree(const QString& dir_path)
{
qDebug() << Q_FUNC_INFO << dir_path;
if (dir_path.isEmpty())
return false;
QDir dir(dir_path);
if (!dir.exists())
return true;
// Remove Files created by the OS
#if defined Q_WS_MAC
QFile::remove(dir_path + QLatin1String("/.DS_Store"));
#elif defined Q_WS_WIN
QFile::remove(dir_path + QLatin1String("/Thumbs.db"));
#endif
QFileInfoList sub_files = dir.entryInfoList();
foreach (const QFileInfo& info, sub_files) {
QString sub_name = info.fileName();
if (sub_name == "." || sub_name == "..")
continue;
QString sub_path = info.absoluteFilePath();
qDebug() << Q_FUNC_INFO << "sub file: " << sub_path;
if (info.isDir()) {
if (!smartRemoveEmptyFolderTree(sub_path)) {
qWarning() << Q_FUNC_INFO << "Failed to remove folder: " << sub_path;
return false;
}
} else {
if (info.isHidden()) {
qDebug() << Q_FUNC_INFO << "Removing hidden file: " << sub_path;
if (!QFile::remove(sub_path)) {
qWarning() << Q_FUNC_INFO << "Failed to remove " << sub_path;
return false;
}
} else {
qWarning() << Q_FUNC_INFO << "Folder is not empty, aborting. Found: " << sub_path;
}
}
}
qDebug() << Q_FUNC_INFO << "Calling rmdir on " << dir_path;
return QDir().rmdir(dir_path);
}
// Main constructor
QBtSession::QBtSession()
: m_scanFolders(ScanFoldersModel::instance(this)),
......@@ -718,7 +779,7 @@ void QBtSession::useAlternativeSpeedsLimit(bool alternative) {
// Return the torrent handle, given its hash
QTorrentHandle QBtSession::getTorrentHandle(const QString &hash) const{
return QTorrentHandle(s->find_torrent(misc::QStringToSha1(hash)));
return QTorrentHandle(s->find_torrent(QStringToSha1(hash)));
}
bool QBtSession::hasActiveTorrents() const {
......@@ -772,8 +833,10 @@ void QBtSession::deleteTorrent(const QString &hash, bool delete_local_files) {
if(delete_local_files) {
if(h.has_metadata()) {
QDir save_dir(h.save_path());
if(save_dir != QDir(defaultSavePath) && (defaultTempPath.isEmpty() || save_dir != QDir(defaultTempPath)))
if (save_dir != QDir(defaultSavePath) && (defaultTempPath.isEmpty() || save_dir != QDir(defaultTempPath))) {
savePathsToRemove[hash] = save_dir.absolutePath();
qDebug() << "Save path to remove (async): " << save_dir.absolutePath();
}
}
s->remove_torrent(h, session::delete_files);
} else {
......@@ -787,7 +850,7 @@ void QBtSession::deleteTorrent(const QString &hash, bool delete_local_files) {
misc::safeRemove(uneeded_file);
const QString parent_folder = misc::branchPath(uneeded_file);
qDebug("Attempt to remove parent folder (if empty): %s", qPrintable(parent_folder));
misc::removeEmptyFolder(parent_folder);
QDir().rmpath(parent_folder);
}
}
// Remove it from torrent backup directory
......@@ -900,7 +963,7 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed) {
Q_ASSERT(magnet_uri.startsWith("magnet:", Qt::CaseInsensitive));
// Check for duplicate torrent
if(s->find_torrent(misc::QStringToSha1(hash)).is_valid()) {
if(s->find_torrent(QStringToSha1(hash)).is_valid()) {
qDebug("/!\\ Torrent is already in download list");
addConsoleMessage(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(magnet_uri));
return h;
......@@ -2345,7 +2408,7 @@ void QBtSession::readAlerts() {
if(savePathsToRemove.contains(hash)) {
const QString dirpath = savePathsToRemove.take(hash);
qDebug() << "Removing save path: " << dirpath << "...";
bool ok = misc::removeEmptyFolder(dirpath);
bool ok = smartRemoveEmptyFolderTree(dirpath);
Q_UNUSED(ok);
qDebug() << "Folder was removed: " << ok;
}
......@@ -2745,7 +2808,10 @@ void QBtSession::processDownloadedFile(QString url, QString file_path) {
emit newDownloadedTorrent(file_path, url);
} else {
url_skippingDlg.removeAt(index);
addTorrent(file_path, false, url, false);
QTorrentHandle h = addTorrent(file_path, false, url, false);
// Pause torrent if necessary
if (h.is_valid() && addInPause && Preferences().useAdditionDialog())
h.pause();
}
}
......
......@@ -169,7 +169,6 @@ bool QTorrentHandle::first_last_piece_first() const {
if(misc::isPreviewable(ext) && torrent_handle::file_priority(index) > 0) {
break;
}
++index;
}
if(index >= torrent_handle::get_torrent_info().num_files()) return false;
file_entry media_file = torrent_handle::get_torrent_info().file_at(index);
......
......@@ -221,4 +221,5 @@ TRANSLATIONS = $$LANG_PATH/qbittorrent_fr.ts \
$$LANG_PATH/qbittorrent_hy.ts \
$$LANG_PATH/qbittorrent_lt.ts \
$$LANG_PATH/qbittorrent_ka.ts \
$$LANG_PATH/qbittorrent_be.ts
$$LANG_PATH/qbittorrent_be.ts \
$$LANG_PATH/qbittorrent_eu.ts
......@@ -107,7 +107,7 @@ public:
}
}
TorrentFileItem(QList<QVariant> data) {
TorrentFileItem(const QList<QVariant>& data) {
parentItem = 0;
m_type = ROOT;
Q_ASSERT(data.size() == 4);
......@@ -173,7 +173,9 @@ public:
}
void setProgress(qulonglong done) {
if(getPriority() == 0) return;
Q_ASSERT (m_type != ROOT);
Q_ASSERT (parentItem);
if (getPriority() == 0) return;
total_done = done;
qulonglong size = getSize();
Q_ASSERT(total_done <= size);
......@@ -184,8 +186,7 @@ public:
progress = 1.;
Q_ASSERT(progress >= 0. && progress <= 1.);
itemData.replace(COL_PROGRESS, progress);
if(parentItem)
parentItem->updateProgress();
parentItem->updateProgress();
}
qulonglong getTotalDone() const {
......@@ -193,7 +194,8 @@ public:
}
qreal getProgress() const {
if(getPriority() == 0)
Q_ASSERT (m_type != ROOT);
if (getPriority() == 0)
return -1;
qulonglong size = getSize();
if(size > 0)
......@@ -313,7 +315,7 @@ public:
}
QVariant data(int column) const {
if(column == COL_PROGRESS)
if (column == COL_PROGRESS && m_type != ROOT)
return getProgress();
return itemData.value(column);
}
......
......@@ -923,7 +923,7 @@ applyPreferences = function() {
}
// Bittorrent
settings.set('dht', $('dht_checkbox').getProperty('checked'));
settings.set('dhtSameAsBT', $('DHTPortDiffThanBT_checkbox').getProperty('checked'));
settings.set('dhtSameAsBT', !$('DHTPortDiffThanBT_checkbox').getProperty('checked'));
settings.set('dht_port', $('DHTPort_txt').getProperty('value').toInt());
settings.set('pex', $('pex_checkbox').getProperty('checked'));
settings.set('lsd', $('lsd_checkbox').getProperty('checked'));
......
......@@ -78,20 +78,20 @@ void HttpConnection::handleDownloadFailure(const QString& url,
}
void HttpConnection::read() {
QByteArray input = m_socket->readAll();
static QByteArray input;
input.append(m_socket->readAll());
// Parse HTTP request header
int header_end = input.indexOf("\r\n\r\n");
if (header_end < 0) {
qDebug() << Q_FUNC_INFO << "missing double-CRLF";
m_generator.setStatusLine(400, "Bad Request");
write();
// Partial request waiting for the rest
return;
}
QByteArray header = input.left(header_end);
m_parser.writeHeader(header);
if (m_parser.isError()) {
qDebug() << Q_FUNC_INFO << "header parsing error";
qWarning() << Q_FUNC_INFO << "header parsing error";
input.clear();
m_generator.setStatusLine(400, "Bad Request");
write();
return;
......@@ -99,29 +99,30 @@ void HttpConnection::read() {
// Parse HTTP request message
if (m_parser.header().hasContentLength()) {
QByteArray message = input.mid(header_end + 4);
int expected_length = m_parser.header().contentLength();
const int expected_length = m_parser.header().contentLength();
QByteArray message = input.mid(header_end + 4, expected_length);
input = input.mid(header_end + 4 + expected_length);
if (expected_length > 100000) {
qWarning() << "Bad request: message too long";
m_generator.setStatusLine(400, "Bad Request");
input.clear();
write();
return;
}
bool is_reading = true;
while (message.length() < expected_length && is_reading) {
disconnect(m_socket, SIGNAL(readyRead()), this, SLOT(read()));
is_reading = m_socket->waitForReadyRead(2000);
if (is_reading) {
message.append(m_socket->readAll());
}
connect(m_socket, SIGNAL(readyRead()), this, SLOT(read()));
if (message.length() < expected_length) {
// Message too short, waiting for the rest
return;
}
m_parser.writeMessage(message);
} else {
input.clear();
}
if(m_parser.isError()) {
qDebug() << Q_FUNC_INFO << "message parsing error";
if (m_parser.isError()) {
qWarning() << Q_FUNC_INFO << "message parsing error";
m_generator.setStatusLine(400, "Bad Request");
write();
} else {
......
PROJECT_NAME = qbittorrent
PROJECT_VERSION = 2.9.5
PROJECT_VERSION = 2.9.6
os2 {
DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\'
......@@ -9,4 +9,4 @@ os2 {
DEFINES += VERSION_MAJOR=2
DEFINES += VERSION_MINOR=9
DEFINES += VERSION_BUGFIX=5
DEFINES += VERSION_BUGFIX=6
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment