#include "settingsservice.h" #include "core-odb.hxx" #include #include SettingsService::SettingsService(QObject *parent) :IService(parent) { } SettingsService::SettingsService(const QString &pluginId, QObject *parent) :IService(parent) { m_pluginId = pluginId; } QSharedPointer SettingsService::loadSystem() { Service srv; QList > sysObj = srv.all("pluginId = '" + m_pluginId + "'"); if (sysObj.isEmpty()) { emit dbErrorUpdate("Error loading sys object"); return QSharedPointer(); } return sysObj[0]; } void SettingsService::saveSystem(const QJsonDocument &doc) { QSharedPointer sysObj = loadSystem(); if (sysObj.isNull()) { emit dbErrorUpdate("Error loading sys object"); return; } sysObj->setSettings(QString(doc.toJson())); Service srv; srv.update(sysObj); }