move from tabs to spaces
This commit is contained in:
@ -29,11 +29,26 @@ public:
|
|||||||
virtual QString getName() const;
|
virtual QString getName() const;
|
||||||
|
|
||||||
void setFactorActor(std::shared_ptr<Actor> factorActor);
|
void setFactorActor(std::shared_ptr<Actor> factorActor);
|
||||||
std::shared_ptr<Actor> getFactorActor(){return factorActor_;}
|
std::shared_ptr<Actor> getFactorActor()
|
||||||
void setFactorDirection(const bool direction){factorDirection = direction;}
|
{
|
||||||
bool getFactorDirection(){return factorDirection;}
|
return factorActor_;
|
||||||
uint getPreCancleTime(){return preCancleMin_;}
|
}
|
||||||
void setPreCancleTime(uint minutes){preCancleMin_ = minutes;}
|
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() {}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ void PolynomalActor::sensorEvent(Sensor sensor)
|
|||||||
{
|
{
|
||||||
if(active && 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;
|
if(result < 0) result = 0;
|
||||||
else if(result > 254) result = 255;
|
else if(result > 254) result = 255;
|
||||||
if(result != prevValue)sigValue(static_cast<uint8_t>(result));
|
if(result != prevValue)sigValue(static_cast<uint8_t>(result));
|
||||||
@ -76,7 +77,8 @@ QString PolynomalActor::getName() const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString string;
|
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;
|
return string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,10 @@ public:
|
|||||||
PolynomalActor(const Sensor sensor, QObject* parent = nullptr);
|
PolynomalActor(const Sensor sensor, QObject* parent = nullptr);
|
||||||
PolynomalActor(QObject* parent = nullptr);
|
PolynomalActor(QObject* parent = nullptr);
|
||||||
void setSensor(const Sensor sensor);
|
void setSensor(const Sensor sensor);
|
||||||
Sensor getSensor(){return sensor_;}
|
Sensor getSensor()
|
||||||
|
{
|
||||||
|
return sensor_;
|
||||||
|
}
|
||||||
virtual QString getName() const;
|
virtual QString getName() const;
|
||||||
virtual ~PolynomalActor() {}
|
virtual ~PolynomalActor() {}
|
||||||
|
|
||||||
|
@ -25,11 +25,20 @@ public slots:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
float getBand() {return band_;}
|
float getBand()
|
||||||
float getSetPoint() {return setPoint_;}
|
{
|
||||||
|
return band_;
|
||||||
|
}
|
||||||
|
float getSetPoint()
|
||||||
|
{
|
||||||
|
return setPoint_;
|
||||||
|
}
|
||||||
Regulator(const Sensor sensor, QObject* parent = nullptr);
|
Regulator(const Sensor sensor, QObject* parent = nullptr);
|
||||||
Regulator(QObject* parent = nullptr);
|
Regulator(QObject* parent = nullptr);
|
||||||
Sensor getSensor(){return sensor_;}
|
Sensor getSensor()
|
||||||
|
{
|
||||||
|
return sensor_;
|
||||||
|
}
|
||||||
virtual QString getName() const;
|
virtual QString getName() const;
|
||||||
virtual ~Regulator() {}
|
virtual ~Regulator() {}
|
||||||
|
|
||||||
|
@ -21,8 +21,10 @@ void SensorActor::sensorEvent(Sensor sensor)
|
|||||||
{
|
{
|
||||||
if(sensor == sensor_)
|
if(sensor == sensor_)
|
||||||
{
|
{
|
||||||
if((sloap_ == SLOPE_UP || sloap_ == SLOPE_BOTH) && sensor_.field < threshold_ && sensor.field >= threshold_ ) performAction();
|
if((sloap_ == SLOPE_UP || sloap_ == SLOPE_BOTH) && sensor_.field < threshold_
|
||||||
else if((sloap_ == SLOPE_DOWN || sloap_ == SLOPE_BOTH) && sensor_.field > threshold_ && sensor.field <= threshold_) performAction();
|
&& sensor.field >= threshold_ ) performAction();
|
||||||
|
else if((sloap_ == SLOPE_DOWN || sloap_ == SLOPE_BOTH) && sensor_.field > threshold_
|
||||||
|
&& sensor.field <= threshold_) performAction();
|
||||||
sensor_ = sensor;
|
sensor_ = sensor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,10 @@ public:
|
|||||||
|
|
||||||
SensorActor(const Sensor sensor, QObject* parent = nullptr);
|
SensorActor(const Sensor sensor, QObject* parent = nullptr);
|
||||||
SensorActor(QObject* parent = nullptr);
|
SensorActor(QObject* parent = nullptr);
|
||||||
Sensor getSensor(){return sensor_;}
|
Sensor getSensor()
|
||||||
|
{
|
||||||
|
return sensor_;
|
||||||
|
}
|
||||||
virtual QString getName() const;
|
virtual QString getName() const;
|
||||||
virtual ~SensorActor() {}
|
virtual ~SensorActor() {}
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "alarmactions.h"
|
#include "alarmactions.h"
|
||||||
#include <QProcess>
|
#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)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,8 @@ void BroadCast::decodeMaster(const QByteArray& buffer)
|
|||||||
void BroadCast::decode(QByteArray buffer)
|
void BroadCast::decode(QByteArray buffer)
|
||||||
{
|
{
|
||||||
qDebug()<<"decodeing: "<<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";
|
qDebug()<<"got json";
|
||||||
buffer.remove(0,6);
|
buffer.remove(0,6);
|
||||||
@ -104,7 +105,8 @@ void BroadCast::decode(QByteArray buffer)
|
|||||||
qDebug()<<error.errorString();
|
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);
|
Sensor sensor = Sensor::sensorFromString(buffer);
|
||||||
if(sensor.type != Sensor::TYPE_DUMMY) gotSensorState(sensor);
|
if(sensor.type != Sensor::TYPE_DUMMY) gotSensorState(sensor);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "auxitem.h"
|
#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);
|
virtual void setValue(uint8_t value);
|
||||||
|
|
||||||
public:
|
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);
|
virtual void store(QJsonObject& json);
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,8 @@ uint32_t ItemData::id() const
|
|||||||
|
|
||||||
bool Item::secondaryFlag = false;
|
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);
|
if(regulator)connect(&globalSensors, &SensorStore::sensorChangedState, regulator.get(), &Regulator::sensorEvent);
|
||||||
|
|
||||||
std::shared_ptr<PolynomalActor> polynomalActor = std::dynamic_pointer_cast<PolynomalActor>(actor);
|
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)
|
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);
|
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
|
||||||
inline bool operator!=(const ItemData& in) const{ return itemId_!=in.itemId_; }
|
{
|
||||||
|
return itemId_==in.itemId_;
|
||||||
|
}
|
||||||
|
inline bool operator!=(const ItemData& in) const
|
||||||
|
{
|
||||||
|
return itemId_!=in.itemId_;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t id() const;
|
uint32_t id() const;
|
||||||
|
|
||||||
@ -55,7 +61,8 @@ public slots:
|
|||||||
|
|
||||||
public:
|
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);
|
Item(const ItemData& itemData, QObject *parent = nullptr);
|
||||||
|
|
||||||
virtual ~Item();
|
virtual ~Item();
|
||||||
|
@ -17,7 +17,10 @@ public:
|
|||||||
ItemStore(QObject *parent = nullptr);
|
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 store(QJsonObject &json);
|
||||||
void load(const QJsonObject &json);
|
void load(const QJsonObject &json);
|
||||||
|
@ -28,7 +28,8 @@ public:
|
|||||||
|
|
||||||
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(const ItemData& itemData, QObject *parent = nullptr);
|
||||||
~MessageItem();
|
~MessageItem();
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#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));
|
stateChanged(Sensor(Sensor::TYPE_SHUTDOWN_IMMINENT, 0, 0, "Shutdown Imminent", true));
|
||||||
setValue(true);
|
setValue(true);
|
||||||
|
@ -24,7 +24,11 @@ public slots:
|
|||||||
virtual void setValue(uint8_t value);
|
virtual void setValue(uint8_t value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PowerItem(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "", uint8_t value = 0, QObject* parent = nullptr);
|
PowerItem(uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "", uint8_t value = 0,
|
||||||
void emmitSensor(){stateChanged(Sensor(Sensor::TYPE_SHUTDOWN_IMMINENT, 0, 0, "Shutdown Imminent", true));}
|
QObject* parent = nullptr);
|
||||||
|
void emmitSensor()
|
||||||
|
{
|
||||||
|
stateChanged(Sensor(Sensor::TYPE_SHUTDOWN_IMMINENT, 0, 0, "Shutdown Imminent", true));
|
||||||
|
}
|
||||||
virtual void store(QJsonObject& json);
|
virtual void store(QJsonObject& json);
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
Microcontroller* Relay::micro_ = nullptr;
|
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);
|
itemId_ = address | ((uint32_t)id << 16);
|
||||||
qDebug()<<"Relay "<<id_<<"Name "<<name<<" id "<<itemId_<<" state "<<state<<" addr: "<<address;
|
qDebug()<<"Relay "<<id_<<"Name "<<name<<" id "<<itemId_<<" state "<<state<<" addr: "<<address;
|
||||||
|
@ -32,7 +32,10 @@ public:
|
|||||||
uint8_t getId() const;
|
uint8_t getId() const;
|
||||||
void setId(uint8_t id);
|
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 store(QJsonObject& json);
|
||||||
virtual void load(const QJsonObject& json, const bool preserve = false);
|
virtual void load(const QJsonObject& json, const bool preserve = false);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "rgbitem.h"
|
#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);
|
virtual void setValue(uint8_t value);
|
||||||
|
|
||||||
public:
|
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);
|
virtual void store(QJsonObject& json);
|
||||||
};
|
};
|
||||||
|
@ -18,14 +18,21 @@ public:
|
|||||||
|
|
||||||
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(const ItemData& itemData, QObject *parent = nullptr);
|
||||||
~SystemItem() = default;
|
~SystemItem() = default;
|
||||||
|
|
||||||
void setOnCommand(const QString& in);
|
void setOnCommand(const QString& in);
|
||||||
void setOffCommand(const QString& in);
|
void setOffCommand(const QString& in);
|
||||||
QString getOnCommand(){return onCommand_;}
|
QString getOnCommand()
|
||||||
QString getOffCommand(){return offCommand_;}
|
{
|
||||||
|
return onCommand_;
|
||||||
|
}
|
||||||
|
QString getOffCommand()
|
||||||
|
{
|
||||||
|
return offCommand_;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void store(QJsonObject& json);
|
virtual void store(QJsonObject& json);
|
||||||
virtual void load(const QJsonObject& json, const bool preserve = false);
|
virtual void load(const QJsonObject& json, const bool preserve = false);
|
||||||
|
24
src/main.cpp
24
src/main.cpp
@ -48,17 +48,22 @@ int main(int argc, char *argv[])
|
|||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
QCommandLineOption tcpOption(QStringList() << "t" << "tcp", QCoreApplication::translate("main", "Use Tcp connection"));
|
QCommandLineOption tcpOption(QStringList() << "t" << "tcp", QCoreApplication::translate("main", "Use Tcp connection"));
|
||||||
parser.addOption(tcpOption);
|
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);
|
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);
|
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);
|
parser.addOption(serialOption);
|
||||||
QCommandLineOption baudOption(QStringList() << "b" << "baud", QCoreApplication::translate("main", "Set Baud Rate"));
|
QCommandLineOption baudOption(QStringList() << "b" << "baud", QCoreApplication::translate("main", "Set Baud Rate"));
|
||||||
parser.addOption(baudOption);
|
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);
|
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.addOption(secondaryOption);
|
||||||
parser.process(a);
|
parser.process(a);
|
||||||
#endif
|
#endif
|
||||||
@ -94,11 +99,13 @@ int main(int argc, char *argv[])
|
|||||||
if(parser.isSet(portOption)) microPort->setBaudRate(parser.value(baudOption).toInt());
|
if(parser.isSet(portOption)) microPort->setBaudRate(parser.value(baudOption).toInt());
|
||||||
else microPort->setBaudRate(BAUD);
|
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;
|
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;
|
QTcpSocket* microSocket = new QTcpSocket;
|
||||||
@ -110,7 +117,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
masterIODevice = microSocket;
|
masterIODevice = microSocket;
|
||||||
|
|
||||||
MainObject mainObject(masterIODevice, parser.isSet(settingsPathOption) ? parser.value(settingsPathOption) : "", !parser.isSet(secondaryOption));
|
MainObject mainObject(masterIODevice, parser.isSet(settingsPathOption) ? parser.value(settingsPathOption) : "",
|
||||||
|
!parser.isSet(secondaryOption));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -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] + ' ');
|
for(int i = 10; i < bufferList.size(); i++) name.append(bufferList[i] + ' ');
|
||||||
if(name.size() > 1)name.remove(name.size()-1, 1);
|
if(name.size() > 1)name.remove(name.size()-1, 1);
|
||||||
else name = "Relay " + QString::number(bufferList[1].toInt(nullptr, 2));
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include "../apgetconnected.h"
|
#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);
|
QTimer::singleShot(timeoutMs, this, &OcupancySensorSource::Timeout);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ private:
|
|||||||
static constexpr unsigned timeoutMs = (15 * 60) * 1000;
|
static constexpr unsigned timeoutMs = (15 * 60) * 1000;
|
||||||
|
|
||||||
public:
|
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 store(QJsonObject& json);
|
||||||
void load(const QJsonObject& json);
|
void load(const QJsonObject& json);
|
||||||
|
@ -30,7 +30,8 @@ public:
|
|||||||
QDateTime lastSeen;
|
QDateTime lastSeen;
|
||||||
bool hidden;
|
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();
|
lastSeen = QDateTime::currentDateTime();
|
||||||
if(nameIn == "") generateName();
|
if(nameIn == "") generateName();
|
||||||
@ -39,9 +40,18 @@ public:
|
|||||||
{
|
{
|
||||||
lastSeen = QDateTime::currentDateTime();
|
lastSeen = QDateTime::currentDateTime();
|
||||||
}
|
}
|
||||||
inline bool operator==(const Sensor& in) const{ return type==in.type && id == in.id; }
|
inline bool operator==(const Sensor& in) const
|
||||||
inline bool operator!=(const Sensor& in) const{ return !(*this==in); }
|
{
|
||||||
inline void updateSeen(){lastSeen = QDateTime::currentDateTime();}
|
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)
|
static Sensor sensorFromString(const QString& str)
|
||||||
{
|
{
|
||||||
QStringList bufferList = str.split(' ');
|
QStringList bufferList = str.split(' ');
|
||||||
@ -82,7 +92,10 @@ public:
|
|||||||
SensorStore(QObject *parent = nullptr);
|
SensorStore(QObject *parent = nullptr);
|
||||||
virtual ~SensorStore() {}
|
virtual ~SensorStore() {}
|
||||||
|
|
||||||
inline std::vector<Sensor>* getSensors(){ return &sensors_; }
|
inline std::vector<Sensor>* getSensors()
|
||||||
|
{
|
||||||
|
return &sensors_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
21
src/sun.cpp
21
src/sun.cpp
@ -63,7 +63,8 @@ std::time_t Sun::JdTime::toStdTime()
|
|||||||
return millenniumTime;
|
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)
|
double Sun::nextMeanSolarNoonJD(const JdTime& time)
|
||||||
@ -78,7 +79,8 @@ double Sun::meanSolarAnomaly(double meanSolarNoon)
|
|||||||
|
|
||||||
double Sun::eqOfCenter(double meanSolarAnomaly)
|
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)
|
double Sun::eclipticLongitude(double eqOfCenter, double meanSolarAnomaly)
|
||||||
@ -108,7 +110,8 @@ double Sun::hourAngle(double localSolarTime)
|
|||||||
|
|
||||||
double Sun::hourAngleAtSunset(double solarDeclination)
|
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()
|
double Sun::altitude()
|
||||||
@ -120,7 +123,8 @@ double Sun::altitude()
|
|||||||
double localSolarTimeValue = localSolarTime(time, equationOfTime(meanSolarAnomalyValue, eclipticLongitudeValue));
|
double localSolarTimeValue = localSolarTime(time, equationOfTime(meanSolarAnomalyValue, eclipticLongitudeValue));
|
||||||
double declinationValue = solarDeclination(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);
|
return TO_DEGS*asin(cosZenithAngle);
|
||||||
}
|
}
|
||||||
@ -133,7 +137,8 @@ double Sun::maximumAltitude()
|
|||||||
double eclipticLongitudeValue = eclipticLongitude(eqOfCenter(meanSolarAnomalyValue), meanSolarAnomalyValue);
|
double eclipticLongitudeValue = eclipticLongitude(eqOfCenter(meanSolarAnomalyValue), meanSolarAnomalyValue);
|
||||||
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
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);
|
return TO_DEGS*asin(cosZenithAngle);
|
||||||
}
|
}
|
||||||
@ -153,7 +158,8 @@ std::time_t Sun::riseTime()
|
|||||||
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
||||||
double hourAngleValue = hourAngleAtSunset(declinationValue);
|
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();
|
return time.toStdTime();
|
||||||
}
|
}
|
||||||
@ -166,7 +172,8 @@ std::time_t Sun::setTime()
|
|||||||
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
double declinationValue = solarDeclination(eclipticLongitudeValue);
|
||||||
double hourAngleValue = hourAngleAtSunset(declinationValue);
|
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();
|
return time.toStdTime();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
#include "actorwidgets/polynomalactorwidget.h"
|
#include "actorwidgets/polynomalactorwidget.h"
|
||||||
#include "actorwidgets/factoractorwidget.h"
|
#include "actorwidgets/factoractorwidget.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class ActorSettingsDialog;
|
class ActorSettingsDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include "../../actors/alarmtime.h"
|
#include "../../actors/alarmtime.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class AlarmWidget;
|
class AlarmWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "../../actors/factoractor.h"
|
#include "../../actors/factoractor.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class FactorActorWidget;
|
class FactorActorWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "polynomalactorwidget.h"
|
#include "polynomalactorwidget.h"
|
||||||
#include "ui_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),
|
QWidget(parent),
|
||||||
sensors_(sensors),
|
sensors_(sensors),
|
||||||
actor_(actor),
|
actor_(actor),
|
||||||
@ -39,7 +40,8 @@ PolynomalActorWidget::~PolynomalActorWidget()
|
|||||||
|
|
||||||
void PolynomalActorWidget::setPow()
|
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)
|
void PolynomalActorWidget::setSensor(const QModelIndex &index)
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "../../actors/polynomalactor.h"
|
#include "../../actors/polynomalactor.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class PolynomalActorWidget;
|
class PolynomalActorWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,7 +16,8 @@ class PolynomalActorWidget : public QWidget
|
|||||||
std::shared_ptr<PolynomalActor> actor_;
|
std::shared_ptr<PolynomalActor> actor_;
|
||||||
|
|
||||||
public:
|
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();
|
~PolynomalActorWidget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "../../actors/regulator.h"
|
#include "../../actors/regulator.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class RegulatorWdiget;
|
class RegulatorWdiget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +17,8 @@ class RegulatorWdiget : public QWidget
|
|||||||
SensorStore* sensors_;
|
SensorStore* sensors_;
|
||||||
|
|
||||||
public:
|
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();
|
~RegulatorWdiget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <QItemSelection>
|
#include <QItemSelection>
|
||||||
#include "../../actors/sensoractor.h"
|
#include "../../actors/sensoractor.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class SensorActorWidget;
|
class SensorActorWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +18,8 @@ class SensorActorWidget : public QWidget
|
|||||||
SensorStore* sensors_;
|
SensorStore* sensors_;
|
||||||
|
|
||||||
public:
|
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();
|
~SensorActorWidget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "../../actors/timeractor.h"
|
#include "../../actors/timeractor.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class TimerActorWidget;
|
class TimerActorWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include "../items/item.h"
|
#include "../items/item.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class ItemCreationDialog;
|
class ItemCreationDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
#include "../items/itemstore.h"
|
#include "../items/itemstore.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class RelayScrollBox;
|
class RelayScrollBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include "../items/relay.h"
|
#include "../items/relay.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class ItemSettingsDialog;
|
class ItemSettingsDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,10 @@ MessageItemSettingsWidget::MessageItemSettingsWidget(std::weak_ptr<MessageItem>
|
|||||||
|
|
||||||
connect(ui->lineEdit, &QLineEdit::textChanged, this, &MessageItemSettingsWidget::setText);
|
connect(ui->lineEdit, &QLineEdit::textChanged, this, &MessageItemSettingsWidget::setText);
|
||||||
connect(ui->lineEdit_alert, &QLineEdit::textChanged, this, &MessageItemSettingsWidget::setAlert);
|
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 <memory>
|
||||||
#include "../../items/messageitem.h"
|
#include "../../items/messageitem.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class MessageItemSettingsWidget;
|
class MessageItemSettingsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include "../../items/relay.h"
|
#include "../../items/relay.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class RelayItemSettingsWidget;
|
class RelayItemSettingsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include "../../items/systemitem.h"
|
#include "../../items/systemitem.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class SystemItemSettingsWidget;
|
class SystemItemSettingsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
#include "itemsettingsdialog.h"
|
#include "itemsettingsdialog.h"
|
||||||
#include "../items/item.h"
|
#include "../items/item.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class ItemWidget;
|
class ItemWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QScroller>
|
#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);
|
setColumnCount(2);
|
||||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
@ -16,7 +17,8 @@ SensorListWidget::SensorListWidget(const bool showHidden, QWidget *parent): QTab
|
|||||||
setHorizontalHeaderItem(1, new QTableWidgetItem("Value"));
|
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()));
|
sensorsChanged(*(sensorStore.getSensors()));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user