Browse Source

Merge pull request #3838 from glassez/wswitch

Fix compiler warnings (Closes #3826).
adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
8d025949d9
  1. 2
      src/src.pro
  2. 32
      src/webui/btjson.cpp

2
src/src.pro

@ -24,7 +24,7 @@ nogui {
TARGET = qbittorrent-nox TARGET = qbittorrent-nox
} else { } else {
QT += xml QT += xml
QT += concurrent greaterThan(QT_MAJOR_VERSION, 4): QT += concurrent
CONFIG(static) { CONFIG(static) {
DEFINES += QBT_STATIC_QT DEFINES += QBT_STATIC_QT
QTPLUGIN += qico QTPLUGIN += qico

32
src/webui/btjson.cpp

@ -200,20 +200,20 @@ public:
if (type_ == QVariant::Invalid) if (type_ == QVariant::Invalid)
type_ = torrent1.toMap().value(key_).type(); type_ = torrent1.toMap().value(key_).type();
switch (type_) { switch (static_cast<QMetaType::Type>(type_)) {
case QVariant::Int: case QMetaType::Int:
return greaterThan_ ? torrent1.toMap().value(key_).toInt() > torrent2.toMap().value(key_).toInt() return greaterThan_ ? torrent1.toMap().value(key_).toInt() > torrent2.toMap().value(key_).toInt()
: torrent1.toMap().value(key_).toInt() < torrent2.toMap().value(key_).toInt(); : torrent1.toMap().value(key_).toInt() < torrent2.toMap().value(key_).toInt();
case QVariant::LongLong: case QMetaType::LongLong:
return greaterThan_ ? torrent1.toMap().value(key_).toLongLong() > torrent2.toMap().value(key_).toLongLong() return greaterThan_ ? torrent1.toMap().value(key_).toLongLong() > torrent2.toMap().value(key_).toLongLong()
: torrent1.toMap().value(key_).toLongLong() < torrent2.toMap().value(key_).toLongLong(); : torrent1.toMap().value(key_).toLongLong() < torrent2.toMap().value(key_).toLongLong();
case QVariant::ULongLong: case QMetaType::ULongLong:
return greaterThan_ ? torrent1.toMap().value(key_).toULongLong() > torrent2.toMap().value(key_).toULongLong() return greaterThan_ ? torrent1.toMap().value(key_).toULongLong() > torrent2.toMap().value(key_).toULongLong()
: torrent1.toMap().value(key_).toULongLong() < torrent2.toMap().value(key_).toULongLong(); : torrent1.toMap().value(key_).toULongLong() < torrent2.toMap().value(key_).toULongLong();
case QMetaType::Float: case QMetaType::Float:
return greaterThan_ ? torrent1.toMap().value(key_).toFloat() > torrent2.toMap().value(key_).toFloat() return greaterThan_ ? torrent1.toMap().value(key_).toFloat() > torrent2.toMap().value(key_).toFloat()
: torrent1.toMap().value(key_).toFloat() < torrent2.toMap().value(key_).toFloat(); : torrent1.toMap().value(key_).toFloat() < torrent2.toMap().value(key_).toFloat();
case QVariant::Double: case QMetaType::Double:
return greaterThan_ ? torrent1.toMap().value(key_).toDouble() > torrent2.toMap().value(key_).toDouble() return greaterThan_ ? torrent1.toMap().value(key_).toDouble() > torrent2.toMap().value(key_).toDouble()
: torrent1.toMap().value(key_).toDouble() < torrent2.toMap().value(key_).toDouble(); : torrent1.toMap().value(key_).toDouble() < torrent2.toMap().value(key_).toDouble();
default: default:
@ -652,15 +652,15 @@ void processMap(QVariantMap prevData, QVariantMap data, QVariantMap &syncData)
foreach (QString key, data.keys()) { foreach (QString key, data.keys()) {
removedItems.clear(); removedItems.clear();
switch (data[key].type()) { switch (static_cast<QMetaType::Type>(data[key].type())) {
case QVariant::Map: { case QMetaType::QVariantMap: {
QVariantMap map; QVariantMap map;
processMap(prevData[key].toMap(), data[key].toMap(), map); processMap(prevData[key].toMap(), data[key].toMap(), map);
if (!map.isEmpty()) if (!map.isEmpty())
syncData[key] = map; syncData[key] = map;
} }
break; break;
case QVariant::Hash: { case QMetaType::QVariantHash: {
QVariantMap map; QVariantMap map;
processHash(prevData[key].toHash(), data[key].toHash(), map, removedItems); processHash(prevData[key].toHash(), data[key].toHash(), map, removedItems);
if (!map.isEmpty()) if (!map.isEmpty())
@ -669,7 +669,7 @@ void processMap(QVariantMap prevData, QVariantMap data, QVariantMap &syncData)
syncData[key + KEY_SUFFIX_REMOVED] = removedItems; syncData[key + KEY_SUFFIX_REMOVED] = removedItems;
} }
break; break;
case QVariant::List: { case QMetaType::QVariantList: {
QVariantList list; QVariantList list;
processList(prevData[key].toList(), data[key].toList(), list, removedItems); processList(prevData[key].toList(), data[key].toList(), list, removedItems);
if (!list.isEmpty()) if (!list.isEmpty())
@ -678,14 +678,14 @@ void processMap(QVariantMap prevData, QVariantMap data, QVariantMap &syncData)
syncData[key + KEY_SUFFIX_REMOVED] = removedItems; syncData[key + KEY_SUFFIX_REMOVED] = removedItems;
} }
break; break;
case QVariant::String: case QMetaType::QString:
case QVariant::LongLong: case QMetaType::LongLong:
case QMetaType::Float: case QMetaType::Float:
case QVariant::Int: case QMetaType::Int:
case QVariant::Bool: case QMetaType::Bool:
case QVariant::Double: case QMetaType::Double:
case QVariant::ULongLong: case QMetaType::ULongLong:
case QVariant::UInt: case QMetaType::UInt:
if (prevData[key] != data[key]) if (prevData[key] != data[key])
syncData[key] = data[key]; syncData[key] = data[key];
break; break;

Loading…
Cancel
Save