Browse Source

- Fixed several issues with Web UI

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
34ba69e319
  1. 7
      src/eventmanager.cpp
  2. 2
      src/httpconnection.cpp
  3. 5
      src/webui/scripts/client.js
  4. 6
      src/webui/scripts/dynamicTable.js
  5. 6
      src/webui/scripts/mocha-init.js
  6. 2
      src/webui/uploadframe.html

7
src/eventmanager.cpp

@ -109,9 +109,12 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
event["progress"] = QVariant(h.progress()); event["progress"] = QVariant(h.progress());
event["dlspeed"] = QVariant(tr("%1/s", "e.g. 120 KiB/s").arg(misc::friendlyUnit(h.download_payload_rate()))); event["dlspeed"] = QVariant(tr("%1/s", "e.g. 120 KiB/s").arg(misc::friendlyUnit(h.download_payload_rate())));
if(BTSession->isQueueingEnabled()) { if(BTSession->isQueueingEnabled()) {
event["priority"] = QVariant(h.queue_position()); if(h.queue_position() >= 0)
event["priority"] = QVariant(QString::number(h.queue_position()));
else
event["priority"] = "*";
} else { } else {
event["priority"] = -1; event["priority"] = "*";
} }
event["upspeed"] = QVariant(tr("%1/s", "e.g. 120 KiB/s").arg(misc::friendlyUnit(h.upload_payload_rate()))); event["upspeed"] = QVariant(tr("%1/s", "e.g. 120 KiB/s").arg(misc::friendlyUnit(h.upload_payload_rate())));
QString seeds = QString::number(h.num_seeds()); QString seeds = QString::number(h.num_seeds());

2
src/httpconnection.cpp

@ -107,7 +107,7 @@ QString HttpConnection::translateDocument(QString data) {
bool found = false; bool found = false;
do { do {
found = false; found = false;
QRegExp regex("_\\(([\\w\\s?!]+)\\)"); QRegExp regex("_\\(([\\w\\s?!\\.]+)\\)");
i = regex.indexIn(data, i); i = regex.indexIn(data, i);
if(i >= 0) { if(i >= 0) {
qDebug("Found translatable string: %s", regex.cap(1).toUtf8().data()); qDebug("Found translatable string: %s", regex.cap(1).toUtf8().data());

5
src/webui/scripts/client.js

@ -93,11 +93,12 @@ window.addEvent('domready', function(){
row[8] = event.upspeed; row[8] = event.upspeed;
row[9] = event.eta; row[9] = event.eta;
row[10] = event.ratio; row[10] = event.ratio;
if(row[2] != -1) if(row[2] != "*")
queueing_enabled = true; queueing_enabled = true;
if(!torrent_hashes.contains(event.hash)) { if(!torrent_hashes.contains(event.hash)) {
// New unfinished torrent // New unfinished torrent
//torrent_hashes[torrent_hashes.length] = event.hash; torrent_hashes[torrent_hashes.length] = event.hash;
//alert("Inserting row");
myTable.insertRow(event.hash, row); myTable.insertRow(event.hash, row);
} else { } else {
// Update torrent data // Update torrent data

6
src/webui/scripts/dynamicTable.js

@ -78,7 +78,7 @@ var dynamicTable = new Class ({
var trs = this.table.getElements('tr'); var trs = this.table.getElements('tr');
trs.each(function(tr,i){ trs.each(function(tr,i){
var tds = tr.getElements('td'); var tds = tr.getElements('td');
tds.getLast().removeClass('invisible'); tds[2].removeClass('invisible');
}.bind(this)); }.bind(this));
this.priority_hidden = false; this.priority_hidden = false;
}, },
@ -126,8 +126,6 @@ var dynamicTable = new Class ({
//this.removeRow(id); //this.removeRow(id);
var tr = new Element('tr'); var tr = new Element('tr');
this.rows[id] = tr; this.rows[id] = tr;
// Apply filter
this.applyFilterOnRow(tr, status);
for(var i=0; i<row.length; i++) for(var i=0; i<row.length; i++)
{ {
var td = new Element('td'); var td = new Element('td');
@ -209,6 +207,8 @@ var dynamicTable = new Class ({
tr.injectInside(this.table); tr.injectInside(this.table);
this.altRow(); this.altRow();
// Apply filter
//this.applyFilterOnRow(tr, status);
}, },
selectAll: function() { selectAll: function() {

6
src/webui/scripts/mocha-init.js

@ -23,7 +23,7 @@ initializeWindows = function(){
new Event(e).stop(); new Event(e).stop();
new MochaUI.Window({ new MochaUI.Window({
id: 'downloadPage', id: 'downloadPage',
title: 'Download from URLs', title: "(Download from URL)",
loadMethod: 'iframe', loadMethod: 'iframe',
contentURL:'download.html', contentURL:'download.html',
scrollbars: false, scrollbars: false,
@ -41,7 +41,7 @@ initializeWindows = function(){
new Event(e).stop(); new Event(e).stop();
new MochaUI.Window({ new MochaUI.Window({
id: 'uploadPage', id: 'uploadPage',
title: 'Upload torrent file', title: "_(Download local torrent)",
loadMethod: 'iframe', loadMethod: 'iframe',
contentURL:'upload.html', contentURL:'upload.html',
scrollbars: false, scrollbars: false,
@ -106,7 +106,7 @@ initializeWindows = function(){
new Event(e).stop(); new Event(e).stop();
new MochaUI.Window({ new MochaUI.Window({
id: 'bugPage', id: 'bugPage',
title: 'Report a Bug', title: '_(Report a bug)',
loadMethod: 'iframe', loadMethod: 'iframe',
contentURL: 'http://bugs.qbittorrent.org/', contentURL: 'http://bugs.qbittorrent.org/',
width: 650, width: 650,

2
src/webui/uploadframe.html

@ -6,6 +6,7 @@
<link rel="stylesheet" href="css/style.css" type="text/css" /> <link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/mocha.css" type="text/css" /> <link rel="stylesheet" href="css/mocha.css" type="text/css" />
<script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script> <script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/mocha.js"></script>
<!-- <script type="text/javascript" src="scripts/upload.js" charset="utf-8"></script> --> <!-- <script type="text/javascript" src="scripts/upload.js" charset="utf-8"></script> -->
<script type="text/javascript"> <script type="text/javascript">
function submitForm(form) { function submitForm(form) {
@ -15,6 +16,7 @@ function submitForm(form) {
} }
document.uploadForm.submit(); document.uploadForm.submit();
window.parent.showSuccess(); window.parent.showSuccess();
//MochaUI.closeAll();
} }
</script> </script>
</head> </head>

Loading…
Cancel
Save