Browse Source

Fixes to Web UI shutdown button

adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
669d5a12a2
  1. 1
      Changelog
  2. 3
      src/webui/html/index.html
  3. 1
      src/webui/httpconnection.cpp
  4. 1
      src/webui/httpserver.cpp
  5. 9
      src/webui/scripts/mocha-init.js

1
Changelog

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
* unreleased - - Christophe Dumez <chris@qbittorrent.org> - v3.1.0
- FEATURE: Add command line option to daemonize qbittorrent-nox (ngaro)
- FEATURE: Add "Shutdown qBittorrent" button to Web UI (ngaro)
- BUGFIX: Greatly improve RSS manager performance (closes #34)
* Thu Aug 09 2012 - Christophe Dumez <chris@qbittorrent.org> - v3.0.0

3
src/webui/html/index.html

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
<ul>
<li><a id="uploadLink"><img class="MyMenuIcon" src="theme/list-add" width="16" height="16" onload="fixPNG(this)"/>_(&Add torrent file...)</a></li>
<li><a id="downloadLink"><img class="MyMenuIcon" src="theme/insert-link" width="16" height="16" onload="fixPNG(this)"/>_(Add &link to torrent...)</a></li>
<li class="divider"><a id="shutdownLink"><img class="MyMenuIcon" src="theme/application-exit" width="16" height="16" onload="fixPNG(this)"/>_(Exit qBittorrent)</a></li>
</ul>
</li>
<li>
@ -66,7 +66,6 @@ @@ -66,7 +66,6 @@
<li><a id="aboutLink"><img class="MyMenuIcon" src="theme/help-about" width="16" height="16" onload="fixPNG(this)"/>_(&About)</a></li>
</ul>
</li>
<li><a class="returnFalse" id="shutdownLink">_(&Shutdown)</a></li>
</ul>
</div>
<div id="mochaToolbar">

1
src/webui/httpconnection.cpp

@ -596,6 +596,7 @@ void HttpConnection::respondCommand(const QString& command) { @@ -596,6 +596,7 @@ void HttpConnection::respondCommand(const QString& command) {
return;
}
if (command == "shutdown") {
qDebug() << "Shutdown request from Web UI";
qApp->exit();
}
}

1
src/webui/httpserver.cpp

@ -135,6 +135,7 @@ HttpServer::HttpServer(QObject* parent) : QTcpServer(parent) @@ -135,6 +135,7 @@ HttpServer::HttpServer(QObject* parent) : QTcpServer(parent)
a = tr("The following parameters are supported:");
a = tr("Torrent path");
a = tr("Torrent name");
a = tr("qBittorrent has been shutdown.");
}
HttpServer::~HttpServer() {

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

@ -285,9 +285,12 @@ initializeWindows = function(){ @@ -285,9 +285,12 @@ initializeWindows = function(){
addClickEvent('shutdown', function(e){
new Event(e).stop();
new Request({url: 'command/shutdown'}).send();
document.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>_(qBittorrent has been shutdown.)</title><style type=\"text/css\">body { text-align: center; }</style></head><body><h1>_(qBittorrent has been shutdown.)</h1></body></html>"); //TODO Can someone with artistic skills put a pretty webpage here
stop();
new Request({url: 'command/shutdown',
onSuccess: function() {
document.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>_(qBittorrent has been shutdown.)</title><style type=\"text/css\">body { text-align: center; }</style></head><body><h1>_(qBittorrent has been shutdown.)</h1></body></html>");
}
}
).send();
});
// Deactivate menu header links

Loading…
Cancel
Save