move from tabs to spaces
This commit is contained in:
@ -29,13 +29,28 @@ public:
|
||||
virtual QString getName() const;
|
||||
|
||||
void setFactorActor(std::shared_ptr<Actor> factorActor);
|
||||
std::shared_ptr<Actor> getFactorActor(){return factorActor_;}
|
||||
void setFactorDirection(const bool direction){factorDirection = direction;}
|
||||
bool getFactorDirection(){return factorDirection;}
|
||||
uint getPreCancleTime(){return preCancleMin_;}
|
||||
void setPreCancleTime(uint minutes){preCancleMin_ = minutes;}
|
||||
std::shared_ptr<Actor> getFactorActor()
|
||||
{
|
||||
return factorActor_;
|
||||
}
|
||||
void setFactorDirection(const bool direction)
|
||||
{
|
||||
factorDirection = direction;
|
||||
}
|
||||
bool getFactorDirection()
|
||||
{
|
||||
return factorDirection;
|
||||
}
|
||||
uint getPreCancleTime()
|
||||
{
|
||||
return preCancleMin_;
|
||||
}
|
||||
void setPreCancleTime(uint minutes)
|
||||
{
|
||||
preCancleMin_ = minutes;
|
||||
}
|
||||
|
||||
virtual ~MultiFactorActor(){}
|
||||
virtual ~MultiFactorActor() {}
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
virtual void load(const QJsonObject& json, bool preserve);
|
||||
|
@ -35,7 +35,8 @@ void PolynomalActor::sensorEvent(Sensor sensor)
|
||||
{
|
||||
if(active && sensor == sensor_)
|
||||
{
|
||||
double result = pow3_*(sensor.field*sensor.field*sensor.field)+pow2_*(sensor.field*sensor.field)+pow1_*sensor.field+pow0_;
|
||||
double result = pow3_*(sensor.field*sensor.field*sensor.field)+pow2_*(sensor.field*sensor.field)+pow1_*sensor.field
|
||||
+pow0_;
|
||||
if(result < 0) result = 0;
|
||||
else if(result > 254) result = 255;
|
||||
if(result != prevValue)sigValue(static_cast<uint8_t>(result));
|
||||
@ -76,7 +77,8 @@ QString PolynomalActor::getName() const
|
||||
else
|
||||
{
|
||||
QString string;
|
||||
string = QString::number(pow3_) + "x^3 + " + QString::number(pow2_) + "x^2 + " + QString::number(pow1_) + "x + " + QString::number(pow0_) + " (x: " + sensor_.name + ")";
|
||||
string = QString::number(pow3_) + "x^3 + " + QString::number(pow2_) + "x^2 + " + QString::number(
|
||||
pow1_) + "x + " + QString::number(pow0_) + " (x: " + sensor_.name + ")";
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,12 @@ public:
|
||||
PolynomalActor(const Sensor sensor, QObject* parent = nullptr);
|
||||
PolynomalActor(QObject* parent = nullptr);
|
||||
void setSensor(const Sensor sensor);
|
||||
Sensor getSensor(){return sensor_;}
|
||||
Sensor getSensor()
|
||||
{
|
||||
return sensor_;
|
||||
}
|
||||
virtual QString getName() const;
|
||||
virtual ~PolynomalActor(){}
|
||||
virtual ~PolynomalActor() {}
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
virtual void load(const QJsonObject& json, bool preserve);
|
||||
|
@ -25,13 +25,22 @@ public slots:
|
||||
|
||||
public:
|
||||
|
||||
float getBand() {return band_;}
|
||||
float getSetPoint() {return setPoint_;}
|
||||
float getBand()
|
||||
{
|
||||
return band_;
|
||||
}
|
||||
float getSetPoint()
|
||||
{
|
||||
return setPoint_;
|
||||
}
|
||||
Regulator(const Sensor sensor, QObject* parent = nullptr);
|
||||
Regulator(QObject* parent = nullptr);
|
||||
Sensor getSensor(){return sensor_;}
|
||||
Sensor getSensor()
|
||||
{
|
||||
return sensor_;
|
||||
}
|
||||
virtual QString getName() const;
|
||||
virtual ~Regulator(){}
|
||||
virtual ~Regulator() {}
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
virtual void load(const QJsonObject& json, bool preserve);
|
||||
|
@ -21,8 +21,10 @@ void SensorActor::sensorEvent(Sensor sensor)
|
||||
{
|
||||
if(sensor == sensor_)
|
||||
{
|
||||
if((sloap_ == SLOPE_UP || sloap_ == SLOPE_BOTH) && sensor_.field < threshold_ && sensor.field >= threshold_ ) performAction();
|
||||
else if((sloap_ == SLOPE_DOWN || sloap_ == SLOPE_BOTH) && sensor_.field > threshold_ && sensor.field <= threshold_) performAction();
|
||||
if((sloap_ == SLOPE_UP || sloap_ == SLOPE_BOTH) && sensor_.field < threshold_
|
||||
&& sensor.field >= threshold_ ) performAction();
|
||||
else if((sloap_ == SLOPE_DOWN || sloap_ == SLOPE_BOTH) && sensor_.field > threshold_
|
||||
&& sensor.field <= threshold_) performAction();
|
||||
sensor_ = sensor;
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,12 @@ public:
|
||||
|
||||
SensorActor(const Sensor sensor, QObject* parent = nullptr);
|
||||
SensorActor(QObject* parent = nullptr);
|
||||
Sensor getSensor(){return sensor_;}
|
||||
Sensor getSensor()
|
||||
{
|
||||
return sensor_;
|
||||
}
|
||||
virtual QString getName() const;
|
||||
virtual ~SensorActor(){}
|
||||
virtual ~SensorActor() {}
|
||||
|
||||
float getThreshold();
|
||||
uint8_t getSloap();
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "alarmactions.h"
|
||||
#include <QProcess>
|
||||
|
||||
AlarmActions::AlarmActions(QApplication* a, Microcontroller* micro, QObject *parent) : QObject(parent), _micro(micro), a_(a)
|
||||
AlarmActions::AlarmActions(QApplication* a, Microcontroller* micro, QObject *parent) : QObject(parent), _micro(micro),
|
||||
a_(a)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ std::vector<uint64_t> connectedDevices(const std::string& ifDevice, int& error)
|
||||
}
|
||||
}
|
||||
|
||||
nla_put_failure:
|
||||
nla_put_failure:
|
||||
nl_cb_put(cb);
|
||||
nl_cb_put(s_cb);
|
||||
nlmsg_free(msg);
|
||||
|
@ -6,14 +6,14 @@
|
||||
|
||||
namespace ap
|
||||
{
|
||||
enum ERRORS
|
||||
{
|
||||
enum ERRORS
|
||||
{
|
||||
SUCESS,
|
||||
ERR_INIT,
|
||||
ERR_NO_DEV,
|
||||
ERR_ALLOC,
|
||||
ERR_GENERAL
|
||||
};
|
||||
std::vector<uint64_t> connectedDevices(const std::string& ifDevice, int& error);
|
||||
std::string macAddrToString(uint64_t macAddr);
|
||||
};
|
||||
std::vector<uint64_t> connectedDevices(const std::string& ifDevice, int& error);
|
||||
std::string macAddrToString(uint64_t macAddr);
|
||||
}
|
||||
|
@ -74,7 +74,8 @@ void BroadCast::decodeMaster(const QByteArray& buffer)
|
||||
void BroadCast::decode(QByteArray buffer)
|
||||
{
|
||||
qDebug()<<"decodeing: "<<buffer;
|
||||
if(buffer.size() >= 6 && buffer[0] == 'J' && buffer[1] == 'S' && buffer[2] == 'O' && buffer[3] == 'N' && buffer[4] == ':')
|
||||
if(buffer.size() >= 6 && buffer[0] == 'J' && buffer[1] == 'S' && buffer[2] == 'O' && buffer[3] == 'N'
|
||||
&& buffer[4] == ':')
|
||||
{
|
||||
qDebug()<<"got json";
|
||||
buffer.remove(0,6);
|
||||
@ -104,7 +105,8 @@ void BroadCast::decode(QByteArray buffer)
|
||||
qDebug()<<error.errorString();
|
||||
}
|
||||
}
|
||||
else if(buffer.size() >= 6 && buffer[0] == 'S' && buffer[1] == 'E' && buffer[2] == 'N' && buffer[3] == 'S' && buffer[4] == 'O' && buffer[5] == 'R')
|
||||
else if(buffer.size() >= 6 && buffer[0] == 'S' && buffer[1] == 'E' && buffer[2] == 'N' && buffer[3] == 'S'
|
||||
&& buffer[4] == 'O' && buffer[5] == 'R')
|
||||
{
|
||||
Sensor sensor = Sensor::sensorFromString(buffer);
|
||||
if(sensor.type != Sensor::TYPE_DUMMY) gotSensorState(sensor);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "auxitem.h"
|
||||
|
||||
AuxItem::AuxItem(Microcontroller* micro, uint32_t itemIdIn, QString name, uint8_t value, QObject* parent): Item(itemIdIn, name, value, parent), micro_(micro)
|
||||
AuxItem::AuxItem(Microcontroller* micro, uint32_t itemIdIn, QString name, uint8_t value,
|
||||
QObject* parent): Item(itemIdIn, name, value, parent), micro_(micro)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ public slots:
|
||||
virtual void setValue(uint8_t value);
|
||||
|
||||
public:
|
||||
AuxItem(Microcontroller* micro, uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "", uint8_t value = 0, QObject* parent = nullptr);
|
||||
AuxItem(Microcontroller* micro, uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "",
|
||||
uint8_t value = 0, QObject* parent = nullptr);
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
};
|
||||
|
@ -38,7 +38,8 @@ uint32_t ItemData::id() const
|
||||
|
||||
bool Item::secondaryFlag = false;
|
||||
|
||||
Item::Item(uint32_t itemIdIn, QString name, uint8_t value, QObject *parent): QObject(parent), ItemData (itemIdIn, name, value)
|
||||
Item::Item(uint32_t itemIdIn, QString name, uint8_t value, QObject *parent): QObject(parent), ItemData (itemIdIn, name,
|
||||
value)
|
||||
{
|
||||
|
||||
}
|
||||
@ -122,7 +123,8 @@ void Item::addActor(std::shared_ptr<Actor> actor)
|
||||
if(regulator)connect(&globalSensors, &SensorStore::sensorChangedState, regulator.get(), &Regulator::sensorEvent);
|
||||
|
||||
std::shared_ptr<PolynomalActor> polynomalActor = std::dynamic_pointer_cast<PolynomalActor>(actor);
|
||||
if(polynomalActor != nullptr )connect(&globalSensors, &SensorStore::sensorChangedState, polynomalActor.get(), &PolynomalActor::sensorEvent);
|
||||
if(polynomalActor != nullptr )connect(&globalSensors, &SensorStore::sensorChangedState, polynomalActor.get(),
|
||||
&PolynomalActor::sensorEvent);
|
||||
}
|
||||
|
||||
bool Item::removeActor(std::shared_ptr<Actor> actor)
|
||||
|
@ -19,8 +19,14 @@ public:
|
||||
|
||||
ItemData(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "Item", uint8_t value = 0);
|
||||
|
||||
inline bool operator==(const ItemData& in) const{ return itemId_==in.itemId_; }
|
||||
inline bool operator!=(const ItemData& in) const{ return itemId_!=in.itemId_; }
|
||||
inline bool operator==(const ItemData& in) const
|
||||
{
|
||||
return itemId_==in.itemId_;
|
||||
}
|
||||
inline bool operator!=(const ItemData& in) const
|
||||
{
|
||||
return itemId_!=in.itemId_;
|
||||
}
|
||||
|
||||
uint32_t id() const;
|
||||
|
||||
@ -55,7 +61,8 @@ public slots:
|
||||
|
||||
public:
|
||||
|
||||
Item(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "Item", uint8_t value = 0, QObject *parent = nullptr);
|
||||
Item(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "Item", uint8_t value = 0,
|
||||
QObject *parent = nullptr);
|
||||
Item(const ItemData& itemData, QObject *parent = nullptr);
|
||||
|
||||
virtual ~Item();
|
||||
|
@ -15,9 +15,12 @@ private:
|
||||
public:
|
||||
|
||||
ItemStore(QObject *parent = nullptr);
|
||||
virtual ~ItemStore(){}
|
||||
virtual ~ItemStore() {}
|
||||
|
||||
inline std::vector< std::shared_ptr<Item> >* getItems(){ return &items_; }
|
||||
inline std::vector< std::shared_ptr<Item> >* getItems()
|
||||
{
|
||||
return &items_;
|
||||
}
|
||||
|
||||
void store(QJsonObject &json);
|
||||
void load(const QJsonObject &json);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
class MessageItem : public Item
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
private:
|
||||
|
||||
QString message_;
|
||||
@ -28,7 +28,8 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
MessageItem(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "Item", uint8_t value = 0, QObject *parent = nullptr);
|
||||
MessageItem(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "Item", uint8_t value = 0,
|
||||
QObject *parent = nullptr);
|
||||
MessageItem(const ItemData& itemData, QObject *parent = nullptr);
|
||||
~MessageItem();
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
PowerItem::PowerItem(uint32_t itemIdIn, QString name, uint8_t value, QObject* parent): Item(itemIdIn, name, value, parent)
|
||||
PowerItem::PowerItem(uint32_t itemIdIn, QString name, uint8_t value, QObject* parent): Item(itemIdIn, name, value,
|
||||
parent)
|
||||
{
|
||||
stateChanged(Sensor(Sensor::TYPE_SHUTDOWN_IMMINENT, 0, 0, "Shutdown Imminent", true));
|
||||
setValue(true);
|
||||
|
@ -24,7 +24,11 @@ public slots:
|
||||
virtual void setValue(uint8_t value);
|
||||
|
||||
public:
|
||||
PowerItem(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "", uint8_t value = 0, QObject* parent = nullptr);
|
||||
void emmitSensor(){stateChanged(Sensor(Sensor::TYPE_SHUTDOWN_IMMINENT, 0, 0, "Shutdown Imminent", true));}
|
||||
PowerItem(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "", uint8_t value = 0,
|
||||
QObject* parent = nullptr);
|
||||
void emmitSensor()
|
||||
{
|
||||
stateChanged(Sensor(Sensor::TYPE_SHUTDOWN_IMMINENT, 0, 0, "Shutdown Imminent", true));
|
||||
}
|
||||
virtual void store(QJsonObject& json);
|
||||
};
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
Microcontroller* Relay::micro_ = nullptr;
|
||||
|
||||
Relay::Relay(uint8_t id, QString name, uint16_t address, bool state, QObject* parent): Item(0, name, state, parent), id_(id), address_(address)
|
||||
Relay::Relay(uint8_t id, QString name, uint16_t address, bool state, QObject* parent): Item(0, name, state, parent),
|
||||
id_(id), address_(address)
|
||||
{
|
||||
itemId_ = address | ((uint32_t)id << 16);
|
||||
qDebug()<<"Relay "<<id_<<"Name "<<name<<" id "<<itemId_<<" state "<<state<<" addr: "<<address;
|
||||
|
@ -32,7 +32,10 @@ public:
|
||||
uint8_t getId() const;
|
||||
void setId(uint8_t id);
|
||||
|
||||
inline static void setMicrocontroller(Microcontroller* micro){ micro_ = micro; }
|
||||
inline static void setMicrocontroller(Microcontroller* micro)
|
||||
{
|
||||
micro_ = micro;
|
||||
}
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
virtual void load(const QJsonObject& json, const bool preserve = false);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "rgbitem.h"
|
||||
|
||||
RgbItem::RgbItem(Microcontroller* micro, uint32_t itemIdIn, QString name, uint8_t value, QObject* parent): Item(itemIdIn, name, value, parent), micro_(micro)
|
||||
RgbItem::RgbItem(Microcontroller* micro, uint32_t itemIdIn, QString name, uint8_t value,
|
||||
QObject* parent): Item(itemIdIn, name, value, parent), micro_(micro)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ public slots:
|
||||
virtual void setValue(uint8_t value);
|
||||
|
||||
public:
|
||||
RgbItem(Microcontroller* micro, uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "", uint8_t value = 0, QObject* parent = nullptr);
|
||||
RgbItem(Microcontroller* micro, uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "",
|
||||
uint8_t value = 0, QObject* parent = nullptr);
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
};
|
||||
|
@ -7,13 +7,13 @@ void SystemItem::setValue(uint8_t value)
|
||||
}
|
||||
|
||||
SystemItem::SystemItem(uint32_t itemIdIn, QString name, uint8_t value, QObject *parent):
|
||||
Item(itemIdIn, name, value, parent)
|
||||
Item(itemIdIn, name, value, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SystemItem::SystemItem(const ItemData& itemData, QObject *parent):
|
||||
Item(itemData, parent)
|
||||
Item(itemData, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
class SystemItem : public Item
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
private:
|
||||
|
||||
QString onCommand_;
|
||||
@ -18,14 +18,21 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
SystemItem(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "Item", uint8_t value = 0, QObject *parent = nullptr);
|
||||
SystemItem(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "Item", uint8_t value = 0,
|
||||
QObject *parent = nullptr);
|
||||
SystemItem(const ItemData& itemData, QObject *parent = nullptr);
|
||||
~SystemItem() = default;
|
||||
|
||||
void setOnCommand(const QString& in);
|
||||
void setOffCommand(const QString& in);
|
||||
QString getOnCommand(){return onCommand_;}
|
||||
QString getOffCommand(){return offCommand_;}
|
||||
QString getOnCommand()
|
||||
{
|
||||
return onCommand_;
|
||||
}
|
||||
QString getOffCommand()
|
||||
{
|
||||
return offCommand_;
|
||||
}
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
virtual void load(const QJsonObject& json, const bool preserve = false);
|
||||
|
34
src/main.cpp
34
src/main.cpp
@ -41,31 +41,36 @@ int main(int argc, char *argv[])
|
||||
QDir::setCurrent(a.applicationDirPath());
|
||||
|
||||
//parse comand line
|
||||
#ifndef Q_OS_ANDROID
|
||||
#ifndef Q_OS_ANDROID
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("Smart Home Interface");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
QCommandLineOption tcpOption(QStringList() << "t" << "tcp", QCoreApplication::translate("main", "Use Tcp connection"));
|
||||
parser.addOption(tcpOption);
|
||||
QCommandLineOption hostOption(QStringList() << "H" << "host", QCoreApplication::translate("main", "Set server host ip addres"), "adress");
|
||||
QCommandLineOption hostOption(QStringList() << "H" << "host", QCoreApplication::translate("main",
|
||||
"Set server host ip addres"), "adress");
|
||||
parser.addOption(hostOption);
|
||||
QCommandLineOption portOption(QStringList() << "p" << "port", QCoreApplication::translate("main", "Set server Port in TCP mode or Serial port in serial mode"), "port");
|
||||
QCommandLineOption portOption(QStringList() << "p" << "port", QCoreApplication::translate("main",
|
||||
"Set server Port in TCP mode or Serial port in serial mode"), "port");
|
||||
parser.addOption(portOption);
|
||||
QCommandLineOption serialOption(QStringList() << "s" << "serial", QCoreApplication::translate("main", "Use serial connection"));
|
||||
QCommandLineOption serialOption(QStringList() << "s" << "serial", QCoreApplication::translate("main",
|
||||
"Use serial connection"));
|
||||
parser.addOption(serialOption);
|
||||
QCommandLineOption baudOption(QStringList() << "b" << "baud", QCoreApplication::translate("main", "Set Baud Rate"));
|
||||
parser.addOption(baudOption);
|
||||
QCommandLineOption settingsPathOption(QStringList() << "c" << "config", QCoreApplication::translate("main", "Set config file"), "configFilePath");
|
||||
QCommandLineOption settingsPathOption(QStringList() << "c" << "config", QCoreApplication::translate("main",
|
||||
"Set config file"), "configFilePath");
|
||||
parser.addOption(settingsPathOption);
|
||||
QCommandLineOption secondaryOption(QStringList() << "e" << "secondary", QCoreApplication::translate("main", "Set if instance is not main instance"));
|
||||
QCommandLineOption secondaryOption(QStringList() << "e" << "secondary", QCoreApplication::translate("main",
|
||||
"Set if instance is not main instance"));
|
||||
parser.addOption(secondaryOption);
|
||||
parser.process(a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
QIODevice* masterIODevice = nullptr;
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
#ifndef Q_OS_ANDROID
|
||||
if(parser.isSet(tcpOption))
|
||||
{
|
||||
QTcpSocket* microSocket = new QTcpSocket;
|
||||
@ -94,13 +99,15 @@ int main(int argc, char *argv[])
|
||||
if(parser.isSet(portOption)) microPort->setBaudRate(parser.value(baudOption).toInt());
|
||||
else microPort->setBaudRate(BAUD);
|
||||
|
||||
if(!microPort->open(QIODevice::ReadWrite)) std::cout<<"Can not open serial port "<<microPort->portName().toStdString()<<". Continueing in demo mode"<<'\n';
|
||||
if(!microPort->open(QIODevice::ReadWrite)) std::cout<<"Can not open serial port "<<microPort->portName().toStdString()
|
||||
<<". Continueing in demo mode"<<'\n';
|
||||
masterIODevice = microPort;
|
||||
}
|
||||
|
||||
MainObject mainObject(masterIODevice, parser.isSet(settingsPathOption) ? parser.value(settingsPathOption) : "", !parser.isSet(secondaryOption));
|
||||
MainObject mainObject(masterIODevice, parser.isSet(settingsPathOption) ? parser.value(settingsPathOption) : "",
|
||||
!parser.isSet(secondaryOption));
|
||||
|
||||
#else
|
||||
#else
|
||||
QTcpSocket* microSocket = new QTcpSocket;
|
||||
microSocket->connectToHost("10.0.0.1", 6856, QIODevice::ReadWrite);
|
||||
if(!microSocket->waitForConnected(1000))
|
||||
@ -110,8 +117,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
masterIODevice = microSocket;
|
||||
|
||||
MainObject mainObject(masterIODevice, parser.isSet(settingsPathOption) ? parser.value(settingsPathOption) : "", !parser.isSet(secondaryOption));
|
||||
#endif
|
||||
MainObject mainObject(masterIODevice, parser.isSet(settingsPathOption) ? parser.value(settingsPathOption) : "",
|
||||
!parser.isSet(secondaryOption));
|
||||
#endif
|
||||
|
||||
|
||||
//mainwindow
|
||||
|
@ -49,9 +49,9 @@ MainObject::MainObject(QIODevice* ioDevice, const QString& settingsPathIn, const
|
||||
broadCast.requestSensors();
|
||||
}
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
#ifndef Q_OS_ANDROID
|
||||
Item::secondaryFlag = !master;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
MainObject::~MainObject()
|
||||
@ -120,10 +120,10 @@ QJsonObject MainObject::getJsonObjectFromDisk(const QString& filePath, bool* err
|
||||
{
|
||||
QFile file;
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
#ifndef Q_OS_ANDROID
|
||||
if(filePath.size() > 0) file.setFileName(filePath);
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
file.setFileName(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/shinterface.json");
|
||||
}
|
||||
@ -147,9 +147,9 @@ QJsonObject MainObject::getJsonObjectFromDisk(const QString& filePath, bool* err
|
||||
|
||||
bool MainObject::storeJsonObjectToDisk(const QJsonObject& json, QString filePath)
|
||||
{
|
||||
#ifndef Q_OS_ANDROID
|
||||
#ifndef Q_OS_ANDROID
|
||||
if(filePath.size() == 0)
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
filePath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/shinterface.json";
|
||||
}
|
||||
|
@ -41,10 +41,10 @@ void Microcontroller::changeRgbColor(const QColor color)
|
||||
int length = sprintf(buffer, "rgb set %03d %03d %03d\n", color.red(), color.green(), color.blue());
|
||||
write(buffer, length);
|
||||
std::cout<<buffer;
|
||||
}
|
||||
}
|
||||
|
||||
void Microcontroller::setAuxPwm(int duty)
|
||||
{
|
||||
void Microcontroller::setAuxPwm(int duty)
|
||||
{
|
||||
char buffer[64];
|
||||
int length = sprintf(buffer, "aux set %03d\n", duty );
|
||||
write(buffer, length);
|
||||
@ -52,9 +52,9 @@ void Microcontroller::changeRgbColor(const QColor color)
|
||||
|
||||
void Microcontroller::write(const QByteArray& buffer)
|
||||
{
|
||||
#ifndef Q_OS_ANDROID
|
||||
#ifndef Q_OS_ANDROID
|
||||
if constexpr(debug) std::cerr<<buffer.data();
|
||||
#endif
|
||||
#endif
|
||||
if(_port != nullptr)
|
||||
{
|
||||
_port->write(buffer);
|
||||
@ -65,9 +65,9 @@ void Microcontroller::write(const QByteArray& buffer)
|
||||
|
||||
void Microcontroller::write(char* buffer, const size_t length)
|
||||
{
|
||||
#ifndef Q_OS_ANDROID
|
||||
#ifndef Q_OS_ANDROID
|
||||
if constexpr(debug) std::cerr<<buffer;
|
||||
#endif
|
||||
#endif
|
||||
if(_port != nullptr)
|
||||
{
|
||||
_port->write(buffer, length);
|
||||
@ -130,7 +130,8 @@ std::shared_ptr<Relay> Microcontroller::processRelayLine(const QString& buffer)
|
||||
for(int i = 10; i < bufferList.size(); i++) name.append(bufferList[i] + ' ');
|
||||
if(name.size() > 1)name.remove(name.size()-1, 1);
|
||||
else name = "Relay " + QString::number(bufferList[1].toInt(nullptr, 2));
|
||||
return std::shared_ptr<Relay>( new Relay(bufferList[2].toInt(), name, bufferList[4].toInt(nullptr, 2), bufferList[8].toInt()));
|
||||
return std::shared_ptr<Relay>( new Relay(bufferList[2].toInt(), name, bufferList[4].toInt(nullptr, 2),
|
||||
bufferList[8].toInt()));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include "../apgetconnected.h"
|
||||
|
||||
|
||||
OcupancySensorSource::OcupancySensorSource(QObject *parent, const QString& device, const QString& deviceMac): QObject (parent), deviceMac_(deviceMac), device_(device)
|
||||
OcupancySensorSource::OcupancySensorSource(QObject *parent, const QString& device,
|
||||
const QString& deviceMac): QObject (parent), deviceMac_(deviceMac), device_(device)
|
||||
{
|
||||
QTimer::singleShot(timeoutMs, this, &OcupancySensorSource::Timeout);
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ private:
|
||||
static constexpr unsigned timeoutMs = (15 * 60) * 1000;
|
||||
|
||||
public:
|
||||
explicit OcupancySensorSource(QObject *parent = nullptr, const QString& device = "wlan0", const QString& deviceMac = "60:BE:B5:25:8C:E0");
|
||||
explicit OcupancySensorSource(QObject *parent = nullptr, const QString& device = "wlan0",
|
||||
const QString& deviceMac = "60:BE:B5:25:8C:E0");
|
||||
|
||||
void store(QJsonObject& json);
|
||||
void load(const QJsonObject& json);
|
||||
|
@ -30,7 +30,8 @@ public:
|
||||
QDateTime lastSeen;
|
||||
bool hidden;
|
||||
|
||||
Sensor(uint8_t typeIn, uint8_t idIn, float fieldIn = 0, QString nameIn = "", bool hiddenIn = false): type(typeIn), id(idIn), field(fieldIn), name(nameIn), hidden(hiddenIn)
|
||||
Sensor(uint8_t typeIn, uint8_t idIn, float fieldIn = 0, QString nameIn = "", bool hiddenIn = false): type(typeIn),
|
||||
id(idIn), field(fieldIn), name(nameIn), hidden(hiddenIn)
|
||||
{
|
||||
lastSeen = QDateTime::currentDateTime();
|
||||
if(nameIn == "") generateName();
|
||||
@ -39,9 +40,18 @@ public:
|
||||
{
|
||||
lastSeen = QDateTime::currentDateTime();
|
||||
}
|
||||
inline bool operator==(const Sensor& in) const{ return type==in.type && id == in.id; }
|
||||
inline bool operator!=(const Sensor& in) const{ return !(*this==in); }
|
||||
inline void updateSeen(){lastSeen = QDateTime::currentDateTime();}
|
||||
inline bool operator==(const Sensor& in) const
|
||||
{
|
||||
return type==in.type && id == in.id;
|
||||
}
|
||||
inline bool operator!=(const Sensor& in) const
|
||||
{
|
||||
return !(*this==in);
|
||||
}
|
||||
inline void updateSeen()
|
||||
{
|
||||
lastSeen = QDateTime::currentDateTime();
|
||||
}
|
||||
static Sensor sensorFromString(const QString& str)
|
||||
{
|
||||
QStringList bufferList = str.split(' ');
|
||||
@ -80,9 +90,12 @@ private:
|
||||
public:
|
||||
|
||||
SensorStore(QObject *parent = nullptr);
|
||||
virtual ~SensorStore(){}
|
||||
virtual ~SensorStore() {}
|
||||
|
||||
inline std::vector<Sensor>* getSensors(){ return &sensors_; }
|
||||
inline std::vector<Sensor>* getSensors()
|
||||
{
|
||||
return &sensors_;
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
|
21
src/sun.cpp
21
src/sun.cpp
@ -63,7 +63,8 @@ std::time_t Sun::JdTime::toStdTime()
|
||||
return millenniumTime;
|
||||
}
|
||||
|
||||
Sun::Sun(double latitude, double longitude, double altitude): latitude_(latitude), longetude_(longitude), altitude_(altitude)
|
||||
Sun::Sun(double latitude, double longitude, double altitude): latitude_(latitude), longetude_(longitude),
|
||||
altitude_(altitude)
|
||||
{}
|
||||
|
||||
double Sun::nextMeanSolarNoonJD(const JdTime& time)
|
||||
@ -78,7 +79,8 @@ double Sun::meanSolarAnomaly(double meanSolarNoon)
|
||||
|
||||
double Sun::eqOfCenter(double meanSolarAnomaly)
|
||||
{
|
||||
return 1.9148*sin(meanSolarAnomaly*TO_RADS) + 0.0200*sin(2*meanSolarAnomaly*TO_RADS) + 0.0003*sin(3*meanSolarAnomaly*TO_RADS);
|
||||
return 1.9148*sin(meanSolarAnomaly*TO_RADS) + 0.0200*sin(2*meanSolarAnomaly*TO_RADS) + 0.0003*sin(
|
||||
3*meanSolarAnomaly*TO_RADS);
|
||||
}
|
||||
|
||||
double Sun::eclipticLongitude(double eqOfCenter, double meanSolarAnomaly)
|
||||
@ -108,7 +110,8 @@ double Sun::hourAngle(double localSolarTime)
|
||||
|
||||
double Sun::hourAngleAtSunset(double solarDeclination)
|
||||
{
|
||||
return TO_DEGS*acos((sin((-0.83-(2.076*sqrt(altitude_)/60.0))*TO_RADS) - sin(solarDeclination*TO_RADS)*sin(latitude_*TO_RADS))/(cos(latitude_*TO_RADS)*cos(solarDeclination*TO_RADS)));
|
||||
return TO_DEGS*acos((sin((-0.83-(2.076*sqrt(altitude_)/60.0))*TO_RADS) - sin(solarDeclination*TO_RADS)*sin(
|
||||
latitude_*TO_RADS))/(cos(latitude_*TO_RADS)*cos(solarDeclination*TO_RADS)));
|
||||
}
|
||||
|
||||
double Sun::altitude()
|
||||
@ -120,7 +123,8 @@ double Sun::altitude()
|
||||
double localSolarTimeValue = localSolarTime(time, equationOfTime(meanSolarAnomalyValue, eclipticLongitudeValue));
|
||||
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
||||
|
||||
double cosZenithAngle = sin(latitude_*TO_RADS)*sin(declinationValue*TO_RADS)+cos(latitude_*TO_RADS)*cos(declinationValue*TO_RADS)*cos(hourAngle(localSolarTimeValue)*TO_RADS);
|
||||
double cosZenithAngle = sin(latitude_*TO_RADS)*sin(declinationValue*TO_RADS)+cos(latitude_*TO_RADS)*cos(
|
||||
declinationValue*TO_RADS)*cos(hourAngle(localSolarTimeValue)*TO_RADS);
|
||||
|
||||
return TO_DEGS*asin(cosZenithAngle);
|
||||
}
|
||||
@ -133,7 +137,8 @@ double Sun::maximumAltitude()
|
||||
double eclipticLongitudeValue = eclipticLongitude(eqOfCenter(meanSolarAnomalyValue), meanSolarAnomalyValue);
|
||||
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
||||
|
||||
double cosZenithAngle = sin(latitude_*TO_RADS)*sin(declinationValue*TO_RADS)+cos(latitude_*TO_RADS)*cos(declinationValue*TO_RADS);
|
||||
double cosZenithAngle = sin(latitude_*TO_RADS)*sin(declinationValue*TO_RADS)+cos(latitude_*TO_RADS)*cos(
|
||||
declinationValue*TO_RADS);
|
||||
|
||||
return TO_DEGS*asin(cosZenithAngle);
|
||||
}
|
||||
@ -153,7 +158,8 @@ std::time_t Sun::riseTime()
|
||||
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
||||
double hourAngleValue = hourAngleAtSunset(declinationValue);
|
||||
|
||||
time.julianDate = meanSolarNoonValue + equationOfTime(meanSolarAnomalyValue, eclipticLongitudeValue) - hourAngleValue/360.0;
|
||||
time.julianDate = meanSolarNoonValue + equationOfTime(meanSolarAnomalyValue,
|
||||
eclipticLongitudeValue) - hourAngleValue/360.0;
|
||||
|
||||
return time.toStdTime();
|
||||
}
|
||||
@ -166,7 +172,8 @@ std::time_t Sun::setTime()
|
||||
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
||||
double hourAngleValue = hourAngleAtSunset(declinationValue);
|
||||
|
||||
time.julianDate = meanSolarNoonValue + equationOfTime(meanSolarAnomalyValue, eclipticLongitudeValue) + hourAngleValue/360.0;
|
||||
time.julianDate = meanSolarNoonValue + equationOfTime(meanSolarAnomalyValue,
|
||||
eclipticLongitudeValue) + hourAngleValue/360.0;
|
||||
|
||||
return time.toStdTime();
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ ActorSettingsDialog::ActorSettingsDialog(std::shared_ptr<AlarmTime> alarm, QWidg
|
||||
}
|
||||
|
||||
ActorSettingsDialog::ActorSettingsDialog(std::shared_ptr<SensorActor> actor, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
{
|
||||
init();
|
||||
|
||||
@ -38,9 +38,9 @@ ActorSettingsDialog::ActorSettingsDialog(std::shared_ptr<Regulator> actor, QWidg
|
||||
}
|
||||
|
||||
ActorSettingsDialog::ActorSettingsDialog(std::shared_ptr<TimerActor> actor, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
{
|
||||
init();
|
||||
|
||||
@ -49,9 +49,9 @@ ui(new Ui::ActorSettingsDialog)
|
||||
}
|
||||
|
||||
ActorSettingsDialog::ActorSettingsDialog(std::shared_ptr<PolynomalActor> actor, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
{
|
||||
init();
|
||||
|
||||
@ -60,9 +60,9 @@ ui(new Ui::ActorSettingsDialog)
|
||||
}
|
||||
|
||||
ActorSettingsDialog::ActorSettingsDialog(std::shared_ptr<MultiFactorActor> actor, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
{
|
||||
init();
|
||||
widget = new FactorActorWidget(actor, this);
|
||||
@ -70,9 +70,9 @@ ui(new Ui::ActorSettingsDialog)
|
||||
}
|
||||
|
||||
ActorSettingsDialog::ActorSettingsDialog(std::shared_ptr<Actor> actor, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
QDialog(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::ActorSettingsDialog)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include "actorwidgets/polynomalactorwidget.h"
|
||||
#include "actorwidgets/factoractorwidget.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class ActorSettingsDialog;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <memory>
|
||||
#include "../../actors/alarmtime.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class AlarmWidget;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include <QWidget>
|
||||
#include "../../actors/factoractor.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class FactorActorWidget;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "polynomalactorwidget.h"
|
||||
#include "ui_polynomalactorwidget.h"
|
||||
|
||||
PolynomalActorWidget::PolynomalActorWidget(std::shared_ptr<PolynomalActor> actor, SensorStore* sensors, QWidget *parent):
|
||||
PolynomalActorWidget::PolynomalActorWidget(std::shared_ptr<PolynomalActor> actor, SensorStore* sensors,
|
||||
QWidget *parent):
|
||||
QWidget(parent),
|
||||
sensors_(sensors),
|
||||
actor_(actor),
|
||||
@ -39,7 +40,8 @@ PolynomalActorWidget::~PolynomalActorWidget()
|
||||
|
||||
void PolynomalActorWidget::setPow()
|
||||
{
|
||||
actor_->setCoeffiancts(ui->doubleSpinBox_pow3->value(), ui->doubleSpinBox_pow2->value(), ui->doubleSpinBox_pow1->value(), ui->doubleSpinBox_pow0->value());
|
||||
actor_->setCoeffiancts(ui->doubleSpinBox_pow3->value(), ui->doubleSpinBox_pow2->value(),
|
||||
ui->doubleSpinBox_pow1->value(), ui->doubleSpinBox_pow0->value());
|
||||
}
|
||||
|
||||
void PolynomalActorWidget::setSensor(const QModelIndex &index)
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include <QWidget>
|
||||
#include "../../actors/polynomalactor.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class PolynomalActorWidget;
|
||||
}
|
||||
|
||||
@ -15,7 +16,8 @@ class PolynomalActorWidget : public QWidget
|
||||
std::shared_ptr<PolynomalActor> actor_;
|
||||
|
||||
public:
|
||||
explicit PolynomalActorWidget(std::shared_ptr<PolynomalActor> regulator, SensorStore* sensors = nullptr, QWidget *parent = nullptr);
|
||||
explicit PolynomalActorWidget(std::shared_ptr<PolynomalActor> regulator, SensorStore* sensors = nullptr,
|
||||
QWidget *parent = nullptr);
|
||||
~PolynomalActorWidget();
|
||||
|
||||
private slots:
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include <QWidget>
|
||||
#include "../../actors/regulator.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class RegulatorWdiget;
|
||||
}
|
||||
|
||||
@ -16,7 +17,8 @@ class RegulatorWdiget : public QWidget
|
||||
SensorStore* sensors_;
|
||||
|
||||
public:
|
||||
explicit RegulatorWdiget(std::shared_ptr<Regulator> regulator, SensorStore* sensors = nullptr, QWidget *parent = nullptr);
|
||||
explicit RegulatorWdiget(std::shared_ptr<Regulator> regulator, SensorStore* sensors = nullptr,
|
||||
QWidget *parent = nullptr);
|
||||
~RegulatorWdiget();
|
||||
|
||||
private slots:
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <QItemSelection>
|
||||
#include "../../actors/sensoractor.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class SensorActorWidget;
|
||||
}
|
||||
|
||||
@ -17,7 +18,8 @@ class SensorActorWidget : public QWidget
|
||||
SensorStore* sensors_;
|
||||
|
||||
public:
|
||||
explicit SensorActorWidget(std::shared_ptr<SensorActor> sensorActor, SensorStore* sensors = nullptr, QWidget *parent = nullptr);
|
||||
explicit SensorActorWidget(std::shared_ptr<SensorActor> sensorActor, SensorStore* sensors = nullptr,
|
||||
QWidget *parent = nullptr);
|
||||
~SensorActorWidget();
|
||||
|
||||
private slots:
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include <QWidget>
|
||||
#include "../../actors/timeractor.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class TimerActorWidget;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <memory>
|
||||
#include "../items/item.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class ItemCreationDialog;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,8 @@
|
||||
#include "../items/itemstore.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class RelayScrollBox;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "itemsettingsdialog.h"
|
||||
#include "itemsettingsdialog.h"
|
||||
#include "ui_itemsettingsdialog.h"
|
||||
#include "actorsettingsdialog.h"
|
||||
#include "../actors/alarmtime.h"
|
||||
|
@ -6,7 +6,8 @@
|
||||
#include <memory>
|
||||
#include "../items/relay.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class ItemSettingsDialog;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,10 @@ MessageItemSettingsWidget::MessageItemSettingsWidget(std::weak_ptr<MessageItem>
|
||||
|
||||
connect(ui->lineEdit, &QLineEdit::textChanged, this, &MessageItemSettingsWidget::setText);
|
||||
connect(ui->lineEdit_alert, &QLineEdit::textChanged, this, &MessageItemSettingsWidget::setAlert);
|
||||
connect(ui->pushButton, &QPushButton::pressed, [this](){ui->lineEdit_alert->setText(QFileDialog::getOpenFileName(this, "Choose File"));});
|
||||
connect(ui->pushButton, &QPushButton::pressed, [this]()
|
||||
{
|
||||
ui->lineEdit_alert->setText(QFileDialog::getOpenFileName(this, "Choose File"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <memory>
|
||||
#include "../../items/messageitem.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class MessageItemSettingsWidget;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <memory>
|
||||
#include "../../items/relay.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class RelayItemSettingsWidget;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <memory>
|
||||
#include "../../items/systemitem.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class SystemItemSettingsWidget;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,8 @@
|
||||
#include "itemsettingsdialog.h"
|
||||
#include "../items/item.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class ItemWidget;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include <QHeaderView>
|
||||
#include <QScroller>
|
||||
|
||||
SensorListWidget::SensorListWidget(const bool showHidden, QWidget *parent): QTableWidget(parent), showHidden_(showHidden)
|
||||
SensorListWidget::SensorListWidget(const bool showHidden, QWidget *parent): QTableWidget(parent),
|
||||
showHidden_(showHidden)
|
||||
{
|
||||
setColumnCount(2);
|
||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
@ -16,7 +17,8 @@ SensorListWidget::SensorListWidget(const bool showHidden, QWidget *parent): QTab
|
||||
setHorizontalHeaderItem(1, new QTableWidgetItem("Value"));
|
||||
}
|
||||
|
||||
SensorListWidget::SensorListWidget(SensorStore& sensorStore, const bool showHidden, QWidget* parent): QTableWidget (parent), showHidden_(showHidden)
|
||||
SensorListWidget::SensorListWidget(SensorStore& sensorStore, const bool showHidden,
|
||||
QWidget* parent): QTableWidget (parent), showHidden_(showHidden)
|
||||
{
|
||||
sensorsChanged(*(sensorStore.getSensors()));
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
|
||||
SensorListWidget(const bool showHidden = true, QWidget *parent = nullptr);
|
||||
SensorListWidget(SensorStore& sensorStore, const bool showHidden = true, QWidget* parent = nullptr);
|
||||
virtual ~SensorListWidget(){}
|
||||
virtual ~SensorListWidget() {}
|
||||
void setShowHidden(const bool showHidden);
|
||||
|
||||
public slots:
|
||||
|
Reference in New Issue
Block a user