Compare commits

...

7 Commits

Author SHA1 Message Date
Christophe Dumez
eda04b3ef3 Bump version to v2.9.5 2012-02-19 20:55:58 +02:00
Christophe Dumez
3ef6e7bf65 Update Changelog 2012-02-19 20:39:58 +02:00
Christophe Dumez
146cf9a435 Several RSS fixes:
- Fix possible redownload of torrents marked as read (Closes #927495)
- Properly remove RSS feed settings/history upon feed removal
- Fix possible crash in RSS Downloader dialog in debug mode
2012-02-19 20:36:01 +02:00
Christophe Dumez
dff6b057b9 Update Changelog 2012-02-19 20:00:42 +02:00
Christophe Dumez
3b7448dfc7 Fix import of new trackers when adding a torrent with same hash (Closes #747000) 2012-02-19 19:59:23 +02:00
Christophe Dumez
4e4ac771a9 Fix duplicate torrent detection when adding a magnet link 2012-02-19 19:49:57 +02:00
Christophe Dumez
06a376d014 BUGFIX: Fix crash when disabling then reenabling RSS 2012-02-19 18:55:34 +02:00
13 changed files with 53 additions and 38 deletions

View File

@@ -1,3 +1,10 @@
* 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
- BUGFIX: Fix import of new trackers when adding a torrent with same hash (Closes #747000)
- BUGFIX: Fix possible redownload of torrents marked as read (Closes #927495)
- BUGFIX: Properly remove RSS feed settings/history upon feed removal
* Sat Feb 18 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.4
- BUGFIX: qBittorrent does not handle redirection to relative URLs correctly (Closes #919905)
- BUGFIX: Cmd+M minimizes main window on Mac OS X (Closes #928216)

View File

@@ -47,7 +47,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>2.9.4</string>
<string>2.9.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>

View File

@@ -80,10 +80,6 @@ public:
return QString(o.str().c_str());
}
static inline libtorrent::sha1_hash toSha1Hash(const QString &hash) {
return libtorrent::sha1_hash(hash.toAscii().constData());
}
static void chmod644(const QDir& folder);
static inline QString removeLastPathPart(QString path) {
@@ -95,7 +91,7 @@ public:
}
static inline libtorrent::sha1_hash QStringToSha1(const QString& s) {
std::string str(s.toLocal8Bit().data());
std::string str(s.toAscii().data());
std::istringstream i(str);
libtorrent::sha1_hash x;
i>>x;

View File

@@ -900,7 +900,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::toSha1Hash(hash)).is_valid()) {
if(s->find_torrent(misc::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;
@@ -1316,35 +1316,37 @@ void QBtSession::mergeTorrents(QTorrentHandle &h_ex, boost::intrusive_ptr<torren
// Check if the torrent contains trackers or url seeds we don't know about
// and add them
if(!h_ex.is_valid()) return;
std::vector<announce_entry> old_trackers = h_ex.trackers();
std::vector<announce_entry> existing_trackers = h_ex.trackers();
std::vector<announce_entry> new_trackers = t->trackers();
bool trackers_added = false;
for(std::vector<announce_entry>::iterator it=new_trackers.begin();it!=new_trackers.end();it++) {
std::string tracker_url = it->url;
foreach (const announce_entry& new_tracker, new_trackers) {
std::string new_tracker_url = new_tracker.url;
// Check if existing torrent has this tracker
bool found = false;
for(std::vector<announce_entry>::iterator itold=old_trackers.begin();itold!=old_trackers.end();itold++) {
if(tracker_url == itold->url) {
foreach (const announce_entry& existing_tracker, existing_trackers) {
if(QUrl(new_tracker_url.c_str()) == QUrl(existing_tracker.url.c_str())) {
found = true;
break;
}
}
if(found) {
if (!found) {
h_ex.add_tracker(announce_entry(new_tracker_url));
trackers_added = true;
announce_entry entry(tracker_url);
h_ex.add_tracker(entry);
}
}
if(trackers_added) {
if (trackers_added)
addConsoleMessage(tr("Note: new trackers were added to the existing torrent."));
}
bool urlseeds_added = false;
const QStringList old_urlseeds = h_ex.url_seeds();
#if LIBTORRENT_VERSION_MINOR > 15
std::vector<web_seed_entry> new_urlseeds = t->web_seeds();
std::vector<web_seed_entry>::iterator it;
for(it = new_urlseeds.begin(); it != new_urlseeds.end(); it++) {
for (it = new_urlseeds.begin(); it != new_urlseeds.end(); it++) {
const QString new_url = misc::toQString(it->url.c_str());
if(!old_urlseeds.contains(new_url)) {
if (!old_urlseeds.contains(new_url)) {
urlseeds_added = true;
h_ex.add_url_seed(new_url);
}
@@ -1352,17 +1354,16 @@ void QBtSession::mergeTorrents(QTorrentHandle &h_ex, boost::intrusive_ptr<torren
#else
std::vector<std::string> new_urlseeds = t->url_seeds();
std::vector<std::string>::iterator it;
for(it = new_urlseeds.begin(); it != new_urlseeds.end(); it++) {
for (it = new_urlseeds.begin(); it != new_urlseeds.end(); it++) {
const QString new_url = misc::toQString(it->c_str());
if(!old_urlseeds.contains(new_url)) {
if (!old_urlseeds.contains(new_url)) {
urlseeds_added = true;
h_ex.add_url_seed(new_url);
}
}
#endif
if(urlseeds_added) {
if(urlseeds_added)
addConsoleMessage(tr("Note: new URL seeds were added to the existing torrent."));
}
}
void QBtSession::exportTorrentFiles(QString path) {

View File

@@ -471,8 +471,7 @@ void AutomatedRssDownloader::updateMatchingArticles()
if(!rule.isValid()) continue;
foreach(const QString &feed_url, rule.rssFeeds()) {
qDebug() << Q_FUNC_INFO << feed_url;
Q_ASSERT(all_feeds.contains(feed_url));
if(!all_feeds.contains(feed_url)) continue;
if(!all_feeds.contains(feed_url)) continue; // Feed was removed
const RssFeed *feed = all_feeds.value(feed_url);
Q_ASSERT(feed);
if(!feed) continue;

View File

@@ -51,8 +51,10 @@ RssDownloadRuleList* RssDownloadRuleList::instance()
void RssDownloadRuleList::drop()
{
if(m_instance)
if(m_instance) {
delete m_instance;
m_instance = 0;
}
}
RssDownloadRule RssDownloadRuleList::findMatchingRule(const QString &feed_url, const QString &article_title) const

View File

@@ -55,15 +55,14 @@ RssFeed::RssFeed(RssFolder* parent, const QString &url): m_parent(parent), m_ico
}
RssFeed::~RssFeed(){
// Saving current articles to hard disk
if(m_refreshed) {
saveItemsToDisk();
}
if(!m_icon.startsWith(":/") && QFile::exists(m_icon))
misc::safeRemove(m_icon);
}
void RssFeed::saveItemsToDisk() {
qDebug() << Q_FUNC_INFO << m_url;
if (!m_refreshed)
return;
QIniSettings qBTRSS("qBittorrent", "qBittorrent-rss");
QVariantList old_items;
foreach(const RssArticle &item, m_articles.values()) {
@@ -105,6 +104,7 @@ void RssFeed::refresh() {
}
void RssFeed::removeAllSettings() {
qDebug() << "Removing all settings / history for feed: " << m_url;
QIniSettings qBTRSS("qBittorrent", "qBittorrent-rss");
QHash<QString, QVariant> feeds_w_downloader = qBTRSS.value("downloader_on", QHash<QString, QVariant>()).toHash();
if (feeds_w_downloader.contains(m_url)) {
@@ -283,13 +283,13 @@ bool RssFeed::parseRSS(QIODevice* device) {
}
}
// Make sure we limit the number of articles
resizeList();
// RSS Feed Downloader
if(RssSettings().isRssDownloadingEnabled())
downloadMatchingArticleTorrents();
// Make sure we limit the number of articles
resizeList();
// Save items to disk (for safety)
saveItemsToDisk();

View File

@@ -48,7 +48,8 @@ public:
FileType type() const;
void refresh();
QString id() const { return m_url; }
void removeAllSettings();
virtual void removeAllSettings();
virtual void saveItemsToDisk();
bool itemAlreadyExists(const QString &hash) const;
void setLoading(bool val);
bool isLoading() const;
@@ -77,7 +78,6 @@ private:
bool parseXmlFile(const QString &file_path);
void downloadMatchingArticleTorrents();
QString iconUrl() const;
void saveItemsToDisk();
void loadItemsFromDisk();
private:

View File

@@ -54,6 +54,7 @@ public:
virtual void setParent(RssFolder* parent) = 0;
virtual void refresh() = 0;
virtual void removeAllSettings() = 0;
virtual void saveItemsToDisk() = 0;
virtual const QList<RssArticle> articleList() const = 0;
virtual const QList<RssArticle> unreadArticleList() const = 0;
QStringList pathHierarchy() const;

View File

@@ -196,6 +196,13 @@ void RssFolder::removeAllSettings() {
}
}
void RssFolder::saveItemsToDisk()
{
foreach(IRssFile* child, m_children.values()) {
child->saveItemsToDisk();
}
}
QString RssFolder::id() const {
return m_name;
}

View File

@@ -59,7 +59,8 @@ public:
bool hasChild(const QString &childId);
const QList<RssArticle> articleList() const;
const QList<RssArticle> unreadArticleList() const;
void removeAllSettings();
virtual void removeAllSettings();
virtual void saveItemsToDisk();
void removeAllItems();
void renameChildFolder(const QString &old_name, const QString &new_name);
IRssFile *takeChild(const QString &childId);

View File

@@ -51,6 +51,7 @@ RssManager::~RssManager(){
m_refreshTimer.stop();
delete m_rssDownloader;
RssDownloadRuleList::drop();
saveItemsToDisk();
saveStreamList();
qDebug("RSSManager deleted");
}

View File

@@ -1,5 +1,5 @@
PROJECT_NAME = qbittorrent
PROJECT_VERSION = 2.9.4
PROJECT_VERSION = 2.9.5
os2 {
DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\'
@@ -9,4 +9,4 @@ os2 {
DEFINES += VERSION_MAJOR=2
DEFINES += VERSION_MINOR=9
DEFINES += VERSION_BUGFIX=4
DEFINES += VERSION_BUGFIX=5