Browse Source

Shutdownbutton in webui

adaptive-webui-19844
Nikolas Garofil 12 years ago
parent
commit
2b02ec3a4e
  1. 1
      src/webui/html/index.html
  2. 3
      src/webui/httpconnection.cpp
  3. 7
      src/webui/scripts/mocha-init.js

1
src/webui/html/index.html

@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
<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"><!--TODO Can someone with artistic skills put a shutdown-icon here-->_(&Shutdown)</a></li>
</ul>
</div>
<div id="mochaToolbar">

3
src/webui/httpconnection.cpp

@ -595,6 +595,9 @@ void HttpConnection::respondCommand(const QString& command) { @@ -595,6 +595,9 @@ void HttpConnection::respondCommand(const QString& command) {
QBtSession::instance()->recheckTorrent(m_parser.post("hash"));
return;
}
if (command == "shutdown") {
qApp->exit();
}
}
void HttpConnection::decreaseTorrentsPriority(const QStringList &hashes) {

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

@ -283,6 +283,13 @@ initializeWindows = function(){ @@ -283,6 +283,13 @@ 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-nox has been shutdown.</title><style type=\"text/css\">body { text-align: center; }</style></head><body><h1>qBittorrent-nox has been shutdown.</h1></body></html>"); //TODO Can someone with artistic skills put a pretty webpage here
stop();
});
// Deactivate menu header links
$$('a.returnFalse').each(function(el){
el.addEvent('click', function(e){

Loading…
Cancel
Save