diff --git a/src/webui/json.cpp b/src/webui/json.cpp deleted file mode 100644 index 94ac8d6dd..000000000 --- a/src/webui/json.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Bittorrent Client using Qt4 and libtorrent. - * Copyright (C) 2006-2012 Ishan Arora and Christophe Dumez - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, the copyright holders give permission to - * link this program with the OpenSSL project's "OpenSSL" library (or with - * modified versions of it that use the same license as the "OpenSSL" library), - * and distribute the linked executables. You must obey the GNU General Public - * License in all respects for all of the code used other than "OpenSSL". If you - * modify file(s), you may extend this exception to your version of the file(s), - * but you are not obligated to do so. If you do not wish to do so, delete this - * exception statement from your version. - * - * Contact : chris@qbittorrent.org - */ - -#include "json.h" - -#include -#include - -QString json::toJson(const QVariant& v) { - if (v.isNull()) - return "null"; - switch(v.type()) - { - case QVariant::Bool: - case QVariant::Double: - case QVariant::Int: - case QVariant::LongLong: - case QVariant::UInt: - case QVariant::ULongLong: - return v.value(); - case QVariant::StringList: - case QVariant::List: { - QStringList strList; - foreach (const QVariant &var, v.toList()) { - strList << toJson(var); - } - return "["+strList.join(",")+"]"; - } - case QVariant::String: { - QString s = v.value(); - QString result = "\""; - for (int i=0; i - -namespace json { - - QString toJson(const QVariant& v); - QVariantMap fromJson(const QString& json); - -} // namespace json - -#endif diff --git a/src/webui/jsondict.cpp b/src/webui/jsondict.cpp deleted file mode 100644 index 3cf48ac99..000000000 --- a/src/webui/jsondict.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Bittorrent Client using Qt4 and libtorrent. - * Copyright (C) 2012, Christophe Dumez - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, the copyright holders give permission to - * link this program with the OpenSSL project's "OpenSSL" library (or with - * modified versions of it that use the same license as the "OpenSSL" library), - * and distribute the linked executables. You must obey the GNU General Public - * License in all respects for all of the code used other than "OpenSSL". If you - * modify file(s), you may extend this exception to your version of the file(s), - * but you are not obligated to do so. If you do not wish to do so, delete this - * exception statement from your version. - * - * Contact : chris@qbittorrent.org - */ - -#include "jsondict.h" -#include "json.h" - -JsonDict::JsonDict(): m_dirty(false) -{ -} - -void JsonDict::clear() -{ - m_items.clear(); - m_dirty = true; -} - -void JsonDict::add(const QString& key, const QVariant& value) -{ - m_items.append("\"" + key + "\":" + json::toJson(value)); - m_dirty = true; -} - -const QString& JsonDict::toString() const -{ - if (m_dirty) { - m_json = "{" + m_items.join(",") + "}"; - m_dirty = false; - } - return m_json; -} diff --git a/src/webui/jsondict.h b/src/webui/jsondict.h deleted file mode 100644 index c653da821..000000000 --- a/src/webui/jsondict.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Bittorrent Client using Qt4 and libtorrent. - * Copyright (C) 2012, Christophe Dumez - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, the copyright holders give permission to - * link this program with the OpenSSL project's "OpenSSL" library (or with - * modified versions of it that use the same license as the "OpenSSL" library), - * and distribute the linked executables. You must obey the GNU General Public - * License in all respects for all of the code used other than "OpenSSL". If you - * modify file(s), you may extend this exception to your version of the file(s), - * but you are not obligated to do so. If you do not wish to do so, delete this - * exception statement from your version. - * - * Contact : chris@qbittorrent.org - */ - -#ifndef JSONDICT_H -#define JSONDICT_H - -#include - -class JsonDict -{ -public: - JsonDict(); - void clear(); - void add(const QString& key, const QVariant& value); - const QString& toString() const; - -private: - mutable bool m_dirty; - mutable QString m_json; - QStringList m_items; -}; - -#endif // JSONDICT_H diff --git a/src/webui/jsonlist.cpp b/src/webui/jsonlist.cpp deleted file mode 100644 index 6743ba447..000000000 --- a/src/webui/jsonlist.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Bittorrent Client using Qt4 and libtorrent. - * Copyright (C) 2012, Christophe Dumez - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, the copyright holders give permission to - * link this program with the OpenSSL project's "OpenSSL" library (or with - * modified versions of it that use the same license as the "OpenSSL" library), - * and distribute the linked executables. You must obey the GNU General Public - * License in all respects for all of the code used other than "OpenSSL". If you - * modify file(s), you may extend this exception to your version of the file(s), - * but you are not obligated to do so. If you do not wish to do so, delete this - * exception statement from your version. - * - * Contact : chris@qbittorrent.org - */ - -#include "jsonlist.h" -#include "json.h" - -JsonList::JsonList() : m_dirty(false) -{ -} - -const QString& JsonList::toString() const -{ - if (m_dirty) { - m_json = "[" + m_items.join(",") + "]"; - m_dirty = false; - } - return m_json; -} - -void JsonList::clear() -{ - m_items.clear(); - m_dirty = true; -} - -void JsonList::append(const QVariant& val) -{ - m_items.append(json::toJson(val)); - m_dirty = true; -} - -void JsonList::append(const JsonDict& dict) -{ - m_items.append(dict.toString()); - m_dirty = true; -} diff --git a/src/webui/jsonlist.h b/src/webui/jsonlist.h deleted file mode 100644 index 8a21ea62e..000000000 --- a/src/webui/jsonlist.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Bittorrent Client using Qt4 and libtorrent. - * Copyright (C) 2012, Christophe Dumez - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, the copyright holders give permission to - * link this program with the OpenSSL project's "OpenSSL" library (or with - * modified versions of it that use the same license as the "OpenSSL" library), - * and distribute the linked executables. You must obey the GNU General Public - * License in all respects for all of the code used other than "OpenSSL". If you - * modify file(s), you may extend this exception to your version of the file(s), - * but you are not obligated to do so. If you do not wish to do so, delete this - * exception statement from your version. - * - * Contact : chris@qbittorrent.org - */ - -#ifndef JSONLIST_H -#define JSONLIST_H - -#include -#include "jsondict.h" - -class JsonList -{ -public: - JsonList(); - const QString& toString() const; - void clear(); - void append(const QVariant& val); - void append(const JsonDict& dict); - -private: - mutable bool m_dirty; - mutable QString m_json; - QStringList m_items; -}; - -#endif // JSONLIST_H diff --git a/src/webui/webui.pri b/src/webui/webui.pri index ae4c6cedd..21e34ebca 100644 --- a/src/webui/webui.pri +++ b/src/webui/webui.pri @@ -4,9 +4,6 @@ HEADERS += $$PWD/httpserver.h \ $$PWD/httpconnection.h \ $$PWD/httprequestparser.h \ $$PWD/httpresponsegenerator.h \ - $$PWD/json.h \ - $$PWD/jsonlist.h \ - $$PWD/jsondict.h \ $$PWD/btjson.h \ $$PWD/prefjson.h \ $$PWD/httpheader.h \ @@ -17,10 +14,7 @@ SOURCES += $$PWD/httpserver.cpp \ $$PWD/httpconnection.cpp \ $$PWD/httprequestparser.cpp \ $$PWD/httpresponsegenerator.cpp \ - $$PWD/jsonlist.cpp \ - $$PWD/jsondict.cpp \ $$PWD/btjson.cpp \ - $$PWD/json.cpp \ $$PWD/prefjson.cpp \ $$PWD/httpheader.cpp \ $$PWD/httprequestheader.cpp \