Fixes to Web UI shutdown button

This commit is contained in:
Christophe Dumez 2012-08-19 22:15:44 +03:00
parent 0fe09aa088
commit 669d5a12a2
5 changed files with 10 additions and 5 deletions

View file

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

View file

@ -37,7 +37,7 @@
<ul> <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="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><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> </ul>
</li> </li>
<li> <li>
@ -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> <li><a id="aboutLink"><img class="MyMenuIcon" src="theme/help-about" width="16" height="16" onload="fixPNG(this)"/>_(&About)</a></li>
</ul> </ul>
</li> </li>
<li><a class="returnFalse" id="shutdownLink">_(&Shutdown)</a></li>
</ul> </ul>
</div> </div>
<div id="mochaToolbar"> <div id="mochaToolbar">

View file

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

View file

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

View file

@ -285,9 +285,12 @@ initializeWindows = function(){
addClickEvent('shutdown', function(e){ addClickEvent('shutdown', function(e){
new Event(e).stop(); new Event(e).stop();
new Request({url: 'command/shutdown'}).send(); new Request({url: 'command/shutdown',
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 onSuccess: function() {
stop(); 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 // Deactivate menu header links