Browse Source

Add "Speed in title bar" item to menu

* file: src/Icons/oxygen/checked.png
  copyright: Victor Buinsky <allok.victor@gmail.com>
adaptive-webui-19844
buinsky 10 years ago
parent
commit
5e8c62e539
  1. 3
      AUTHORS
  2. BIN
      src/Icons/oxygen/checked.png
  3. 1
      src/icons.qrc
  4. 3
      src/webui/btjson.cpp
  5. 6
      src/webui/www/private/index.html
  6. 7
      src/webui/www/public/scripts/client.js
  7. 18
      src/webui/www/public/scripts/mocha-init.js

3
AUTHORS

@ -77,6 +77,9 @@ Images Authors:
* file: src/search_engine/engines/torrentreactor.png * file: src/search_engine/engines/torrentreactor.png
copyright: Downloaded from torrentreactor.net copyright: Downloaded from torrentreactor.net
* file: src/Icons/oxygen/checked.png
copyright: Victor Buinsky <allok.victor@gmail.com>
Translations authors: Translations authors:
* files: src/lang/*.ts * files: src/lang/*.ts
* file: src/Icons/qBittorrent.desktop * file: src/Icons/qBittorrent.desktop

BIN
src/Icons/oxygen/checked.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

1
src/icons.qrc

@ -365,5 +365,6 @@
<file>Icons/oxygen/system-log-out.png</file> <file>Icons/oxygen/system-log-out.png</file>
<file>Icons/oxygen/go-bottom.png</file> <file>Icons/oxygen/go-bottom.png</file>
<file>Icons/oxygen/go-top.png</file> <file>Icons/oxygen/go-top.png</file>
<file>Icons/oxygen/checked.png</file>
</qresource> </qresource>
</RCC> </RCC>

3
src/webui/btjson.cpp

@ -33,7 +33,6 @@
#include "qbtsession.h" #include "qbtsession.h"
#include "torrentpersistentdata.h" #include "torrentpersistentdata.h"
#include "jsonutils.h" #include "jsonutils.h"
#include "preferences.h"
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
@ -132,7 +131,6 @@ static const char KEY_TRANSFER_DLSPEED[] = "dl_info_speed";
static const char KEY_TRANSFER_DLDATA[] = "dl_info_data"; static const char KEY_TRANSFER_DLDATA[] = "dl_info_data";
static const char KEY_TRANSFER_UPSPEED[] = "up_info_speed"; static const char KEY_TRANSFER_UPSPEED[] = "up_info_speed";
static const char KEY_TRANSFER_UPDATA[] = "up_info_data"; static const char KEY_TRANSFER_UPDATA[] = "up_info_data";
static const char KEY_SHOW_SPEED_IN_TITLE[] = "show_speed_in_title";
static QVariantMap toMap(const QTorrentHandle& h) static QVariantMap toMap(const QTorrentHandle& h)
{ {
@ -396,6 +394,5 @@ QByteArray btjson::getTransferInfo()
info[KEY_TRANSFER_DLDATA] = static_cast<qlonglong>(sessionStatus.total_payload_download); info[KEY_TRANSFER_DLDATA] = static_cast<qlonglong>(sessionStatus.total_payload_download);
info[KEY_TRANSFER_UPSPEED] = sessionStatus.payload_upload_rate; info[KEY_TRANSFER_UPSPEED] = sessionStatus.payload_upload_rate;
info[KEY_TRANSFER_UPDATA] = static_cast<qlonglong>(sessionStatus.total_payload_upload); info[KEY_TRANSFER_UPDATA] = static_cast<qlonglong>(sessionStatus.total_payload_upload);
info[KEY_SHOW_SPEED_IN_TITLE] = Preferences::instance()->speedInTitleBar();
return json::toJson(info); return json::toJson(info);
} }

6
src/webui/www/private/index.html

@ -52,6 +52,12 @@
<li class="divider"><a id="deleteLink"><img class="MyMenuIcon" src="theme/list-remove" alt="_(&Delete)" width="16" height="16" onload="fixPNG(this)"/>_(&Delete)</a></li> <li class="divider"><a id="deleteLink"><img class="MyMenuIcon" src="theme/list-remove" alt="_(&Delete)" width="16" height="16" onload="fixPNG(this)"/>_(&Delete)</a></li>
</ul> </ul>
</li> </li>
<li>
<a class="returnFalse">_(&View)</a>
<ul>
<li><a id="speedInBrowserTitleBarLink"><img class="MyMenuIcon" src="theme/checked" alt="_(&Speed in title bar)" width="16" height="16" onload="fixPNG(this)"/>_(&Speed in title bar)</a></li>
</ul>
</li>
<li> <li>
<a class="returnFalse">_(&Tools)</a> <a class="returnFalse">_(&Tools)</a>
<ul> <ul>

7
src/webui/www/public/scripts/client.js

@ -112,11 +112,10 @@ window.addEvent('load', function(){
.replace("%2", friendlyUnit(info.dl_info_data, false))); .replace("%2", friendlyUnit(info.dl_info_data, false)));
$("UpInfos").set('html', "_(U: %1 - T: %2)".replace("%1", friendlyUnit(info.up_info_speed, true)) $("UpInfos").set('html', "_(U: %1 - T: %2)".replace("%1", friendlyUnit(info.up_info_speed, true))
.replace("%2", friendlyUnit(info.up_info_data, false))); .replace("%2", friendlyUnit(info.up_info_data, false)));
if(info.show_speed_in_title) { if(Cookie.read('speed_in_browser_title_bar') == 'true')
document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true)); document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true));
} else { else
document.title = "_(qBittorrent web User Interface)"; document.title = "_(qBittorrent web User Interface)";
}
waitingTrInfo=false; waitingTrInfo=false;
loadTransferInfo.delay(3000); loadTransferInfo.delay(3000);
} }
@ -253,7 +252,7 @@ window.addEvent('load', function(){
$("all_filter").removeClass("selectedFilter"); $("all_filter").removeClass("selectedFilter");
$("downloading_filter").removeClass("selectedFilter"); $("downloading_filter").removeClass("selectedFilter");
$("completed_filter").removeClass("selectedFilter"); $("completed_filter").removeClass("selectedFilter");
$("paused_filter").removeClass("selectedFilter"); $("paused_filter").removeClass("selectedFilter");
$("active_filter").removeClass("selectedFilter"); $("active_filter").removeClass("selectedFilter");
$("inactive_filter").removeClass("selectedFilter"); $("inactive_filter").removeClass("selectedFilter");
$(f+"_filter").addClass("selectedFilter"); $(f+"_filter").addClass("selectedFilter");

18
src/webui/www/public/scripts/mocha-init.js

@ -269,6 +269,24 @@ initializeWindows = function(){
}).send(); }).send();
}); });
updateSpeedInBrowserTitleBarLinkCheckState = function()
{
if (Cookie.read('speed_in_browser_title_bar') == 'true')
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '1';
else
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '0';
}
updateSpeedInBrowserTitleBarLinkCheckState();
addClickEvent('speedInBrowserTitleBar', function(e){
new Event(e).stop();
var speed_in_browser_title_bar = Cookie.read('speed_in_browser_title_bar');
speed_in_browser_title_bar = speed_in_browser_title_bar == 'true' ? 'false' : 'true';
Cookie.write('speed_in_browser_title_bar', speed_in_browser_title_bar, {duration: 365 * 10});
updateSpeedInBrowserTitleBarLinkCheckState(true);
});
// Deactivate menu header links // Deactivate menu header links
$$('a.returnFalse').each(function(el){ $$('a.returnFalse').each(function(el){
el.addEvent('click', function(e){ el.addEvent('click', function(e){

Loading…
Cancel
Save