rev 11370 - in kde-extras/ktorrent/trunk/debian: . patches patches/libbtcore
Modestas Vainius
modax-guest at alioth.debian.org
Mon Jul 7 12:03:43 UTC 2008
Author: modax-guest
Date: 2008-07-07 12:03:43 +0000 (Mon, 07 Jul 2008)
New Revision: 11370
Added:
kde-extras/ktorrent/trunk/debian/patches/00_r828279_branch_pull.diff
Removed:
kde-extras/ktorrent/trunk/debian/patches/01_support_external_libbtcore.diff
kde-extras/ktorrent/trunk/debian/patches/02_no_dht_without_dht_headers.diff
kde-extras/ktorrent/trunk/debian/patches/libbtcore/01_libbtcore_export.diff
Modified:
kde-extras/ktorrent/trunk/debian/NEWS
kde-extras/ktorrent/trunk/debian/README.Debian
kde-extras/ktorrent/trunk/debian/changelog
kde-extras/ktorrent/trunk/debian/control
kde-extras/ktorrent/trunk/debian/patches/97_fix_target_link_libraries.diff
kde-extras/ktorrent/trunk/debian/patches/libbtcore/97_fix_link_interface_libraries.diff
kde-extras/ktorrent/trunk/debian/patches/libbtcore/99_libbtcore_scramble_soname.diff
kde-extras/ktorrent/trunk/debian/patches/series
kde-extras/ktorrent/trunk/debian/rules
Log:
Candidate for 3.1+dfsg.2-1 upload
Modified: kde-extras/ktorrent/trunk/debian/NEWS
===================================================================
--- kde-extras/ktorrent/trunk/debian/NEWS 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/NEWS 2008-07-07 12:03:43 UTC (rev 11370)
@@ -1,3 +1,26 @@
+ktorrent (3.1+dfsg.2-1) unstable; urgency=low
+
+ * Since there have been two stable KTorrent 3.x (for KDE4) releases by the
+ time of writing and KTorrent 2.2.x (for KDE3) has not been updated much in
+ the meantime, I decided to ship both versions in Debian Lenny choosing
+ KTorrent 3.x as default. Therefore:
+ - you can get the old KTorrent 2.2.x release by installing ktorrent2.2
+ package if you don't want to install KDE4 runtime dependencies or new
+ features are not important for you;
+ - since ktorrent binary package provides KDE4 based release from now on,
+ it will pull in KDE4 runtime dependencies. However, it is a newer
+ KTorrent upstream release and has more features. It should work fine
+ with KDE3 desktop environment;
+ - you cannot co-install both ktorrent2.2 and ktorrent. They conflict with
+ each other and you can have only one of them on the system at the same
+ time.
+ - KTorrent 3.1 supports migration of torrents from KTorrent 2.2 but not
+ vice-versa. Therefore, if you start downloading/uploading torrents with
+ KTorrent 3.1, you will probably not be able to resume them with
+ KTorrent 2.2 if you downgrade.
+
+ -- Modestas Vainius <modestas at vainius.eu> Mon, 30 Jun 2008 22:46:56 +0300
+
ktorrent (2.1.4.dfsg.1-1) unstable; urgency=low
* Now KTorrent uses system-wide GeoIP library (libgeoip1) and its default
Modified: kde-extras/ktorrent/trunk/debian/README.Debian
===================================================================
--- kde-extras/ktorrent/trunk/debian/README.Debian 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/README.Debian 2008-07-07 12:03:43 UTC (rev 11370)
@@ -1,3 +1,29 @@
+--- KTorrent 2.2.x (KDE3) and KTorrent 3.x (KDE4) in Debian 5.0 (Lenny) ---
+
+Since there have been two stable KTorrent 3.x (for KDE4) releases by the time
+of writing and KTorrent 2.2.x (for KDE3) has not been updated much in the
+meantime, I decided to ship both versions in Debian 5.0 (Lenny) choosing
+KTorrent 3.x as default. As a result of this decision:
+
+* You can get the old KTorrent 2.2.x release by installing ktorrent2.2 package if
+ you don't want to install KDE4 runtime dependencies or new features are not
+ important for you.
+
+* Since ktorrent binary package provides KDE4 based release from now on,
+ it will pull in KDE4 runtime dependencies. However, it is a newer KTorrent
+ upstream release and has more features. It should work fine with KDE3 desktop
+ environment.
+
+* You cannot co-install both ktorrent2.2 and ktorrent. They conflict with
+ each other and you can have only one of them on the system at the same time.
+
+* KTorrent 3.1 supports migration of torrents from KTorrent 2.2 but not
+ vice-versa. Therefore, if you start downloading/uploading torrents with
+ KTorrent 3.1, you will probably not be able to resume them with KTorrent 2.2
+ if you downgrade.
+
+--- GeoIP and builtin contry flags licensing issues ---
+
Due to licensing restrictions, the source and binary packages of ktorrent do
not include a GeoIP database. The upstream source has been patched to use
system-wide GeoIP library (available in the libgeoip1 package). That package
@@ -23,6 +49,3 @@
The commands used to modify upstream source tarball can be found at debian/rules
"prune-tarball" target.
-
- -- Modestas Vainius <modestas at vainius.eu> Mon, 23 Jul 2007 21:25:17 +0300
-
Modified: kde-extras/ktorrent/trunk/debian/changelog
===================================================================
--- kde-extras/ktorrent/trunk/debian/changelog 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/changelog 2008-07-07 12:03:43 UTC (rev 11370)
@@ -1,3 +1,31 @@
+ktorrent (3.1+dfsg.2-1) unstable; urgency=low
+
+ * Repack upstream tarball. Leave cmake/ dir alone, just prune non-free
+ stuff.
+ * Pull changes from ktorent 3.1 upstream branch up to revision 828279
+ (debian/patches/00_r828279_branch_pull.diff).
+ * Remove the following patches because I'm not going to split off libbtcore
+ for lenny:
+ - libbtcore/01_libbtcore_export.diff
+ - 01_support_external_libbtcore.diff
+ - 02_no_dht_without_dht_headers.diff
+ * Upload to unstable. Now this source package ships KDE4 based version.
+ ktorrent 3 series already had 2 major stable releases and it has many
+ improvements. However, old KDE3 based KTorrent has been kept in
+ ktorrent2.2 source package for the Lenny release. If you wish to use
+ ktorrent 2.2.x (KDE3 based version), just install ktorrent2.2 package. In
+ addition, the following changes related to this move have been made in
+ this package:
+ - Add NEWS entry.
+ - Explain KTorrent 2.2.x vs. KTorrent 3.x situation in README.Debian.
+ * Bump kdelibs5-dev build-depend to the version in unstable.
+ * Drop libphonon-dev build-depend. It is pulled by kdelibs5-dev.
+ * Update URIs in Vcs fields.
+ * Set THIS_SHOULD_GO_TO_UNSTABLE=1 in debian/rules. I want this to be
+ unstable upload.
+
+ -- Modestas Vainius <modestas at vainius.eu> Mon, 07 Jul 2008 15:00:35 +0300
+
ktorrent (3.1+dfsg.1-1) experimental; urgency=low
* New upstream release.
Modified: kde-extras/ktorrent/trunk/debian/control
===================================================================
--- kde-extras/ktorrent/trunk/debian/control 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/control 2008-07-07 12:03:43 UTC (rev 11370)
@@ -5,12 +5,12 @@
Uploaders: Modestas Vainius <modestas at vainius.eu>
DM-Upload-Allowed: yes
Build-Depends: cmake, debhelper (>= 6.0.0), cdbs (>= 0.4.51), quilt,
- kdelibs5-dev (>= 4:4.0.72), libphonon-dev (>= 4:4.0.72), libstreamanalyzer-dev, pkg-config, libgeoip-dev,
+ kdelibs5-dev (>= 4:4.0.84+svn828328), libstreamanalyzer-dev, pkg-config, libgeoip-dev,
libgmp3-dev, libqca2-dev
Standards-Version: 3.7.3.0
Homepage: http://ktorrent.org/
-Vcs-Svn: svn://svn.debian.org/svn/pkg-kde/kde-extras/ktorrent/branches/experimental/
-Vcs-Browser: http://svn.debian.org/wsvn/pkg-kde/kde-extras/ktorrent/branches/experimental/
+Vcs-Svn: svn://svn.debian.org/svn/pkg-kde/kde-extras/ktorrent/trunk/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-kde/kde-extras/ktorrent/trunk/
Package: ktorrent
Architecture: any
Added: kde-extras/ktorrent/trunk/debian/patches/00_r828279_branch_pull.diff
===================================================================
--- kde-extras/ktorrent/trunk/debian/patches/00_r828279_branch_pull.diff (rev 0)
+++ kde-extras/ktorrent/trunk/debian/patches/00_r828279_branch_pull.diff 2008-07-07 12:03:43 UTC (rev 11370)
@@ -0,0 +1,766 @@
+--- a/plugins/infowidget/peerviewmodel.cpp
++++ b/plugins/infowidget/peerviewmodel.cpp
+@@ -120,8 +120,16 @@
+ case 0: return stats.ip_address;
+ case 1: return country;
+ case 2: return stats.client;
+- case 3: return KBytesPerSecToString(stats.download_rate / 1024.0);
+- case 4: return KBytesPerSecToString(stats.upload_rate / 1024.0);
++ case 3:
++ if (stats.download_rate >= 103)
++ return KBytesPerSecToString(stats.download_rate / 1024.0);
++ else
++ return QVariant();
++ case 4:
++ if (stats.upload_rate >= 103)
++ return KBytesPerSecToString(stats.upload_rate / 1024.0);
++ else
++ return QVariant();
+ case 5: return stats.choked ? i18nc("Choked", "Yes") : i18nc("Not choked", "No");
+ case 6: return stats.snubbed ? i18nc("Snubbed", "Yes") : i18nc("Not snubbed", "No");
+ case 7: return QString("%1 %").arg(KGlobal::locale()->formatNumber(stats.perc_of_file,2));
+@@ -165,7 +173,7 @@
+ {
+ case 0:
+ if (stats.encrypted)
+- return KIcon("ktencrypted");
++ return KIcon("kt-encrypted");
+ break;
+ case 1: return flag;
+ case 8: return stats.dht_support ? yes : no;
+--- a/plugins/infowidget/fileview.cpp
++++ b/plugins/infowidget/fileview.cpp
+@@ -307,7 +307,7 @@
+ if (!file)
+ {
+ // directory
+- new KRun(KUrl(curr_tc->getDataDir() + model->dirPath(index)), 0, 0, true, true);
++ new KRun(KUrl(curr_tc->getDataDir() + model->dirPath(proxy_model->mapToSource(index))), 0, 0, true, true);
+ }
+ else
+ {
+--- a/libbtcore/diskio/chunkmanager.cpp
++++ b/libbtcore/diskio/chunkmanager.cpp
+@@ -88,6 +88,9 @@
+ recalc_chunks_left = true;
+ corrupted_count = recheck_counter = 0;
+
++ if (tor.isMultiFile())
++ createBorderChunkSet();
++
+ for (Uint32 i = 0;i < tor.getNumFiles();i++)
+ {
+ TorrentFile & tf = tor.getFile(i);
+@@ -109,7 +112,6 @@
+ continue;
+
+ doPreviewPriority(file);
+-
+ }
+ }
+ else if (tor.isMultimedia())
+@@ -834,17 +836,11 @@
+ }
+ else
+ {
+- // Out(SYS_DIO|LOG_DEBUG) << "Excluding chunks " << first << " to " << last << endl;
+- // first and last chunk may be part of multiple files
+- // so we can not just exclude them
+- QList<Uint32> files,last_files;
+-
+- // get list of files where first chunk lies in
+- tor.calcChunkPos(first,files);
+- tor.calcChunkPos(last,last_files);
+ // check for exceptional case which causes very long loops
+- if (first == last && files.count() > 1)
++ if (first == last && !isBorderChunk(first))
+ {
++ resetChunk(first);
++ exclude(first,first);
+ cache->downloadStatusChanged(tf,download);
+ savePriorityInfo();
+ return;
+@@ -856,86 +852,23 @@
+ resetChunk(i);
+
+ // if the first chunk only lies in one file, reset it
+- if (files.count() == 1 && first != 0)
+- {
+- // Out(SYS_DIO|LOG_DEBUG) << "Resetting first " << first << endl;
++ if (!isBorderChunk(first))
+ resetChunk(first);
+- }
+-
+- // if the last chunk only lies in one file reset it
+- if (last != first && last_files.count() == 1)
+- {
+- // Out(SYS_DIO|LOG_DEBUG) << "Resetting last " << last << endl;
+- resetChunk(last);
+- }
+-
+- Priority maxp = ONLY_SEED_PRIORITY;
+- bool reprioritise_border_chunk = false;
+- bool modified = false;
+-
+- // if one file in the list needs to be downloaded,increment first
+- for (QList<Uint32>::iterator i = files.begin();i != files.end();i++)
+- {
+- if (*i == tf->getIndex())
+- continue;
+-
+- const TorrentFile & other = tor.getFile(*i);
+- if (!other.doNotDownload())
+- {
+- if (first != last && !modified)
+- {
+- first++;
+- reprioritise_border_chunk = true;
+- modified = true;
+- }
+-
+- if (other.getPriority() > maxp)
+- maxp = other.getPriority();
+- }
+- }
+-
+- // in case we have incremented first, we better reprioritise the border chunk
+- if (reprioritise_border_chunk)
+- prioritise(first-1,first-1,maxp);
+-
+- maxp = ONLY_SEED_PRIORITY;
+- reprioritise_border_chunk = false;
+- modified = false;
+-
+- // if one file in the list needs to be downloaded,decrement last
+- for (QList<Uint32>::iterator i = last_files.begin();i != last_files.end();i++)
+- {
+- if (*i == tf->getIndex())
+- continue;
+-
+- const TorrentFile & other = tor.getFile(*i);
+- if (!other.doNotDownload())
+- {
+- if (first != last && last > 0 && !modified)
+- {
+- last--;
+- reprioritise_border_chunk = true;
+- modified = true;
+- }
+-
+- if (other.getPriority() > maxp)
+- maxp = other.getPriority();
+- }
+- }
++ else if (!resetBorderChunk(first,tf))
++ // try to reset if it lies in multiple files
++ first++;
+
+- if (reprioritise_border_chunk)
+- prioritise(last+1,last+1,maxp);
+-
+- // last smaller then first is not normal, so just return
+- if (last < first)
++ if (last != first)
+ {
+- cache->downloadStatusChanged(tf,download);
+- savePriorityInfo();
+- return;
++ // if the last chunk only lies in one file reset it
++ if (!isBorderChunk(last))
++ resetChunk(last);
++ else if (!resetBorderChunk(last,tf))
++ last--;
+ }
+-
+- // Out(SYS_DIO|LOG_DEBUG) << "exclude " << first << " to " << last << endl;
+- exclude(first,last);
++
++ if (first <= last)
++ exclude(first,last);
+ }
+ // alert the cache but first put things in critical operation mode
+ cache->downloadStatusChanged(tf,download);
+@@ -947,12 +880,13 @@
+ if (newpriority == EXCLUDED)
+ {
+ downloadStatusChanged(tf, false);
++ // dumpPriority(tf);
+ return;
+ }
++
+ if (oldpriority == EXCLUDED)
+ {
+ downloadStatusChanged(tf, true);
+- return;
+ }
+
+ savePriorityInfo();
+@@ -960,58 +894,102 @@
+ Uint32 first = tf->getFirstChunk();
+ Uint32 last = tf->getLastChunk();
+
+- // first and last chunk may be part of multiple files
+- // so we can not just exclude them
+- QList<Uint32> files;
+-
+- // get list of files where first chunk lies in
+- tor.calcChunkPos(first,files);
+-
+- Chunk* c = chunks[first];
+- // if one file in the list needs to be downloaded,increment first
+- for (QList<Uint32>::iterator i = files.begin();i != files.end();i++)
+- {
+- Priority np = tor.getFile(*i).getPriority();
+- if (np > newpriority && *i != tf->getIndex())
+- {
+- // make sure we don't go past last
+- if (first == last)
+- return;
+-
++ if (first == last)
++ {
++ if (isBorderChunk(first))
++ setBorderChunkPriority(first,newpriority);
++ else
++ prioritise(first,first,newpriority);
++
++ if (newpriority == ONLY_SEED_PRIORITY)
++ excluded(first,last);
++ }
++ else
++ {
++ // if the first one is a border chunk use setBorderChunkPriority and make the range smaller
++ if (isBorderChunk(first))
++ {
++ setBorderChunkPriority(first,newpriority);
+ first++;
+- break;
++ }
++
++ // if the last one is a border chunk use setBorderChunkPriority and make the range smaller
++ if (isBorderChunk(last))
++ {
++ setBorderChunkPriority(last,newpriority);
++ last--;
++ }
++
++ // if we still have a valid range, prioritise it
++ if (first <= last)
++ {
++ prioritise(first,last,newpriority);
++ if (newpriority == ONLY_SEED_PRIORITY)
++ excluded(first,last);
+ }
+ }
+
+- files.clear();
+- // get list of files where last chunk lies in
+- tor.calcChunkPos(last,files);
+- c = chunks[last];
+- // if one file in the list needs to be downloaded,decrement last
+- for (QList<Uint32>::iterator i = files.begin();i != files.end();i++)
++ //dumpPriority(tf);
++ }
++
++ bool ChunkManager::isBorderChunk(Uint32 idx) const
++ {
++ return border_chunks.contains(idx);
++ }
++
++ void ChunkManager::setBorderChunkPriority(Uint32 idx,Priority prio)
++ {
++ QList<Uint32> files;
++
++ Priority highest = prio;
++ // get list of files where first chunk lies in
++ tor.calcChunkPos(idx,files);
++ foreach (Uint32 file,files)
+ {
+- Priority np = tor.getFile(*i).getPriority();
+- if (np > newpriority && *i != tf->getIndex())
++ Priority np = tor.getFile(file).getPriority();
++ if (np > highest)
++ highest = np;
++ }
++ prioritise(idx,idx,highest);
++ if (highest == ONLY_SEED_PRIORITY)
++ excluded(idx,idx);
++ }
++
++ bool ChunkManager::resetBorderChunk(Uint32 idx,TorrentFile* tf)
++ {
++ QList<Uint32> files;
++ tor.calcChunkPos(idx,files);
++ foreach (Uint32 file,files)
++ {
++ const TorrentFile & other = tor.getFile(file);
++ if (file == tf->getIndex())
++ continue;
++
++ // This file needs to be downloaded, so we can't reset the chunk
++ if (!other.doNotDownload())
+ {
+- // make sure we don't wrap around
+- if (last == 0 || last == first)
+- return;
+-
+- last--;
+- break;
++ // Priority might need to be modified, so set it's priority
++ // to the maximum of all the files who still need it
++ setBorderChunkPriority(idx,other.getPriority());
++ return false;
+ }
+ }
+
+- // last smaller then first is not normal, so just return
+- if (last < first)
++ // we can reset safely
++ resetChunk(idx);
++ return true;
++ }
++
++ void ChunkManager::createBorderChunkSet()
++ {
++ // figure out border chunks
++ for (Uint32 i = 0;i < tor.getNumFiles() - 1;i++)
+ {
+- return;
++ TorrentFile & a = tor.getFile(i);
++ TorrentFile & b = tor.getFile(i+1);
++ if (a.getLastChunk() == b.getFirstChunk())
++ border_chunks.insert(a.getLastChunk());
+ }
+-
+-
+- prioritise(first,last,newpriority);
+- if (newpriority == ONLY_SEED_PRIORITY)
+- excluded(first,last);
+ }
+
+ bool ChunkManager::prepareChunk(Chunk* c,bool always)
+@@ -1300,6 +1278,28 @@
+ preview_size_audio = audio;
+ preview_size_video = video;
+ }
++
++ void ChunkManager::dumpPriority(TorrentFile* tf)
++ {
++ Uint32 first = tf->getFirstChunk();
++ Uint32 last = tf->getLastChunk();
++ Out(SYS_DIO|LOG_DEBUG) << "DumpPriority : " << tf->getPath() << " " << first << " " << last << endl;
++ for (Uint32 i = first;i <= last;i++)
++ {
++ QString prio;
++ switch (chunks[i]->getPriority())
++ {
++ case FIRST_PRIORITY: prio = "First"; break;
++ case LAST_PRIORITY: prio = "Last"; break;
++ case ONLY_SEED_PRIORITY: prio = "Only Seed"; break;
++ case EXCLUDED: prio = "Excluded"; break;
++ case PREVIEW_PRIORITY: prio = "Preview"; break;
++ default: prio = "Normal"; break;
++
++ }
++ Out(SYS_DIO|LOG_DEBUG) << i << " prio " << prio << endl;
++ }
++ }
+ }
+
+ #include "chunkmanager.moc"
+--- a/libbtcore/diskio/chunkmanager.h
++++ b/libbtcore/diskio/chunkmanager.h
+@@ -20,9 +20,10 @@
+ #ifndef BTCHUNKMANAGER_H
+ #define BTCHUNKMANAGER_H
+
+-#include <qmap.h>
+-#include <qstring.h>
+-#include <qobject.h>
++#include <QMap>
++#include <QSet>
++#include <QString>
++#include <QObject>
+ #include <vector>
+ #include <util/bitset.h>
+ #include <btcore_export.h>
+@@ -74,6 +75,7 @@
+ Uint32 corrupted_count;
+ Uint32 recheck_counter;
+ bool during_load;
++ QSet<Uint32> border_chunks;
+ public:
+ ChunkManager(Torrent & tor,
+ const QString & tmpdir,
+@@ -382,6 +384,11 @@
+ void loadPriorityInfo();
+ void doPreviewPriority(TorrentFile & tf);
+ bool allFilesExistOfChunk(Uint32 idx);
++ bool isBorderChunk(Uint32 idx) const;
++ void setBorderChunkPriority(Uint32 idx,Priority prio);
++ bool resetBorderChunk(Uint32 idx,TorrentFile* tf);
++ void createBorderChunkSet();
++ void dumpPriority(TorrentFile* tf);
+
+ private slots:
+ void downloadStatusChanged(TorrentFile* tf,bool download);
+--- a/libbtcore/download/webseed.cpp
++++ b/libbtcore/download/webseed.cpp
+@@ -248,6 +248,8 @@
+ num_failures++;
+ if (num_failures < 3) // try again in 10 seconds
+ QTimer::singleShot(10*1000,this,SLOT(retry()));
++ else // try again but with a longer interval (2 minutes)
++ QTimer::singleShot(120*1000,this,SLOT(retry()));
+
+ return 0;
+ }
+@@ -366,7 +368,7 @@
+
+ void WebSeed::onExcluded(Uint32 from,Uint32 to)
+ {
+- if (from <= first_chunk <= to && from <= last_chunk <= to)
++ if (from <= first_chunk && first_chunk <= to && from <= last_chunk && last_chunk <= to)
+ reset();
+ }
+ }
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,18 @@
++Changes in 3.1.1 :
++- Fix wrong icon name in PeerView for encrypted peers
++- If speed is very low, don't show speed in PeerView
++- Fix crash when double clicking on directories in fileview (164434)
++- Added GroupFilterModel to filter out torrents, this avoids a bug in Qt which
++caused hidden torrents to be shown when a view was sorted by a column.
++(164113)
++- Make sure port is 80 if it is not specified in device url in upnp library
++- Fix Preview in right click menu of View (164503)
++- Fix bug in network preferences causing the chosen network interface not to
++be selected
++- Fix border chunk priority being set wrongly in some rare cases (165587)
++- Don't stop connecting with webseed after 3 failed attempts but keep going on
++with a longer interval (2 minutes)
++
+ Changes in 3.1 :
+ - Use KIO::storedGet to download XML description of UPnP router
+ - Use KIO::mkdir in MakeDir function
+--- a/ktorrent/networkpref.cpp
++++ b/ktorrent/networkpref.cpp
+@@ -75,6 +75,8 @@
+
+ kcfg_networkInterface->addItem(icon,iface.name());
+ }
++
++ kcfg_networkInterface->setCurrentIndex(Settings::networkInterface());
+ }
+
+ void NetworkPref::loadDefaults()
+--- /dev/null
++++ b/ktorrent/groupfiltermodel.cpp
+@@ -0,0 +1,66 @@
++/***************************************************************************
++ * Copyright (C) 2008 by Joris Guisson and Ivan Vasic *
++ * joris.guisson at gmail.com *
++ * ivasic at gmail.com *
++ * *
++ * This program is free software; you can redistribute it and/or modify *
++ * it under the terms of the GNU General Public License as published by *
++ * the Free Software Foundation; either version 2 of the License, or *
++ * (at your option) any later version. *
++ * *
++ * This program is distributed in the hope that it will be useful, *
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
++ * GNU General Public License for more details. *
++ * *
++ * You should have received a copy of the GNU General Public License *
++ * along with this program; if not, write to the *
++ * Free Software Foundation, Inc., *
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
++ ***************************************************************************/
++#include <groups/group.h>
++#include "groupfiltermodel.h"
++#include "viewmodel.h"
++
++namespace kt
++{
++
++ GroupFilterModel::GroupFilterModel(ViewModel* view_model,QObject* parent)
++ : QSortFilterProxyModel(parent),group(0),view_model(view_model)
++ {
++ setSourceModel(view_model);
++ }
++
++
++ GroupFilterModel::~GroupFilterModel()
++ {
++ }
++
++ void GroupFilterModel::setGroup(Group* g)
++ {
++ group = g;
++ invalidateFilter();
++ }
++
++ void GroupFilterModel::refilter()
++ {
++ invalidateFilter();
++ }
++
++ bool GroupFilterModel::filterAcceptsColumn(int source_column,const QModelIndex & source_parent) const
++ {
++ Q_UNUSED(source_column);
++ Q_UNUSED(source_parent);
++ return true;
++ }
++
++ bool GroupFilterModel::filterAcceptsRow(int source_row,const QModelIndex & source_parent) const
++ {
++ Q_UNUSED(source_parent);
++ if (!group)
++ return true;
++ else
++ return group->isMember(view_model->torrentFromRow(source_row));
++ }
++
++}
+--- a/ktorrent/view.cpp
++++ b/ktorrent/view.cpp
+@@ -40,6 +40,7 @@
+ #include "scandlg.h"
+ #include "speedlimitsdlg.h"
+ #include "addpeersdlg.h"
++#include "groupfiltermodel.h"
+
+ using namespace bt;
+
+@@ -83,8 +84,7 @@
+
+ connect(header_menu,SIGNAL(triggered(QAction* )),this,SLOT(onHeaderMenuItemTriggered(QAction*)));
+
+- proxy_model = new QSortFilterProxyModel(this);
+- proxy_model->setSourceModel(model);
++ proxy_model = new GroupFilterModel(model,this);
+ proxy_model->setSortRole(Qt::UserRole);
+ setModel(proxy_model);
+ //setModel(model);
+@@ -101,6 +101,7 @@
+ void View::setGroup(Group* g)
+ {
+ group = g;
++ proxy_model->setGroup(group);
+ update();
+ selectionModel()->clear();
+ }
+@@ -109,29 +110,17 @@
+ {
+ Uint32 torrents = 0;
+ Uint32 running = 0;
+- Uint32 idx = 0;
+ QList<bt::TorrentInterface*> all;
+ model->allTorrents(all);
+
+- // update items which are part of the current group
+- // if they are not part of the current group, just hide them
+ foreach (bt::TorrentInterface* ti,all)
+ {
+- QModelIndex midx = model->index(idx,0,QModelIndex());
+- midx = proxy_model->mapFromSource(midx);
+ if (!group || (group && group->isMember(ti)))
+ {
+- if (isRowHidden(midx.row(),QModelIndex()))
+- setRowHidden(midx.row(),QModelIndex(),false);
+-
+ torrents++;
+ if (ti->getStats().running)
+ running++;
+ }
+- else if (!isRowHidden(midx.row(),QModelIndex()))
+- setRowHidden(midx.row(),QModelIndex(),true);
+-
+- idx++;
+ }
+
+ int nflags = flags & (kt::START | kt::STOP | kt::REMOVE);
+@@ -157,6 +146,7 @@
+ {
+ num_running = running;
+ num_torrents = torrents;
++ proxy_model->refilter();
+ return true;
+ }
+
+@@ -183,6 +173,7 @@
+ {
+ num_running = running;
+ num_torrents = torrents;
++ proxy_model->refilter();
+ return true;
+ }
+
+@@ -331,8 +322,7 @@
+ {
+ if (tc->readyForPreview() && !tc->getStats().multi_file_torrent)
+ {
+- QFileInfo fi(tc->getTorDir()+"cache");
+- new KRun(KUrl(fi.symLinkTarget()), 0, 0, true, true);
++ new KRun(KUrl(tc->getStats().output_path), 0, 0, true, true);
+ }
+ }
+ }
+--- a/ktorrent/CMakeLists.txt
++++ b/ktorrent/CMakeLists.txt
+@@ -10,6 +10,7 @@
+ view.cpp
+ viewmodel.cpp
+ viewmanager.cpp
++ groupfiltermodel.cpp
+ prefdialog.cpp
+ advancedpref.cpp
+ networkpref.cpp
+--- a/ktorrent/viewmodel.h
++++ b/ktorrent/viewmodel.h
+@@ -89,6 +89,13 @@
+ bt::TorrentInterface* torrentFromIndex(const QModelIndex & index);
+
+ /**
++ * Get a torrent from a row.
++ * @param index The row index
++ * @return The torrent if the index is valid and in the proper range, 0 otherwise
++ */
++ bt::TorrentInterface* torrentFromRow(int index);
++
++ /**
+ * Get all torrents
+ * @param tlist The list of torrents to fill
+ */
+--- a/ktorrent/view.h
++++ b/ktorrent/view.h
+@@ -28,7 +28,6 @@
+ #include <ksharedconfig.h>
+
+ class KMenu;
+-class QSortFilterProxyModel;
+
+ namespace kt
+ {
+@@ -37,7 +36,7 @@
+ class ViewModel;
+ class Group;
+ class TorrentInterface;
+-
++ class GroupFilterModel;
+
+
+ class View : public QTreeView
+@@ -138,7 +137,7 @@
+ bt::Uint32 num_torrents;
+ bt::Uint32 num_running;
+ ViewModel* model;
+- QSortFilterProxyModel* proxy_model;
++ GroupFilterModel* proxy_model;
+ int flags;
+ };
+ }
+--- /dev/null
++++ b/ktorrent/groupfiltermodel.h
+@@ -0,0 +1,62 @@
++/***************************************************************************
++ * Copyright (C) 2008 by Joris Guisson and Ivan Vasic *
++ * joris.guisson at gmail.com *
++ * ivasic at gmail.com *
++ * *
++ * This program is free software; you can redistribute it and/or modify *
++ * it under the terms of the GNU General Public License as published by *
++ * the Free Software Foundation; either version 2 of the License, or *
++ * (at your option) any later version. *
++ * *
++ * This program is distributed in the hope that it will be useful, *
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
++ * GNU General Public License for more details. *
++ * *
++ * You should have received a copy of the GNU General Public License *
++ * along with this program; if not, write to the *
++ * Free Software Foundation, Inc., *
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
++ ***************************************************************************/
++#ifndef KTGROUPFILTERMODEL_H
++#define KTGROUPFILTERMODEL_H
++
++#include <QSortFilterProxyModel>
++
++namespace kt
++{
++ class Group;
++ class ViewModel;
++
++ /**
++ Model to filter out torrents based upon group membership
++ */
++ class GroupFilterModel : public QSortFilterProxyModel
++ {
++ Q_OBJECT
++ public:
++ GroupFilterModel(ViewModel* view_model,QObject* parent);
++ virtual ~GroupFilterModel();
++
++ virtual bool filterAcceptsColumn(int source_column,const QModelIndex & source_parent) const;
++ virtual bool filterAcceptsRow(int source_row,const QModelIndex & source_parent) const;
++
++ /**
++ * Set the group to filter
++ * @param g The Group
++ * */
++ void setGroup(Group* g);
++
++ /**
++ * Filter again.
++ */
++ void refilter();
++
++ private:
++ Group* group;
++ ViewModel* view_model;
++ };
++
++}
++
++#endif
+--- a/ktorrent/viewmodel.cpp
++++ b/ktorrent/viewmodel.cpp
+@@ -462,6 +462,14 @@
+ return 0;
+ }
+
++ bt::TorrentInterface* ViewModel::torrentFromRow(int index)
++ {
++ if (index < torrents.count() && index >= 0)
++ return torrents[index].tc;
++ else
++ return 0;
++ }
++
+ void ViewModel::allTorrents(QList<bt::TorrentInterface*> & tlist) const
+ {
+ for (QList<Item>::const_iterator i = torrents.begin();i != torrents.end();i++)
+--- a/libktupnp/upnprouter.cpp
++++ b/libktupnp/upnprouter.cpp
+@@ -334,7 +334,7 @@
+ {
+ // if port is not set, 0 will be returned
+ // thanks to Diego R. Brogna for spotting this bug
+- if (location.port()==0)
++ if (location.port()<=0)
+ location.setPort(80);
+
+ QString http_hdr = QString(
+@@ -345,7 +345,6 @@
+ "SOAPAction: \"%4\"\r\n"
+ "\r\n").arg(controlurl).arg(location.host()).arg(location.port()).arg(soapact);
+
+-
+ HTTPRequest* r = new HTTPRequest(http_hdr,query,location.host(),location.port(),verbose);
+ connect(r,SIGNAL(replyError(HTTPRequest* ,const QString& )),
+ this,SLOT(onReplyError(HTTPRequest* ,const QString& )));
Deleted: kde-extras/ktorrent/trunk/debian/patches/01_support_external_libbtcore.diff
Deleted: kde-extras/ktorrent/trunk/debian/patches/02_no_dht_without_dht_headers.diff
Modified: kde-extras/ktorrent/trunk/debian/patches/97_fix_target_link_libraries.diff
===================================================================
--- kde-extras/ktorrent/trunk/debian/patches/97_fix_target_link_libraries.diff 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/patches/97_fix_target_link_libraries.diff 2008-07-07 12:03:43 UTC (rev 11370)
@@ -4,8 +4,8 @@
kde4_add_kcfg_files(libktorrent_SRC settings.kcfgc)
kde4_add_library(ktcore SHARED ${libktorrent_SRC})
--target_link_libraries(ktcore ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KUTILS_LIBS} ${BTCORE_LIBRARIES} ${KDE4_SOLID_LIBS} ${GMP_LIBRARIES})
-+target_link_libraries(ktcore ${BTCORE_LIBRARIES} ${KDE4_KPARTS_LIBS} ${KDE4_KUTILS_LIBS} ${QT_QTNETWORK_LIBRARY})
+-target_link_libraries(ktcore ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KUTILS_LIBS} btcore ${KDE4_SOLID_LIBS} ${GMP_LIBRARIES})
++target_link_libraries(ktcore btcore ${KDE4_KPARTS_LIBS} ${KDE4_KUTILS_LIBS} ${QT_QTNETWORK_LIBRARY})
set_target_properties(ktcore PROPERTIES VERSION 6.0.0 SOVERSION 6 )
install(TARGETS ktcore ${INSTALL_TARGETS_DEFAULT_ARGS} )
Deleted: kde-extras/ktorrent/trunk/debian/patches/libbtcore/01_libbtcore_export.diff
Modified: kde-extras/ktorrent/trunk/debian/patches/libbtcore/97_fix_link_interface_libraries.diff
===================================================================
--- kde-extras/ktorrent/trunk/debian/patches/libbtcore/97_fix_link_interface_libraries.diff 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/patches/libbtcore/97_fix_link_interface_libraries.diff 2008-07-07 12:03:43 UTC (rev 11370)
@@ -1,6 +1,6 @@
--- libbtcore/CMakeLists.txt
+++ libbtcore/CMakeLists.txt
-@@ -214,7 +214,7 @@
+@@ -181,7 +181,7 @@
kde4_add_library(btcore SHARED ${libbtcore_SRC})
Modified: kde-extras/ktorrent/trunk/debian/patches/libbtcore/99_libbtcore_scramble_soname.diff
===================================================================
--- kde-extras/ktorrent/trunk/debian/patches/libbtcore/99_libbtcore_scramble_soname.diff 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/patches/libbtcore/99_libbtcore_scramble_soname.diff 2008-07-07 12:03:43 UTC (rev 11370)
@@ -1,6 +1,6 @@
--- libbtcore/CMakeLists.txt
+++ libbtcore/CMakeLists.txt
-@@ -218,7 +218,7 @@
+@@ -185,7 +185,7 @@
if(WIN32)
target_link_libraries(btcore ws2_32)
endif(WIN32)
Modified: kde-extras/ktorrent/trunk/debian/patches/series
===================================================================
--- kde-extras/ktorrent/trunk/debian/patches/series 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/patches/series 2008-07-07 12:03:43 UTC (rev 11370)
@@ -1,6 +1,4 @@
-01_support_external_libbtcore.diff
-02_no_dht_without_dht_headers.diff
+00_r828279_branch_pull.diff
97_fix_target_link_libraries.diff
-libbtcore/01_libbtcore_export.diff -p0
libbtcore/97_fix_link_interface_libraries.diff -p0
libbtcore/99_libbtcore_scramble_soname.diff -p0
Modified: kde-extras/ktorrent/trunk/debian/rules
===================================================================
--- kde-extras/ktorrent/trunk/debian/rules 2008-07-07 10:49:08 UTC (rev 11369)
+++ kde-extras/ktorrent/trunk/debian/rules 2008-07-07 12:03:43 UTC (rev 11370)
@@ -1,5 +1,7 @@
#!/usr/bin/make -f
+THIS_SHOULD_GO_TO_UNSTABLE=1
+
include debian/cdbs/kde.mk
DEB_CMAKE_EXTRA_FLAGS += -DWITH_SYSTEM_GEOIP:BOOL=ON \
More information about the pkg-kde-commits
mailing list