Web UI code optimization

This commit is contained in:
Christophe Dumez
2011-09-29 20:47:51 +03:00
parent 2036326403
commit ae692ba9b8
6 changed files with 22 additions and 8 deletions

View File

@@ -56,7 +56,6 @@ using namespace libtorrent;
HttpConnection::HttpConnection(QTcpSocket *socket, HttpServer *parent)
: QObject(parent), m_socket(socket), m_httpserver(parent)
{
m_needsTranslation = !Preferences().getLocale().startsWith("en");
m_socket->setParent(this);
connect(m_socket, SIGNAL(readyRead()), SLOT(read()));
connect(m_socket, SIGNAL(disconnected()), SLOT(deleteLater()));
@@ -121,7 +120,7 @@ void HttpConnection::translateDocument(QString& data) {
QByteArray word = regex.cap(1).toLocal8Bit();
QString translation = word;
if (m_needsTranslation) {
if (m_httpserver->isTranslationNeeded()) {
int context_index = 0;
do {
translation = qApp->translate(contexts[context_index].c_str(), word.constData(), 0, QCoreApplication::UnicodeUTF8, 1);
@@ -433,7 +432,6 @@ void HttpConnection::respondCommand(const QString& command) {
QString json_str = m_parser.post("json");
EventManager* manager = m_httpserver->eventManager();
manager->setGlobalPreferences(json::fromJson(json_str));
m_needsTranslation = !Preferences().getLocale().startsWith("en");
return;
}
if(command == "setFilePrio") {