Advertisement
VlaoMao

KTorrent-git show total speed patch

Mar 19th, 2014
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.32 KB | None | 0 0
  1. diff --git a/ktorrent/gui.cpp b/ktorrent/gui.cpp
  2. index 94142df..78cf7d6 100644
  3. --- a/ktorrent/gui.cpp
  4. +++ b/ktorrent/gui.cpp
  5. @@ -47,6 +47,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. @@ -466,6 +467,15 @@ namespace kt
  14.              status_bar->updateSpeed(stats.upload_speed, stats.download_speed);
  15.              status_bar->updateTransfer(stats.bytes_uploaded, stats.bytes_downloaded);
  16.              status_bar->updateDHTStatus(Globals::instance().getDHT().isRunning(), Globals::instance().getDHT().getStats());
  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.              tray_icon->updateStats(stats);
  28.              core->updateGuiPlugins();
  29. diff --git a/ktorrent/pref/generalpref.ui b/ktorrent/pref/generalpref.ui
  30. index 7d29b0d..5413104 100644
  31. --- a/ktorrent/pref/generalpref.ui
  32. +++ b/ktorrent/pref/generalpref.ui
  33. @@ -171,6 +171,13 @@
  34.          </property>
  35.         </widget>
  36.        </item>
  37. +      <item>
  38. +       <widget class="QCheckBox" name="kcfg_showTotalSpeedInTitle">
  39. +        <property name="text">
  40. +         <string>Show total speed in the window title</string>
  41. +        </property>
  42. +       </widget>
  43. +      </item>
  44.       </layout>
  45.      </widget>
  46.     </item>
  47. diff --git a/libktcore/dbus/dbussettings.cpp b/libktcore/dbus/dbussettings.cpp
  48. index 53d445d..af97807 100644
  49. --- a/libktcore/dbus/dbussettings.cpp
  50. +++ b/libktcore/dbus/dbussettings.cpp
  51. @@ -777,5 +777,14 @@ namespace kt
  52.      {
  53.          Settings::setAutoRenameSingleFileTorrents(val);
  54.      }
  55. +    bool DBusSettings::showTotalSpeedInTitle()
  56. +    {
  57. +        return Settings::showTotalSpeedInTitle();
  58. +    }
  59. +
  60. +    void DBusSettings::setShowTotalSpeedInTitle(bool val)
  61. +    {
  62. +        Settings::setShowTotalSpeedInTitle(val);
  63. +    }
  64.  
  65.  }
  66. diff --git a/libktcore/dbus/dbussettings.h b/libktcore/dbus/dbussettings.h
  67. index 82fc8fd..06226f4 100644
  68. --- a/libktcore/dbus/dbussettings.h
  69. +++ b/libktcore/dbus/dbussettings.h
  70. @@ -186,6 +186,8 @@ namespace kt
  71.          Q_SCRIPTABLE void setPrimaryTransportProtocol(int val);
  72.          Q_SCRIPTABLE bool autoRenameSingleFileTorrents();
  73.          Q_SCRIPTABLE void setAutoRenameSingleFileTorrents(bool val);
  74. +        Q_SCRIPTABLE bool showTotalSpeedInTitle();
  75. +        Q_SCRIPTABLE void setShowTotalSpeedInTitle(bool val);
  76.  
  77.          Q_SCRIPTABLE void apply();
  78.      private:
  79. diff --git a/libktcore/ktorrent.kcfg b/libktcore/ktorrent.kcfg
  80. index c647614..daed91e 100644
  81. --- a/libktcore/ktorrent.kcfg
  82. +++ b/libktcore/ktorrent.kcfg
  83. @@ -66,6 +66,10 @@
  84.             <label>Show a system tray icon</label>
  85.             <default>true</default>
  86.         </entry>
  87. +       <entry name="showTotalSpeedInTitle" type="Bool">
  88. +           <label>Show a total speeds in the title</label>
  89. +           <default>false</default>
  90. +       </entry>
  91.         <entry name="showSpeedBarInTrayIcon" type="Bool">
  92.             <label>Show speed bar in tray icon</label>
  93.             <default>false</default>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement