switched from qsettings to json added editng of actors

This commit is contained in:
Carl Klemm 2019-06-06 21:19:12 +02:00
parent b04fbfb5bc
commit df27b622a0
141 changed files with 4402 additions and 5068 deletions

41
src/items/itemstore.h Normal file
View file

@ -0,0 +1,41 @@
#pragma once
#include <vector>
#include <memory>
#include "item.h"
#include "../sensors/sensor.h"
#include "../microcontroller.h"
#include <QJsonObject>
class ItemStore: public QObject
{
Q_OBJECT
private:
std::vector< std::shared_ptr<Item> > items_;
SensorStore* sensors_;
public:
ItemStore(SensorStore* sensors_ = nullptr, QObject *parent = nullptr);
virtual ~ItemStore(){}
inline std::vector< std::shared_ptr<Item> >* getItems(){ return &items_; }
void store(QJsonObject &json);
void load(const QJsonObject &json, Microcontroller * const micro);
void store(QString subsecton, QSettings* settings);
void load(QString subsecton, QSettings* settings, Microcontroller* micro);
signals:
void itemDeleted(ItemData item);
void itemAdded(std::weak_ptr<Item> Item);
public slots:
void addItem(std::shared_ptr<Item> item);
void addItems(const std::vector<std::shared_ptr<Item>>& itemsIn);
void itemStateChanged(const ItemData& item);
};