Merge pull request #2201 from buinsky/master

WebUI: Some changes
This commit is contained in:
sledgehammer999 2014-11-30 15:11:29 +02:00
commit f5048a4586
12 changed files with 57 additions and 20 deletions

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

View file

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

View file

@ -94,6 +94,9 @@ void AbstractRequestHandler::print_impl(const QByteArray& data, const QString& t
if (!response_.headers.contains(HEADER_CONTENT_TYPE))
response_.headers[HEADER_CONTENT_TYPE] = type;
if (type.indexOf("image") > -1)
response_.headers[HEADER_CACHE_CONTROL] = "max-age=3000000";
response_.content += data;
}

View file

@ -33,7 +33,6 @@
#include "qbtsession.h"
#include "torrentpersistentdata.h"
#include "jsonutils.h"
#include "preferences.h"
#include <QDebug>
#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_UPSPEED[] = "up_info_speed";
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)
{
@ -396,6 +394,5 @@ QByteArray btjson::getTransferInfo()
info[KEY_TRANSFER_DLDATA] = static_cast<qlonglong>(sessionStatus.total_payload_download);
info[KEY_TRANSFER_UPSPEED] = sessionStatus.payload_upload_rate;
info[KEY_TRANSFER_UPDATA] = static_cast<qlonglong>(sessionStatus.total_payload_upload);
info[KEY_SHOW_SPEED_IN_TITLE] = Preferences::instance()->speedInTitleBar();
return json::toJson(info);
}

View file

@ -39,6 +39,7 @@ const QString HEADER_SET_COOKIE = "Set-Cookie";
const QString HEADER_CONTENT_TYPE = "Content-Type";
const QString HEADER_CONTENT_ENCODING = "Content-Encoding";
const QString HEADER_CONTENT_LENGTH = "Content-Length";
const QString HEADER_CACHE_CONTROL = "Cache-Control";
const QString CONTENT_TYPE_CSS = "text/css; charset=UTF-8";
const QString CONTENT_TYPE_GIF = "image/gif";

View file

@ -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>
</ul>
</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>
<a class="returnFalse">_(&Tools)</a>
<ul>

View file

@ -119,7 +119,7 @@ body {
font-size: 12px;
}
#desktopNavbar li {
#desktopNavbar>ul>li {
float: left;
}
@ -151,7 +151,6 @@ body {
border: 1px solid #3f3f3f;
background: #fff url(../images/skin/bg-dropdown.gif) repeat-y;
position: absolute;
width: 164px;
left: -999em;
z-index: 8000;
/* Fix by Chris */
@ -184,7 +183,7 @@ body {
#desktopNavbar li ul li a {
position: relative;
/*padding: 1px 9px 1px 25px;*/
width: 134px;
min-width: 120px;
color: #3f3f3f;
font-weight: normal;
/* Fix By Chris */

View file

@ -162,7 +162,7 @@ a.propButton img {
}
/* context menu specific */
#contextmenu { border:1px solid #999; padding:0; background:#eee; list-style-type:none; display:none; width: 164px;}
#contextmenu { border:1px solid #999; padding:0; background:#eee; list-style-type:none; display:none;}
#contextmenu .separator { border-top:1px solid #999; }
#contextmenu li { margin:0; padding:0;}
#contextmenu li a { display:block; padding:5px 10px 5px 5px; font-size:12px; text-decoration:none; font-family:tahoma,arial,sans-serif; color:#000; }
@ -176,7 +176,7 @@ a.propButton img {
position: absolute;
left: -999em;
z-index: 8000;
margin: -29px 0 0 164px;
margin: -29px 0 0 100%;
width: 164px;
}
#contextmenu li ul li a {

View file

@ -33,9 +33,8 @@ window.addEvent('load', function(){
var saveColumnSizes = function() {
var filters_width = $('Filters').getSize().x;
var properties_height = $('propertiesPanel').getSize().y;
// Save it in a cookie
Cookie.write('filters_width', filters_width);
Cookie.write('properties_height', properties_height);
localStorage.setItem('filters_width', filters_width);
localStorage.setItem('properties_height', properties_height);
}
/*MochaUI.Desktop = new MochaUI.Desktop();
@ -45,7 +44,7 @@ window.addEvent('load', function(){
});*/
MochaUI.Desktop.initialize();
var filt_w = Cookie.read('filters_width');
var filt_w = localStorage.getItem('filters_width');
if($defined(filt_w))
filt_w = filt_w.toInt();
else
@ -112,11 +111,10 @@ window.addEvent('load', function(){
.replace("%2", friendlyUnit(info.dl_info_data, false)));
$("UpInfos").set('html', "_(U: %1 - T: %2)".replace("%1", friendlyUnit(info.up_info_speed, true))
.replace("%2", friendlyUnit(info.up_info_data, false)));
if(info.show_speed_in_title) {
if(localStorage.getItem('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));
} else {
else
document.title = "_(qBittorrent web User Interface)";
}
waitingTrInfo=false;
loadTransferInfo.delay(3000);
}
@ -227,7 +225,7 @@ window.addEvent('load', function(){
onResize: saveColumnSizes,
height: null
});
var prop_h = Cookie.read('properties_height');
var prop_h = localStorage.getItem('properties_height');
if($defined(prop_h))
prop_h = prop_h.toInt();
else
@ -253,14 +251,13 @@ window.addEvent('load', function(){
$("all_filter").removeClass("selectedFilter");
$("downloading_filter").removeClass("selectedFilter");
$("completed_filter").removeClass("selectedFilter");
$("paused_filter").removeClass("selectedFilter");
$("paused_filter").removeClass("selectedFilter");
$("active_filter").removeClass("selectedFilter");
$("inactive_filter").removeClass("selectedFilter");
$(f+"_filter").addClass("selectedFilter");
myTable.setFilter(f);
ajaxfn();
// Remember this via Cookie
Cookie.write('selected_filter', f);
localStorage.setItem('selected_filter', f);
}
});

View file

@ -42,7 +42,7 @@ var dynamicTable = new Class ({
this.cur = new Array();
this.priority_hidden = false;
this.progressIndex = progressIndex;
this.filter = Cookie.read('selected_filter');
this.filter = localStorage.getItem('selected_filter');
if(!$defined(this.filter)) {
this.filter = 'all';
}

View file

@ -9,6 +9,18 @@
----------------------------------------------------------------- */
/* Define localStorage object for older browsers */
if (typeof localStorage == 'undefined') {
window['localStorage'] = {
getItem: function(name) {
return Cookie.read(name);
},
setItem: function(name, value) {
Cookie.write(name, value, {duration: 365 * 10});
}
}
}
initializeWindows = function(){
function addClickEvent(el, fn){
@ -269,6 +281,24 @@ initializeWindows = function(){
}).send();
});
updateSpeedInBrowserTitleBarLinkCheckState = function()
{
if (localStorage.getItem('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 = localStorage.getItem('speed_in_browser_title_bar');
speed_in_browser_title_bar = speed_in_browser_title_bar == 'true' ? 'false' : 'true';
localStorage.setItem('speed_in_browser_title_bar', speed_in_browser_title_bar);
updateSpeedInBrowserTitleBarLinkCheckState();
});
// Deactivate menu header links
$$('a.returnFalse').each(function(el){
el.addEvent('click', function(e){