Bug 146104 - upload tab table should not have 'download speed' etc
Summary: upload tab table should not have 'download speed' etc
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-29 10:47 UTC by Egon Willighagen
Modified: 2007-05-30 19:16 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Egon Willighagen 2007-05-29 10:47:24 UTC
Version:           2.2beta1 (using KDE KDE 3.5.6)
Installed from:    Ubuntu Packages
OS:                Linux

The upload tab's table of torrents has in my default install the columns 'Downloaded' 'Down Speed' and 'Time Left' which only make sense in the download tab. I think they should be removed.
Comment 1 Joris Guisson 2007-05-30 19:15:57 UTC
SVN commit 669873 by guisson:

Hide several columns by default when an upload view is opened (Download speed, Downloaded, Time Left and Percentage)

BUG: 146104



 M  +1 -1      apps/ktorrent/groups/activedownloadsgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/activegroup.cpp  
 M  +1 -1      apps/ktorrent/groups/activeuploadsgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/allgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/downloadgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/group.cpp  
 M  +14 -3     apps/ktorrent/groups/group.h  
 M  +1 -1      apps/ktorrent/groups/inactivedownloadsgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/inactivegroup.cpp  
 M  +1 -1      apps/ktorrent/groups/inactiveuploadsgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/queueddownloadsgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/queueduploadsgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/torrentgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/uploadgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/userdownloadsgroup.cpp  
 M  +1 -1      apps/ktorrent/groups/useruploadsgroup.cpp  
 M  +2 -0      apps/ktorrent/ktorrent.cpp  
 M  +20 -0     apps/ktorrent/ktorrentview.cpp  
 M  +6 -0      apps/ktorrent/ktorrentview.h  
 M  +8 -8      ktorrent.kdevelop  


