[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/network/ktorrent
From:       Joris Guisson <joris.guisson () gmail ! com>
Date:       2010-10-16 11:48:48
Message-ID: 20101016114848.80EC6AC896 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1186436 by guisson:

Make ratio configurable at which the share ratio becomes green 

BUG: 254144

 M  +1 -0      ChangeLog  
 M  +39 -7     ktorrent/pref/qmpref.ui  
 M  +4 -3      ktorrent/view/viewmodel.cpp  
 M  +20 -0     libktcore/dbus/dbussettings.cpp  
 M  +4 -0      libktcore/dbus/dbussettings.h  
 M  +4 -0      libktcore/ktorrent.kcfg  
 M  +2 -2      plugins/infowidget/downloadedchunkbar.cpp  
 M  +1 -1      plugins/infowidget/downloadedchunkbar.h  
 M  +2 -1      plugins/infowidget/statustab.cpp  
 M  +1 -1      scripts/kcfg_qobject_gen.py  


--- trunk/extragear/network/ktorrent/ChangeLog #1186435:1186436
@@ -24,6 +24,7 @@
 - Show current upload and download limit in trayicon submenus instead of limits from \
                the settings (251953)
 - Show notifications when automatic update of IP filter fails (243458)
 - Add video streaming support (234212)
+- Make ratio configurable at which the share ratio becomes green (254144)
 
 Changes in 4.0.4:
 - Make sure that syndication filter save location overrides group save location \
                (250116)
--- trunk/extragear/network/ktorrent/ktorrent/pref/qmpref.ui #1186435:1186436
@@ -7,10 +7,10 @@
     <x>0</x>
     <y>0</y>
     <width>635</width>
-    <height>476</height>
+    <height>438</height>
    </rect>
   </property>
-  <layout class="QVBoxLayout">
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
     <widget class="QCheckBox" name="kcfg_manuallyControlTorrents">
      <property name="toolTip">
@@ -193,8 +193,8 @@
      <property name="title">
       <string comment="@title:group Options regarging Seeding">Seeding</string>
      </property>
-     <layout class="QGridLayout">
-      <item row="0" column="0">
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0" colspan="2">
        <widget class="QCheckBox" name="kcfg_keepSeeding">
         <property name="toolTip">
          <string>When a download is finished, continue seeding it. If this is \
disabled, the torrent will be stopped.</string> @@ -211,7 +211,7 @@
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
+      <item row="1" column="2">
        <widget class="KIntSpinBox" name="kcfg_numUploadSlots">
         <property name="toolTip">
          <string>The number of upload slots, this determines the number of peers you \
can upload to simultaneously for one torrent.</string> @@ -234,7 +234,7 @@
         </property>
        </widget>
       </item>
-      <item row="2" column="1">
+      <item row="2" column="2">
        <widget class="QDoubleSpinBox" name="kcfg_maxRatio">
         <property name="toolTip">
          <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; \
&quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; @@ -263,7 +263,7 @@
         </property>
        </widget>
       </item>
-      <item row="3" column="1">
+      <item row="3" column="2">
        <widget class="QDoubleSpinBox" name="kcfg_maxSeedTime">
         <property name="toolTip">
          <string>The maximum seed time in hours. Once you reach this time, the \
torrent will be stopped. This is only applied to newly opened torrents, existing \
torrents will not be affected by changing this.</string> @@ -282,6 +282,38 @@
         </property>
        </widget>
       </item>
+      <item row="4" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="toolTip">
+         <string>Value at which the share ratio will be displayed with a green \
color. Lower ratios will be displayed in red.</string> +        </property>
+        <property name="text">
+         <string>Minimum good share ratio:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="2">
+       <widget class="QDoubleSpinBox" name="kcfg_greenRatio">
+        <property name="toolTip">
+         <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; \
&quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; \
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; \
/&gt;&lt;style type=&quot;text/css&quot;&gt; +p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'OpenSymbol'; \
font-size:8pt; font-weight:400; font-style:normal;&quot;&gt; +&lt;p style=&quot; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; font-size:9pt;&quot;&gt;&lt;span style=&quot; \
font-size:8pt;&quot;&gt;The maximum share ratio, if this value is reached seeding \
will be stopped. This is only applied to newly opened torrents, existing torrents \
will not be affected by changing this.&lt;/span&gt;&lt;/p&gt; +&lt;p \
style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px;&quot;&gt;&lt;/p&gt; +&lt;p style=&quot; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Attention: \
&lt;/span&gt;This is not used when downloading, only when \
seeding.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> +        </property>
+        <property name="specialValueText">
+         <string>No limit</string>
+        </property>
+        <property name="singleStep">
+         <double>0.010000000000000</double>
+        </property>
+        <property name="value">
+         <double>1.500000000000000</double>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
--- trunk/extragear/network/ktorrent/ktorrent/view/viewmodel.cpp #1186435:1186436
@@ -27,16 +27,17 @@
 #include <kglobal.h>
 #include <kicon.h>
 #include <util/log.h>
+#include <util/sha1hash.h>
 #include <util/functions.h>
 #include <interfaces/torrentinterface.h>
+#include <interfaces/trackerinterface.h>
 #include <torrent/queuemanager.h>
 #include <groups/group.h>
 #include "viewmodel.h"
 #include "core.h"
-#include <interfaces/trackerinterface.h>
-#include <util/sha1hash.h>
 #include "viewdelegate.h"
 #include "view.h"
+#include "settings.h"
 
 using namespace bt;
 
@@ -289,7 +290,7 @@
 		else if (col == 11)
 		{
 			QColor green(40,205,40);
-			return share_ratio > 0.8 ? green : Qt::red;
+			return share_ratio >= Settings::greenRatio() ? green : Qt::red;
 		}
 		else
 			return QVariant();
--- trunk/extragear/network/ktorrent/libktcore/dbus/dbussettings.cpp #1186435:1186436
@@ -118,6 +118,16 @@
 		Settings::setMaxRatio(val);
 	}
 
