Bug fixes
This commit is contained in:
@ -36,7 +36,7 @@ MainObject::MainObject(QIODevice* ioDevice, const QString& settingsPathIn, const
|
||||
items.addItem(rgbItem);
|
||||
items.addItem(auxItem);
|
||||
|
||||
connect(&broadCast, &BroadCast::gotJson, this, &MainObject::load);
|
||||
connect(&broadCast, &BroadCast::gotJson, this, &MainObject::recivedJson);
|
||||
connect(&broadCast, &BroadCast::jsonRequested, this, &MainObject::sendJson);
|
||||
|
||||
if(master) load(getJsonObjectFromDisk(settingsPath));
|
||||
@ -68,9 +68,11 @@ void MainObject::store(QJsonObject &json)
|
||||
json.insert("Power", powerObject);
|
||||
}
|
||||
|
||||
void MainObject::load(const QJsonObject json)
|
||||
void MainObject::load(const QJsonObject& json)
|
||||
{
|
||||
items.clear();
|
||||
rgbItem->removeAllActors();
|
||||
auxItem->removeAllActors();
|
||||
items.addItem(rgbItem);
|
||||
items.addItem(auxItem);
|
||||
items.load(json, µ);
|
||||
@ -78,13 +80,18 @@ void MainObject::load(const QJsonObject json)
|
||||
qDebug()<<"aray size: "<<json.isEmpty();
|
||||
if(json["Items"].toArray().size() >= 2)
|
||||
{
|
||||
|
||||
rgbItem->load(json["Items"].toArray()[0].toObject());
|
||||
auxItem->load(json["Items"].toArray()[1].toObject());
|
||||
}
|
||||
micro.requestState();
|
||||
}
|
||||
|
||||
void MainObject::recivedJson(const QJsonObject json)
|
||||
{
|
||||
if(master)storeJsonObjectToDisk(json, settingsPath);
|
||||
load(json);
|
||||
}
|
||||
|
||||
void MainObject::sendJson()
|
||||
{
|
||||
QJsonObject json;
|
||||
|
Reference in New Issue
Block a user