--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/activedownloadsgroup.cpp #669872:669873
@@ -25,7 +25,7 @@
 namespace kt
 {
 	ActiveDownloadsGroup::ActiveDownloadsGroup()
-			: Group(i18n("Active downloads"), false)
+			: Group(i18n("Active downloads"),DOWNLOADS_ONLY_GROUP)
 	{
 		setIconByName("down");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/activegroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 	
 ActiveGroup::ActiveGroup()
-		: Group(i18n("Active torrents"),false)
+		: Group(i18n("Active torrents"),MIXED_GROUP)
 {
 	setIconByName("metacontact_online");
 }
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/activeuploadsgroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 
 	ActiveUploadsGroup::ActiveUploadsGroup()
-			: Group(i18n("Active uploads"), false)
+			: Group(i18n("Active uploads"), UPLOADS_ONLY_GROUP)
 	{
 		setIconByName("up");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/allgroup.cpp #669872:669873
@@ -23,7 +23,7 @@
 namespace kt
 {
 
-	AllGroup::AllGroup() : Group(i18n("All Torrents"),false)
+	AllGroup::AllGroup() : Group(i18n("All Torrents"),MIXED_GROUP)
 	{
 		setIconByName("folder");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/downloadgroup.cpp #669872:669873
@@ -24,7 +24,7 @@
 namespace kt
 {
 
-	DownloadGroup::DownloadGroup() : Group(i18n("Downloads"),false)
+	DownloadGroup::DownloadGroup() : Group(i18n("Downloads"),DOWNLOADS_ONLY_GROUP)
 	{
 		setIconByName("down");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/group.cpp #669872:669873
@@ -24,7 +24,7 @@
 namespace kt
 {
 
-	Group::Group(const QString & name,bool custom) : name(name),custom(custom)
+	Group::Group(const QString & name,int flags) : name(name),flags(flags)
 	{}
 
 
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/group.h #669872:669873
@@ -46,18 +46,29 @@
 		QString name;
 		QPixmap icon;
 		QString icon_name;
-		bool custom;
+		int flags;
 	public:
+		enum Properties
+		{
+			UPLOADS_ONLY_GROUP = 1,
+			DOWNLOADS_ONLY_GROUP = 2,
+			MIXED_GROUP = 3,
+			CUSTOM_GROUP = 4,
+		};
 		/**
 		 * Create a new group.
 		 * @param name The name of the group
+		 * @param flags Properties of the group
 		 */
-		Group(const QString & name,bool custom);
+		Group(const QString & name,int flags);
 		virtual ~Group();
 		
 		/// See if this is a standard group.
-		bool isStandardGroup() const {return !custom;}
+		bool isStandardGroup() const {return !(flags & CUSTOM_GROUP);}
 		
+		/// Get the group flags
+		int groupFlags() const {return flags;}
+		
 		/**
 		 * Rename the group.
 		 * @param nn The new name
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/inactivedownloadsgroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 
 	InactiveDownloadsGroup::InactiveDownloadsGroup()
-			: Group(i18n("Inactive downloads"), false)
+			: Group(i18n("Inactive downloads"), DOWNLOADS_ONLY_GROUP)
 	{
 		setIconByName("down");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/inactivegroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 	
 InactiveGroup::InactiveGroup()
-		: Group(i18n("Inactive torrents"),false)
+		: Group(i18n("Inactive torrents"),MIXED_GROUP)
 {
 	setIconByName("metacontact_offline");
 }
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/inactiveuploadsgroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 
 	InactiveUploadsGroup::InactiveUploadsGroup()
-			: Group(i18n("Inactive uploads"), false)
+			: Group(i18n("Inactive uploads"), UPLOADS_ONLY_GROUP)
 	{
 		setIconByName("up");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/queueddownloadsgroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 
 	QueuedDownloadsGroup::QueuedDownloadsGroup()
-			: Group(i18n("Queued downloads"),false)
+			: Group(i18n("Queued downloads"),DOWNLOADS_ONLY_GROUP)
 	{
 		setIconByName("ktqueuemanager");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/queueduploadsgroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 
 	QueuedUploadsGroup::QueuedUploadsGroup()
-			: Group(i18n("Queued uploads"),false)
+			: Group(i18n("Queued uploads"),UPLOADS_ONLY_GROUP)
 	{
 		setIconByName("ktqueuemanager");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/torrentgroup.cpp #669872:669873
@@ -30,7 +30,7 @@
 namespace kt
 {
 
-	TorrentGroup::TorrentGroup(const QString& name): Group(name,true)
+	TorrentGroup::TorrentGroup(const QString& name): Group(name,MIXED_GROUP|CUSTOM_GROUP)
 	{
 		setIconByName("player_playlist");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/uploadgroup.cpp #669872:669873
@@ -24,7 +24,7 @@
 namespace kt
 {
 
-	UploadGroup::UploadGroup() : Group(i18n("Uploads"),false)
+	UploadGroup::UploadGroup() : Group(i18n("Uploads"),UPLOADS_ONLY_GROUP)
 	{
 		setIconByName("up");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/userdownloadsgroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 
 	UserDownloadsGroup::UserDownloadsGroup()
-			: Group(i18n("User downloads"),false)
+			: Group(i18n("User downloads"),DOWNLOADS_ONLY_GROUP)
 	{
 		setIconByName("userconfig");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/groups/useruploadsgroup.cpp #669872:669873
@@ -26,7 +26,7 @@
 {
 
 	UserUploadsGroup::UserUploadsGroup()
-			: Group(i18n("User uploads"),false)
+			: Group(i18n("User uploads"),UPLOADS_ONLY_GROUP)
 	{
 		setIconByName("userconfig");
 	}
--- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrent.cpp #669872:669873
@@ -254,6 +254,8 @@
 	
 	KTorrentView* v = m_view_man->newView();
 	v->setCurrentGroup((Group*)g);
+	v->setupViewColumns();
+	
 	addTabPage(v,g->groupIcon(),v->caption(),m_view_man);
 	
 	connect(v,SIGNAL(currentChanged(kt::TorrentInterface* )),
--- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrentview.cpp #669872:669873
@@ -833,6 +833,26 @@
 	}
 }
 
+void KTorrentView::setupViewColumns()
+{
+	if (current_group->groupFlags() == kt::Group::UPLOADS_ONLY_GROUP)
+	{
+		// we are an uploads group so lets hide, downloaded, percentage, download speed and time left
+		columnHide(2); // Downloaded
+		columnHide(5); // Down speed
+		columnHide(7); // Time left
+		columnHide(10); // Percentage
+	}
+	
+	// make sure menu is OK
+	for(int i=0; i<columns();++i)
+	{
+		bool visible = columnVisible(i);
+		m_headerMenu->setItemChecked(m_headerMenu->idAt(i+1), visible);
+		header()->setResizeEnabled(visible, i);
+	}
+}
 
 
+
 #include "ktorrentview.moc"
--- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrentview.h #669872:669873
@@ -97,6 +97,12 @@
 	 */
 	bool columnVisible(int index);
 	
+	/**
+	 * Setup the view columns, based upon the current group
+	 * This will hide some columns for uploads only groups.
+	 */
+	void setupViewColumns();
+	
 public slots:
 	void setCurrentGroup(kt::Group* group);
 	void addTorrent(kt::TorrentInterface* tc);
--- trunk/extragear/network/ktorrent/ktorrent.kdevelop #669872:669873
@@ -14,11 +14,11 @@
     </keywords>
     <projectdirectory>.</projectdirectory>
     <absoluteprojectpath>false</absoluteprojectpath>
-    <description/>
+    <description></description>
     <ignoreparts/>
     <versioncontrol>kdevsubversion</versioncontrol>
     <projectname>ktorrent</projectname>
-    <defaultencoding/>
+    <defaultencoding></defaultencoding>
   </general>
   <kdevautoproject>
     <general>
@@ -50,7 +50,7 @@
       </cwd>
       <globaldebugarguments>--nofork</globaldebugarguments>
       <globalcwd>/home/joris</globalcwd>
-      <useglobalprogram>true</useglobalprogram>
+      <useglobalprogram>false</useglobalprogram>
       <autoinstall>false</autoinstall>
       <autokdesu>false</autokdesu>
     </run>
@@ -175,14 +175,14 @@
     <general>
       <dbgshell>libtool</dbgshell>
       <programargs>--nofork</programargs>
-      <gdbpath/>
+      <gdbpath></gdbpath>
       <breakonloadinglibs>false</breakonloadinglibs>
       <separatetty>false</separatetty>
       <floatingtoolbar>false</floatingtoolbar>
       <runappinappdirectory>true</runappinappdirectory>
-      <configGdbScript/>
-      <runShellScript/>
-      <runGdbScript/>
+      <configGdbScript></configGdbScript>
+      <runShellScript></runShellScript>
+      <runGdbScript></runGdbScript>
     </general>
     <display>
       <staticmembers>true</staticmembers>
@@ -278,7 +278,7 @@
       <resolveIncludePathsUsingMakeExperimental>false</resolveIncludePathsUsingMakeExperimental>
     </codecompletion>
     <creategettersetter>
-      <prefixGet/>
+      <prefixGet></prefixGet>
       <prefixSet>set</prefixSet>
       <prefixVariable>m_,_</prefixVariable>
       <parameterName>theValue</parameterName>