Guest User

ktorrent total speed in the title

a guest
Feb 15th, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.39 KB | None | 0 0
  1. diff --git a/ktorrent/gui.cpp b/ktorrent/gui.cpp
  2. index 55cca0e..23105f4 100644
  3. --- a/ktorrent/gui.cpp
  4. +++ b/ktorrent/gui.cpp
  5. @@ -46,6 +46,7 @@
  6.  #include <torrent/queuemanager.h>
  7.  #include <torrent/torrentcontrol.h>
  8.  #include <util/log.h>
  9. +#include <util/functions.h>
  10.  #include <util/timer.h>
  11.  #include <util/error.h>
  12.  #include <dht/dhtbase.h>
  13. @@ -461,6 +462,16 @@ namespace kt
  14.         {
  15.             CurrentStats stats = core->getStats();
  16.             status_bar->updateSpeed(stats.upload_speed,stats.download_speed);
  17. +          
  18. +           //All speed to Window status bar
  19. +           if(Settings::showTotalSpeedInTitle())
  20. +           {
  21. +             QString down_up_speed = QString(i18n("D: %1 | U: %2")).arg(BytesPerSecToString((double)stats.download_speed)).arg(BytesPerSecToString((double)stats.upload_speed));
  22. +             setCaption(down_up_speed);
  23. +           }else{
  24. +             setCaption(core->getGroupManager()->allGroup()->groupName());
  25. +           }
  26. +          
  27.             status_bar->updateTransfer(stats.bytes_uploaded,stats.bytes_downloaded);
  28.             status_bar->updateDHTStatus(Globals::instance().getDHT().isRunning(),Globals::instance().getDHT().getStats());
  29.  
  30. @@ -520,7 +531,6 @@ namespace kt
  31.         {
  32.             show();
  33.         }
  34. -      
  35.         setCurrentActivity(central->currentActivity());
  36.     }
  37.  
  38. diff --git a/ktorrent/pref/generalpref.ui b/ktorrent/pref/generalpref.ui
  39. index 5d1ea7f..616c54d 100644
  40. --- a/ktorrent/pref/generalpref.ui
  41. +++ b/ktorrent/pref/generalpref.ui
  42. @@ -176,6 +176,13 @@ p, li { white-space: pre-wrap; }
  43.          </property>
  44.         </widget>
  45.        </item>
  46. +      <item>
  47. +       <widget class="QCheckBox" name="kcfg_showTotalSpeedInTitle">
  48. +        <property name="text">
  49. +         <string>Show total speed in the window title</string>
  50. +        </property>
  51. +       </widget>
  52. +      </item>
  53.       </layout>
  54.      </widget>
  55.     </item>
  56. diff --git a/libktcore/dbus/dbussettings.cpp b/libktcore/dbus/dbussettings.cpp
  57. index cf6d80f..4f531c4 100644
  58. --- a/libktcore/dbus/dbussettings.cpp
  59. +++ b/libktcore/dbus/dbussettings.cpp
  60. @@ -777,5 +777,16 @@ namespace kt
  61.     {
  62.         Settings::setAutoRenameSingleFileTorrents(val);
  63.     }
  64. +  
  65. +   bool DBusSettings::showTotalSpeedInTitle()
  66. +   {
  67. +       return Settings::showTotalSpeedInTitle();
  68. +   }
  69. +
  70. +   void DBusSettings::setShowTotalSpeedInTitle(bool val)
  71. +   {
  72. +       Settings::setShowTotalSpeedInTitle(val);
  73. +   }
  74. +
  75.  
  76.  }
  77. diff --git a/libktcore/dbus/dbussettings.h b/libktcore/dbus/dbussettings.h
  78. index 2636058..b7dbe50 100644
  79. --- a/libktcore/dbus/dbussettings.h
  80. +++ b/libktcore/dbus/dbussettings.h
  81. @@ -186,6 +186,8 @@ namespace kt
  82.         Q_SCRIPTABLE void setPrimaryTransportProtocol(int val);
  83.         Q_SCRIPTABLE bool autoRenameSingleFileTorrents();
  84.         Q_SCRIPTABLE void setAutoRenameSingleFileTorrents(bool val);
  85. +       Q_SCRIPTABLE bool showTotalSpeedInTitle();
  86. +       Q_SCRIPTABLE void setShowTotalSpeedInTitle(bool val);
  87.  
  88.         Q_SCRIPTABLE void apply();
  89.     private:
  90. diff --git a/libktcore/ktorrent.kcfg b/libktcore/ktorrent.kcfg
  91. index b203259..07f98bb 100644
  92. --- a/libktcore/ktorrent.kcfg
  93. +++ b/libktcore/ktorrent.kcfg
  94. @@ -66,6 +66,10 @@
  95.             <label>Show a system tray icon</label>
  96.             <default>true</default>
  97.         </entry>
  98. +                <entry name="showTotalSpeedInTitle" type="Bool">
  99. +                        <label>Show a total speeds in the title</label>
  100. +                        <default>false</default>
  101. +                </entry>
  102.         <entry name="showSpeedBarInTrayIcon" type="Bool">
  103.             <label>Show speed bar in tray icon</label>
  104.             <default>false</default>
Advertisement
Add Comment
Please, Sign In to add comment