+	double DBusSettings::greenRatio()
+	{
+		return Settings::greenRatio();
+	}
+
+	void DBusSettings::setGreenRatio(double val)
+	{
+		Settings::setGreenRatio(val);
+	}
+
 	int DBusSettings::port()
 	{
 		return Settings::port();
@@ -668,6 +678,16 @@
 		Settings::setOpenMultipleTorrentsSilently(val);
 	}
 
+	bool DBusSettings::openAllTorrentsSilently()
+	{
+		return Settings::openAllTorrentsSilently();
+	}
+
+	void DBusSettings::setOpenAllTorrentsSilently(bool val)
+	{
+		Settings::setOpenAllTorrentsSilently(val);
+	}
+
 	bool DBusSettings::decreasePriorityOfStalledTorrents()
 	{
 		return Settings::decreasePriorityOfStalledTorrents();
--- trunk/extragear/network/ktorrent/libktcore/dbus/dbussettings.h #1186435:1186436
@@ -54,6 +54,8 @@
 		Q_SCRIPTABLE void setMaxDownloadRate(int val);
 		Q_SCRIPTABLE double maxRatio();
 		Q_SCRIPTABLE void setMaxRatio(double val);
+		Q_SCRIPTABLE double greenRatio();
+		Q_SCRIPTABLE void setGreenRatio(double val);
 		Q_SCRIPTABLE int port();
 		Q_SCRIPTABLE void setPort(int val);
 		Q_SCRIPTABLE int udpTrackerPort();
@@ -164,6 +166,8 @@
 		Q_SCRIPTABLE void setNetworkInterface(int val);
 		Q_SCRIPTABLE bool openMultipleTorrentsSilently();
 		Q_SCRIPTABLE void setOpenMultipleTorrentsSilently(bool val);
+		Q_SCRIPTABLE bool openAllTorrentsSilently();
+		Q_SCRIPTABLE void setOpenAllTorrentsSilently(bool val);
 		Q_SCRIPTABLE bool decreasePriorityOfStalledTorrents();
 		Q_SCRIPTABLE void setDecreasePriorityOfStalledTorrents(bool val);
 		Q_SCRIPTABLE int stallTimer();
--- trunk/extragear/network/ktorrent/libktcore/ktorrent.kcfg #1186435:1186436
@@ -46,6 +46,10 @@
 		        <default>0</default>
          		<min>0</min>
       		</entry>
+		<entry name="greenRatio" type="Double">
+			<default>0.8</default>
+			<min>0</min>
+		</entry>
 		<entry name="port" type="Int">
 			<label>Port</label>
 			<default>6881</default>
--- trunk/extragear/network/ktorrent/plugins/infowidget/downloadedchunkbar.cpp \
#1186435:1186436 @@ -58,7 +58,7 @@
 		update();
 	}
 	
-	void DownloadedChunkBar::updateBar()
+	void DownloadedChunkBar::updateBar(bool force)
 	{
 		const BitSet & bs = getBitSet();
 		QSize s = contentsRect().size();
@@ -72,7 +72,7 @@
 						 curr_ebs = ebs;
 		}
 		
-		if (changed || pixmap.isNull() || pixmap.width() != s.width())
+		if (changed || pixmap.isNull() || pixmap.width() != s.width() || force)
 		{
 			pixmap = QPixmap(s);
 			pixmap.fill(palette().color(QPalette::Active,QPalette::Base));
--- trunk/extragear/network/ktorrent/plugins/infowidget/downloadedchunkbar.h \
#1186435:1186436 @@ -39,7 +39,7 @@
 		virtual ~DownloadedChunkBar();
 	
 		virtual const bt::BitSet & getBitSet() const;
-		virtual void updateBar();
+		virtual void updateBar(bool force = false);
 		virtual void drawBarContents(QPainter *p);
 		
 		void setTC(bt::TorrentInterface* tc);
--- trunk/extragear/network/ktorrent/plugins/infowidget/statustab.cpp \
#1186435:1186436 @@ -30,6 +30,7 @@
 #include "downloadedchunkbar.h"
 #include "availabilitychunkbar.h"
 #include "statustab.h"
+#include "settings.h"
 		
 using namespace bt;
 
@@ -165,7 +166,7 @@
 		if (!time_limit->hasFocus())
 			maxSeedTimeUpdate();
 		
-		share_ratio->setText(QString("<font color=\"%1\">%2</font>").arg(ratio <= 0.8 ? \
"#ff0000" : "#1c9a1c").arg(KGlobal::locale()->formatNumber(ratio,2))); \
+		share_ratio->setText(QString("<font color=\"%1\">%2</font>").arg(ratio <= \
Settings::greenRatio() ? "#ff0000" : \
"#1c9a1c").arg(KGlobal::locale()->formatNumber(ratio,2)));  
 		Uint32 secs = curr_tc->getRunningTimeUL(); 
 		if (secs == 0)
--- trunk/extragear/network/ktorrent/scripts/kcfg_qobject_gen.py #1186435:1186436
@@ -167,7 +167,7 @@
 		
 	def header(self,output):
 		global class_declaration_header
-		global class_decleartion_footer
+		global class_declaration_footer
 		global license
 		output.write(class_declaration_header % 
 			{"class_name" : self.class_name, "namespace" : self.namespace, "license" : \
license})


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic