Support item tabs based on item group string
This commit is contained in:
parent
0e09b6f46c
commit
a17cd23a4e
29 changed files with 527 additions and 181 deletions
|
|
@ -34,20 +34,40 @@ void TcpClient::processIncomeingJson(const QByteArray& jsonbytes)
|
|||
if(type == "ItemUpdate")
|
||||
{
|
||||
QJsonArray data = json["Data"].toArray();
|
||||
bool FullList = json["FullList"].toBool(false);
|
||||
std::vector<std::shared_ptr<Item>> items;
|
||||
std::vector<ItemFieldChanges> fieldChanges;
|
||||
for(QJsonValueRef itemjson : data)
|
||||
{
|
||||
QJsonObject jsonobject = itemjson.toObject();
|
||||
std::shared_ptr<Item> item = Item::loadItem(jsonobject);
|
||||
if(item)
|
||||
{
|
||||
qDebug()<<"Client got item"<<item->getName();
|
||||
item->setLoaded(false);
|
||||
item->setLoaded(FullList);
|
||||
fieldChanges.push_back(item->loadWithChanges(jsonobject));
|
||||
items.push_back(item);
|
||||
}
|
||||
}
|
||||
if(!items.empty())
|
||||
gotItems(items, ITEM_UPDATE_REMOTE);
|
||||
if(FullList && !items.empty())
|
||||
{
|
||||
qDebug()<<"Client replaceing items";
|
||||
requestReplaceItems(items);
|
||||
}
|
||||
else if(!items.empty())
|
||||
{
|
||||
std::vector<ItemAddRequest> itemAddRequests;
|
||||
qDebug()<<"Client updateing items";
|
||||
for(size_t i = 0; i < items.size(); i++)
|
||||
{
|
||||
ItemAddRequest request;
|
||||
request.type = ITEM_UPDATE_REMOTE;
|
||||
request.payload = items[i];
|
||||
request.changes = fieldChanges[i];
|
||||
itemAddRequests.push_back(request);
|
||||
qDebug()<<"Payload"<<request.payload->id();
|
||||
}
|
||||
gotItems(itemAddRequests);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue