Merge pull request #11 from guh/tests
restructure code to allow adding unit tests
This commit is contained in:
commit
b011325012
35
README.md
35
README.md
@ -1,2 +1,37 @@
|
|||||||
# mea
|
# mea
|
||||||
QtQuick nymea client application
|
QtQuick nymea client application
|
||||||
|
|
||||||
|
# building
|
||||||
|
|
||||||
|
Required packages:
|
||||||
|
It is recommended to install a complete Qt installation. Minimum required Version 5.7.
|
||||||
|
No extra modules are required for a basic desktop build.
|
||||||
|
|
||||||
|
To build a binary run
|
||||||
|
$ mkdir builddir
|
||||||
|
$ cd builddir
|
||||||
|
$ qmake path/to/source/dir
|
||||||
|
$ make
|
||||||
|
|
||||||
|
Or open mea.pro in QtCreator and click the "Play" button.
|
||||||
|
|
||||||
|
Optional configuration flags to be passed to qmake:
|
||||||
|
- CONFIG+=withavahi
|
||||||
|
Enables avahi support. Requires libavahi-common and libavahi-client to be present on the system
|
||||||
|
- CONFIG+=withtests
|
||||||
|
Enables building the testrunner target
|
||||||
|
|
||||||
|
Notes for Android:
|
||||||
|
As Qt can't bundle a build of openssl for android, you need to place a copy to
|
||||||
|
/opt/android-ssl/
|
||||||
|
|
||||||
|
Notes for Windows:
|
||||||
|
There is an additional make target named "wininstaller" available. You need to
|
||||||
|
have windeployqt and binarycreator (from Qt Install Framework 3.0) in your
|
||||||
|
system's Path.
|
||||||
|
|
||||||
|
# running the tests
|
||||||
|
Required Packages:
|
||||||
|
- qtdeclarative5-test-plugin
|
||||||
|
- nymead
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "jsonrpc/jsontypes.h"
|
#include "jsonrpc/jsontypes.h"
|
||||||
|
#include <QMetaEnum>
|
||||||
|
|
||||||
DeviceManager::DeviceManager(JsonRpcClient* jsonclient, QObject *parent) :
|
DeviceManager::DeviceManager(JsonRpcClient* jsonclient, QObject *parent) :
|
||||||
JsonHandler(parent),
|
JsonHandler(parent),
|
||||||
@ -73,9 +73,9 @@ void DiscoveryModel::addDevice(const DiscoveryDevice &device)
|
|||||||
emit countChanged();
|
emit countChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DiscoveryModel::get(int index, const QByteArray &role) const
|
QString DiscoveryModel::get(int index, DeviceRole role) const
|
||||||
{
|
{
|
||||||
return data(this->index(index), roleNames().key(role)).toString();
|
return data(this->index(index), role).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiscoveryModel::contains(const QString &uuid) const
|
bool DiscoveryModel::contains(const QString &uuid) const
|
||||||
@ -39,6 +39,7 @@ public:
|
|||||||
PortRole,
|
PortRole,
|
||||||
VersionRole
|
VersionRole
|
||||||
};
|
};
|
||||||
|
Q_ENUM(DeviceRole)
|
||||||
|
|
||||||
explicit DiscoveryModel(QObject *parent = 0);
|
explicit DiscoveryModel(QObject *parent = 0);
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ public:
|
|||||||
|
|
||||||
void addDevice(const DiscoveryDevice &device);
|
void addDevice(const DiscoveryDevice &device);
|
||||||
|
|
||||||
Q_INVOKABLE QString get(int index, const QByteArray &role) const;
|
Q_INVOKABLE QString get(int index, DiscoveryModel::DeviceRole role) const;
|
||||||
bool contains(const QString &uuid) const;
|
bool contains(const QString &uuid) const;
|
||||||
DiscoveryDevice find(const QHostAddress &address) const;
|
DiscoveryDevice find(const QHostAddress &address) const;
|
||||||
|
|
||||||
@ -35,14 +35,6 @@ Engine *Engine::instance()
|
|||||||
return s_instance;
|
return s_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject *Engine::qmlInstance(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
|
||||||
{
|
|
||||||
Q_UNUSED(qmlEngine)
|
|
||||||
Q_UNUSED(jsEngine)
|
|
||||||
|
|
||||||
return Engine::instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceManager *Engine::deviceManager() const
|
DeviceManager *Engine::deviceManager() const
|
||||||
{
|
{
|
||||||
return m_deviceManager;
|
return m_deviceManager;
|
||||||
@ -22,8 +22,6 @@
|
|||||||
#define ENGINE_H
|
#define ENGINE_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQmlEngine>
|
|
||||||
#include <QJSEngine>
|
|
||||||
|
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "nymeainterface.h"
|
#include "nymeainterface.h"
|
||||||
@ -46,7 +44,6 @@ class Engine : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static Engine *instance();
|
static Engine *instance();
|
||||||
static QObject *qmlInstance(QQmlEngine *qmlEngine, QJSEngine *jsEngine);
|
|
||||||
|
|
||||||
bool connected() const;
|
bool connected() const;
|
||||||
QString connectedHost() const;
|
QString connectedHost() const;
|
||||||
134
libmea-core/libmea-core.h
Normal file
134
libmea-core/libmea-core.h
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
#ifndef LIBMEACORE_H
|
||||||
|
#define LIBMEACORE_H
|
||||||
|
|
||||||
|
#include "engine.h"
|
||||||
|
#include "vendorsproxy.h"
|
||||||
|
#include "deviceclassesproxy.h"
|
||||||
|
#include "devicesproxy.h"
|
||||||
|
#include "pluginsproxy.h"
|
||||||
|
#include "devicediscovery.h"
|
||||||
|
#include "discovery/nymeadiscovery.h"
|
||||||
|
#include "discovery/discoverymodel.h"
|
||||||
|
#include "interfacesmodel.h"
|
||||||
|
#include "rulemanager.h"
|
||||||
|
#include "models/rulesfiltermodel.h"
|
||||||
|
#include "types/ruleactions.h"
|
||||||
|
#include "types/ruleaction.h"
|
||||||
|
#include "types/ruleactionparams.h"
|
||||||
|
#include "types/ruleactionparam.h"
|
||||||
|
#include "types/eventdescriptors.h"
|
||||||
|
#include "types/eventdescriptor.h"
|
||||||
|
#include "types/rule.h"
|
||||||
|
#include "types/interfaces.h"
|
||||||
|
#include "types/interface.h"
|
||||||
|
#include "types/statedescriptor.h"
|
||||||
|
#include "types/stateevaluator.h"
|
||||||
|
#include "types/stateevaluators.h"
|
||||||
|
#include "models/logsmodel.h"
|
||||||
|
#include "models/valuelogsproxymodel.h"
|
||||||
|
#include "models/eventdescriptorparamsfiltermodel.h"
|
||||||
|
#include "basicconfiguration.h"
|
||||||
|
#include "wifisetup/networkmanagercontroler.h"
|
||||||
|
|
||||||
|
static QObject* interfacesModel_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||||
|
{
|
||||||
|
Q_UNUSED(engine)
|
||||||
|
Q_UNUSED(scriptEngine)
|
||||||
|
|
||||||
|
return new Interfaces();
|
||||||
|
}
|
||||||
|
|
||||||
|
QObject* engine_provider(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
Q_UNUSED(qmlEngine)
|
||||||
|
Q_UNUSED(jsEngine)
|
||||||
|
|
||||||
|
return Engine::instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
void registerQmlTypes() {
|
||||||
|
|
||||||
|
const char uri[] = "Mea";
|
||||||
|
|
||||||
|
qmlRegisterSingletonType<Engine>(uri, 1, 0, "Engine", engine_provider);
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<DeviceManager>(uri, 1, 0, "DeviceManager", "Can't create this in QML. Get it from the Core.");
|
||||||
|
qmlRegisterUncreatableType<JsonRpcClient>(uri, 1, 0, "JsonRpcClient", "Can't create this in QML. Get it from the Core.");
|
||||||
|
qmlRegisterUncreatableType<NymeaConnection>(uri, 1, 0, "NymeaConnection", "Can't create this in QML. Get it from the Core.");
|
||||||
|
|
||||||
|
// libnymea-common
|
||||||
|
qmlRegisterUncreatableType<Types>(uri, 1, 0, "Types", "Can't create this in QML. Get it from the Core.");
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<ParamType>(uri, 1, 0, "ParamType", "Can't create this in QML. Get it from the ParamTypes.");
|
||||||
|
qmlRegisterUncreatableType<ParamTypes>(uri, 1, 0, "ParamTypes", "Can't create this in QML. Get it from the DeviceClass.");
|
||||||
|
qmlRegisterUncreatableType<EventType>(uri, 1, 0, "EventType", "Can't create this in QML. Get it from the EventTypes.");
|
||||||
|
qmlRegisterUncreatableType<EventTypes>(uri, 1, 0, "EventTypes", "Can't create this in QML. Get it from the DeviceClass.");
|
||||||
|
qmlRegisterUncreatableType<StateType>(uri, 1, 0, "StateType", "Can't create this in QML. Get it from the StateTypes.");
|
||||||
|
qmlRegisterUncreatableType<StateTypes>(uri, 1, 0, "StateTypes", "Can't create this in QML. Get it from the DeviceClass.");
|
||||||
|
qmlRegisterUncreatableType<ActionType>(uri, 1, 0, "ActionType", "Can't create this in QML. Get it from the ActionTypes.");
|
||||||
|
qmlRegisterUncreatableType<ActionTypes>(uri, 1, 0, "ActionTypes", "Can't create this in QML. Get it from the DeviceClass.");
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<State>(uri, 1, 0, "State", "Can't create this in QML. Get it from the States.");
|
||||||
|
qmlRegisterUncreatableType<States>(uri, 1, 0, "States", "Can't create this in QML. Get it from the Device.");
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<Vendor>(uri, 1, 0, "Vendor", "Can't create this in QML. Get it from the Vendors.");
|
||||||
|
qmlRegisterUncreatableType<Vendors>(uri, 1, 0, "Vendors", "Can't create this in QML. Get it from the DeviceManager.");
|
||||||
|
qmlRegisterType<VendorsProxy>(uri, 1, 0, "VendorsProxy");
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<Device>(uri, 1, 0, "Device", "Can't create this in QML. Get it from the Devices.");
|
||||||
|
qmlRegisterUncreatableType<Devices>(uri, 1, 0, "Devices", "Can't create this in QML. Get it from the DeviceManager.");
|
||||||
|
qmlRegisterType<DevicesProxy>(uri, 1, 0, "DevicesProxy");
|
||||||
|
qmlRegisterType<InterfacesModel>(uri, 1, 0, "InterfacesModel");
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<DeviceClass>(uri, 1, 0, "DeviceClass", "Can't create this in QML. Get it from the DeviceClasses.");
|
||||||
|
qmlRegisterUncreatableType<DeviceClasses>(uri, 1, 0, "DeviceClasses", "Can't create this in QML. Get it from the DeviceManager.");
|
||||||
|
qmlRegisterType<DeviceClassesProxy>(uri, 1, 0, "DeviceClassesProxy");
|
||||||
|
qmlRegisterType<DeviceDiscovery>(uri, 1, 0, "DeviceDiscovery");
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<RuleManager>(uri, 1, 0, "RuleManager", "Get it from the Engine");
|
||||||
|
qmlRegisterUncreatableType<Rules>(uri, 1, 0, "Rules", "Get it from RuleManager");
|
||||||
|
qmlRegisterUncreatableType<Rule>(uri, 1, 0, "Rule", "Get it from Rules");
|
||||||
|
qmlRegisterUncreatableType<RuleActions>(uri, 1, 0, "RuleActions", "Get them from the rule");
|
||||||
|
qmlRegisterUncreatableType<RuleAction>(uri, 1, 0, "RuleAction", "Get it from RuleActions");
|
||||||
|
qmlRegisterUncreatableType<RuleActionParams>(uri, 1, 0, "RuleActionParams", "Get it from RuleActions");
|
||||||
|
qmlRegisterUncreatableType<RuleActionParam>(uri, 1, 0, "RuleActionParam", "Get it from RuleActionParams");
|
||||||
|
qmlRegisterType<RulesFilterModel>(uri, 1, 0, "RulesFilterModel");
|
||||||
|
qmlRegisterUncreatableType<EventDescriptors>(uri, 1, 0, "EventDescriptors", "Get them from rules");
|
||||||
|
qmlRegisterUncreatableType<EventDescriptor>(uri, 1, 0, "EventDescriptor", "Get them from rules");
|
||||||
|
qmlRegisterUncreatableType<ParamTypes>(uri, 1, 0, "ParamTypes", "Uncreatable");
|
||||||
|
qmlRegisterUncreatableType<ParamType>(uri, 1, 0, "ParamType", "Uncreatable");
|
||||||
|
qmlRegisterType<Param>(uri, 1, 0, "Param");
|
||||||
|
qmlRegisterUncreatableType<ParamDescriptor>(uri, 1, 0, "ParamDescriptor", "Uncreatable");
|
||||||
|
qmlRegisterUncreatableType<ParamDescriptors>(uri, 1, 0, "ParamDescriptors", "Uncreatable");
|
||||||
|
qmlRegisterUncreatableType<StateDescriptor>(uri, 1, 0, "StateDescriptor", "Uncreatable");
|
||||||
|
qmlRegisterUncreatableType<StateEvaluator>(uri, 1, 0, "StateEvaluator", "Uncreatable");
|
||||||
|
qmlRegisterUncreatableType<StateEvaluators>(uri, 1, 0, "StateEvaluators", "Uncreatable");
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<Interface>(uri, 1, 0, "Interface", "Uncreatable");
|
||||||
|
qmlRegisterSingletonType<Interfaces>(uri, 1, 0, "Interfaces", interfacesModel_provider);
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<Plugin>(uri, 1, 0, "Plugin", "Can't create this in QML. Get it from the Plugins.");
|
||||||
|
qmlRegisterUncreatableType<Plugins>(uri, 1, 0, "Plugins", "Can't create this in QML. Get it from the DeviceManager.");
|
||||||
|
qmlRegisterType<PluginsProxy>(uri, 1, 0, "PluginsProxy");
|
||||||
|
|
||||||
|
qmlRegisterUncreatableType<BasicConfiguration>(uri, 1, 0, "BasicConfiguration", "Uncreatable");
|
||||||
|
|
||||||
|
qmlRegisterType<NymeaDiscovery>(uri, 1, 0, "NymeaDiscovery");
|
||||||
|
qmlRegisterUncreatableType<DiscoveryModel>(uri, 1, 0, "DiscoveryModel", "Get it from NymeaDiscovery");
|
||||||
|
|
||||||
|
qmlRegisterType<EventDescriptorParamsFilterModel>(uri, 1, 0, "EventDescriptorParamsFilterModel");
|
||||||
|
|
||||||
|
qmlRegisterType<LogsModel>(uri, 1, 0, "LogsModel");
|
||||||
|
qmlRegisterType<ValueLogsProxyModel>(uri, 1, 0, "ValueLogsProxyModel");
|
||||||
|
qmlRegisterUncreatableType<LogEntry>(uri, 1, 0, "LogEntry", "Get them from LogsModel");
|
||||||
|
|
||||||
|
qmlRegisterType<NetworkManagerControler>(uri, 1, 0, "NetworkManagerControler");
|
||||||
|
qmlRegisterUncreatableType<BluetoothDiscovery>(uri, 1, 0, "BluetoothDiscovery", "Can't create this in QML. Get it from the Engine instance.");
|
||||||
|
qmlRegisterUncreatableType<BluetoothDeviceInfo>(uri, 1, 0, "BluetoothDeviceInfo", "Can't create this in QML. Get it from the DeviceInfos.");
|
||||||
|
qmlRegisterUncreatableType<BluetoothDeviceInfos>(uri, 1, 0, "BluetoothDeviceInfos", "Can't create this in QML. Get it from the BluetoothDiscovery.");
|
||||||
|
qmlRegisterUncreatableType<WirelessSetupManager>(uri, 1, 0, "WirelessSetupManager", "Can't create this in QML. Get it from the NetworkManagerControler.");
|
||||||
|
qmlRegisterUncreatableType<WirelessAccesspoints>(uri, 1, 0, "WirelessAccesspoints", "Can't create this in QML. Get it from the Loop.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // LIBMEACORE_H
|
||||||
121
libmea-core/libmea-core.pro
Normal file
121
libmea-core/libmea-core.pro
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
TARGET = mea-core
|
||||||
|
TEMPLATE = lib
|
||||||
|
CONFIG += staticlib
|
||||||
|
|
||||||
|
include(../mea.pri)
|
||||||
|
|
||||||
|
QT -= gui
|
||||||
|
QT += websockets bluetooth
|
||||||
|
|
||||||
|
INCLUDEPATH += $$top_srcdir/libnymea-common
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
engine.cpp \
|
||||||
|
nymeainterface.cpp \
|
||||||
|
devicemanager.cpp \
|
||||||
|
websocketinterface.cpp \
|
||||||
|
jsonrpc/jsontypes.cpp \
|
||||||
|
jsonrpc/jsonrpcclient.cpp \
|
||||||
|
jsonrpc/jsonhandler.cpp \
|
||||||
|
discovery/nymeahost.cpp \
|
||||||
|
discovery/nymeahosts.cpp \
|
||||||
|
discovery/upnpdiscovery.cpp \
|
||||||
|
devices.cpp \
|
||||||
|
devicesproxy.cpp \
|
||||||
|
deviceclasses.cpp \
|
||||||
|
deviceclassesproxy.cpp \
|
||||||
|
devicediscovery.cpp \
|
||||||
|
vendorsproxy.cpp \
|
||||||
|
pluginsproxy.cpp \
|
||||||
|
tcpsocketinterface.cpp \
|
||||||
|
nymeaconnection.cpp \
|
||||||
|
interfacesmodel.cpp \
|
||||||
|
discovery/zeroconfdiscovery.cpp \
|
||||||
|
discovery/discoverydevice.cpp \
|
||||||
|
discovery/discoverymodel.cpp \
|
||||||
|
rulemanager.cpp \
|
||||||
|
models/rulesfiltermodel.cpp \
|
||||||
|
models/logsmodel.cpp \
|
||||||
|
models/valuelogsproxymodel.cpp \
|
||||||
|
discovery/nymeadiscovery.cpp \
|
||||||
|
logmanager.cpp \
|
||||||
|
basicconfiguration.cpp \
|
||||||
|
models/eventdescriptorparamsfiltermodel.cpp \
|
||||||
|
wifisetup/bluetoothdevice.cpp \
|
||||||
|
wifisetup/bluetoothdeviceinfo.cpp \
|
||||||
|
wifisetup/bluetoothdeviceinfos.cpp \
|
||||||
|
wifisetup/bluetoothdiscovery.cpp \
|
||||||
|
wifisetup/wirelessaccesspoint.cpp \
|
||||||
|
wifisetup/wirelessaccesspoints.cpp \
|
||||||
|
wifisetup/wirelesssetupmanager.cpp \
|
||||||
|
wifisetup/networkmanagercontroler.cpp \
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
engine.h \
|
||||||
|
nymeainterface.h \
|
||||||
|
devicemanager.h \
|
||||||
|
websocketinterface.h \
|
||||||
|
jsonrpc/jsontypes.h \
|
||||||
|
jsonrpc/jsonrpcclient.h \
|
||||||
|
jsonrpc/jsonhandler.h \
|
||||||
|
discovery/nymeahost.h \
|
||||||
|
discovery/nymeahosts.h \
|
||||||
|
discovery/upnpdiscovery.h \
|
||||||
|
devices.h \
|
||||||
|
devicesproxy.h \
|
||||||
|
deviceclasses.h \
|
||||||
|
deviceclassesproxy.h \
|
||||||
|
devicediscovery.h \
|
||||||
|
vendorsproxy.h \
|
||||||
|
pluginsproxy.h \
|
||||||
|
tcpsocketinterface.h \
|
||||||
|
nymeaconnection.h \
|
||||||
|
interfacesmodel.h \
|
||||||
|
discovery/zeroconfdiscovery.h \
|
||||||
|
discovery/discoverydevice.h \
|
||||||
|
discovery/discoverymodel.h \
|
||||||
|
rulemanager.h \
|
||||||
|
models/rulesfiltermodel.h \
|
||||||
|
models/logsmodel.h \
|
||||||
|
models/valuelogsproxymodel.h \
|
||||||
|
discovery/nymeadiscovery.h \
|
||||||
|
logmanager.h \
|
||||||
|
basicconfiguration.h \
|
||||||
|
models/eventdescriptorparamsfiltermodel.h \
|
||||||
|
wifisetup/bluetoothdevice.h \
|
||||||
|
wifisetup/bluetoothdeviceinfo.h \
|
||||||
|
wifisetup/bluetoothdeviceinfos.h \
|
||||||
|
wifisetup/bluetoothdiscovery.h \
|
||||||
|
wifisetup/wirelessaccesspoint.h \
|
||||||
|
wifisetup/wirelessaccesspoints.h \
|
||||||
|
wifisetup/wirelesssetupmanager.h \
|
||||||
|
wifisetup/networkmanagercontroler.h \
|
||||||
|
libmea-core.h
|
||||||
|
|
||||||
|
withavahi {
|
||||||
|
DEFINES += WITH_AVAHI
|
||||||
|
|
||||||
|
LIBS += -lavahi-client -lavahi-common
|
||||||
|
|
||||||
|
HEADERS += discovery/avahi/avahiserviceentry.h \
|
||||||
|
discovery/avahi/qt-watch.h \
|
||||||
|
discovery/avahi/qtavahiclient.h \
|
||||||
|
discovery/avahi/qtavahiservice_p.h \
|
||||||
|
discovery/avahi/qtavahiservice.h \
|
||||||
|
discovery/avahi/qtavahiservicebrowser_p.h \
|
||||||
|
discovery/avahi/qtavahiservicebrowser.h \
|
||||||
|
|
||||||
|
SOURCES += discovery/avahi/avahiserviceentry.cpp \
|
||||||
|
discovery/avahi/qt-watch.cpp \
|
||||||
|
discovery/avahi/qtavahiclient.cpp \
|
||||||
|
discovery/avahi/qtavahiservice_p.cpp \
|
||||||
|
discovery/avahi/qtavahiservice.cpp \
|
||||||
|
discovery/avahi/qtavahiservicebrowser_p.cpp \
|
||||||
|
discovery/avahi/qtavahiservicebrowser.cpp \
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
unix {
|
||||||
|
target.path = /usr/lib
|
||||||
|
INSTALLS += target
|
||||||
|
}
|
||||||
@ -3,6 +3,8 @@
|
|||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "logmanager.h"
|
#include "logmanager.h"
|
||||||
|
|
||||||
|
#include <QMetaEnum>
|
||||||
|
|
||||||
LogsModel::LogsModel(QObject *parent) : QAbstractListModel(parent)
|
LogsModel::LogsModel(QObject *parent) : QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
connect(Engine::instance()->logManager(), &LogManager::logEntryReceived, this, &LogsModel::newLogEntryReceived);
|
connect(Engine::instance()->logManager(), &LogManager::logEntryReceived, this, &LogsModel::newLogEntryReceived);
|
||||||
@ -262,9 +262,9 @@ void RuleManager::parseTimeDescriptor(const QVariantMap &timeDescriptor, Rule *r
|
|||||||
Q_UNUSED(rule)
|
Q_UNUSED(rule)
|
||||||
|
|
||||||
foreach (const QVariant &timeEventItemVariant, timeDescriptor.value("timeEventItems").toList()) {
|
foreach (const QVariant &timeEventItemVariant, timeDescriptor.value("timeEventItems").toList()) {
|
||||||
TimeEventItem *timeEventItem = new TimeEventItem();
|
// TimeEventItem *timeEventItem = new TimeEventItem();
|
||||||
timeEventItem->setDateTime(QDateTime::fromSecsSinceEpoch(timeEventItemVariant.toMap().value("datetime").toULongLong()));
|
// timeEventItem->setDateTime(QDateTime::fromSecsSinceEpoch(timeEventItemVariant.toMap().value("datetime").toULongLong()));
|
||||||
timeEventItem->setTime(QTime::fromString(timeEventItemVariant.toMap().value("time").toString()));
|
// timeEventItem->setTime(QTime::fromString(timeEventItemVariant.toMap().value("time").toString()));
|
||||||
// timeEventItem->setRepeatingOption();
|
// timeEventItem->setRepeatingOption();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@
|
|||||||
#include "websocketinterface.h"
|
#include "websocketinterface.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QCoreApplication>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonParseError>
|
#include <QJsonParseError>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
WebsocketInterface::WebsocketInterface(QObject *parent) :
|
WebsocketInterface::WebsocketInterface(QObject *parent) :
|
||||||
NymeaInterface(parent)
|
NymeaInterface(parent)
|
||||||
{
|
{
|
||||||
m_socket = new QWebSocket(QGuiApplication::applicationName(), QWebSocketProtocol::Version13, this);
|
m_socket = new QWebSocket(QCoreApplication::applicationName(), QWebSocketProtocol::Version13, this);
|
||||||
|
|
||||||
QObject::connect(m_socket, &QWebSocket::connected, this, &WebsocketInterface::connected);
|
QObject::connect(m_socket, &QWebSocket::connected, this, &WebsocketInterface::connected);
|
||||||
QObject::connect(m_socket, &QWebSocket::disconnected, this, &WebsocketInterface::disconnected);
|
QObject::connect(m_socket, &QWebSocket::disconnected, this, &WebsocketInterface::disconnected);
|
||||||
7
libnymea-common/libnymea-common.h
Normal file
7
libnymea-common/libnymea-common.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <QtCore/QtGlobal>
|
||||||
|
|
||||||
|
#if defined(LIBNYMEA_COMMON)
|
||||||
|
# define LIBNYMEA_COMMON_EXPORT Q_DECL_EXPORT
|
||||||
|
#else
|
||||||
|
# define LIBNYMEA_COMMON_EXPORT Q_DECL_IMPORT
|
||||||
|
#endif
|
||||||
@ -2,9 +2,10 @@ include(../mea.pri)
|
|||||||
|
|
||||||
TARGET = nymea-common
|
TARGET = nymea-common
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
|
CONFIG += staticlib
|
||||||
|
|
||||||
|
QT -= gui
|
||||||
QT += network
|
QT += network
|
||||||
CONFIG += static
|
|
||||||
|
|
||||||
target.path = /usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')
|
target.path = /usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user