From 2b02ec3a4eccc47d4db4918b3b0edf898f205da8 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sun, 19 Aug 2012 19:25:21 +0200 Subject: [PATCH 1/2] Shutdownbutton in webui --- src/webui/html/index.html | 1 + src/webui/httpconnection.cpp | 3 +++ src/webui/scripts/mocha-init.js | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/src/webui/html/index.html b/src/webui/html/index.html index 9864ff84d..60b34cab4 100644 --- a/src/webui/html/index.html +++ b/src/webui/html/index.html @@ -66,6 +66,7 @@
  • _(&About)
  • +
  • _(&Shutdown)
  • diff --git a/src/webui/httpconnection.cpp b/src/webui/httpconnection.cpp index 308b1cc0b..4c3aef84b 100644 --- a/src/webui/httpconnection.cpp +++ b/src/webui/httpconnection.cpp @@ -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) { diff --git a/src/webui/scripts/mocha-init.js b/src/webui/scripts/mocha-init.js index abadd1bc3..6913e6931 100644 --- a/src/webui/scripts/mocha-init.js +++ b/src/webui/scripts/mocha-init.js @@ -283,6 +283,13 @@ initializeWindows = function(){ }); }); + addClickEvent('shutdown', function(e){ + new Event(e).stop(); + new Request({url: 'command/shutdown'}).send(); + document.write("qBittorrent-nox has been shutdown.

    qBittorrent-nox has been shutdown.

    "); //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){ From 6711c58ff1af2a1785f8ba8a6aa92cf2dd550a45 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sun, 19 Aug 2012 20:43:15 +0200 Subject: [PATCH 2/2] Remove icon (ugly), fix localization --- src/webui/html/index.html | 2 +- src/webui/scripts/mocha-init.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webui/html/index.html b/src/webui/html/index.html index 60b34cab4..ecede2147 100644 --- a/src/webui/html/index.html +++ b/src/webui/html/index.html @@ -66,7 +66,7 @@
  • _(&About)
  • -
  • _(&Shutdown)
  • +
  • _(&Shutdown)
  • diff --git a/src/webui/scripts/mocha-init.js b/src/webui/scripts/mocha-init.js index 6913e6931..4d9ae2c37 100644 --- a/src/webui/scripts/mocha-init.js +++ b/src/webui/scripts/mocha-init.js @@ -286,7 +286,7 @@ initializeWindows = function(){ addClickEvent('shutdown', function(e){ new Event(e).stop(); new Request({url: 'command/shutdown'}).send(); - document.write("qBittorrent-nox has been shutdown.

    qBittorrent-nox has been shutdown.

    "); //TODO Can someone with artistic skills put a pretty webpage here + document.write("_(qBittorrent has been shutdown.)

    _(qBittorrent has been shutdown.)

    "); //TODO Can someone with artistic skills put a pretty webpage here stop(); });