* Replace priority combo boxes by check boxes in Web UI as in Regular UI

* Prepare http server and preferences classes to add new settings to Web UI
  * Tabified Program preferences in Web UI since there will be a lot of settings soon
  * Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
  * Added a command line parameter to change the web ui port
  * Fix PeerGuardian .p2b binary filter support
This commit is contained in:
Christophe Dumez 2009-12-28 19:39:47 +00:00
parent 9d06947125
commit 1128b3ea83
72 changed files with 19448 additions and 8094 deletions

View file

@ -98,6 +98,36 @@ namespace json {
return "{"+vlist.join(",")+"}";
}
QVariantMap fromJson(QString json) {
QVariantMap m;
if(json.startsWith("{") && json.endsWith("}")) {
json.chop(1);
json = json.replace(0, 1, "");
QStringList couples = json.split(",");
foreach(QString couple, couples) {
QStringList parts = couple.split(":");
if(parts.size() != 2) continue;
QString key = parts.first();
if(key.startsWith("\"") && key.endsWith("\"")) {
key.chop(1);
key = key.replace(0, 1, "");
}
QString value_str = parts.last();
QVariant value;
if(value_str.startsWith("\"") && value_str.endsWith("\"")) {
value_str.chop(1);
value_str = value_str.replace(0, 1, "");
value = value_str;
} else {
value = value_str.toInt();
}
m.insert(key,value);
qDebug("%s:%s", key.toLocal8Bit().data(), value_str.toLocal8Bit().data());
}
}
return m;
}
QString toJson(QList<QVariantMap> v) {
QStringList res;
foreach(QVariantMap m, v) {