Merge remote-tracking branch 'origin/more-box-settings' into landing-silo
This commit is contained in:
commit
e077de454e
@ -1,111 +0,0 @@
|
||||
#include "basicconfiguration.h"
|
||||
|
||||
#include "jsonrpc/jsonrpcclient.h"
|
||||
|
||||
BasicConfiguration::BasicConfiguration(JsonRpcClient* client, QObject *parent) :
|
||||
JsonHandler(parent),
|
||||
m_client(client)
|
||||
{
|
||||
client->registerNotificationHandler(this, "notificationReceived");
|
||||
}
|
||||
|
||||
QString BasicConfiguration::nameSpace() const
|
||||
{
|
||||
return "Configuration";
|
||||
}
|
||||
|
||||
bool BasicConfiguration::debugServerEnabled() const
|
||||
{
|
||||
return m_debugServerEnabled;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setDebugServerEnabled(bool debugServerEnabled)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("enabled", debugServerEnabled);
|
||||
m_client->sendCommand("Configuration.SetDebugServerEnabled", params, this, "setDebugServerEnabledResponse");
|
||||
}
|
||||
|
||||
QString BasicConfiguration::serverName() const
|
||||
{
|
||||
return m_serverName;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setServerName(const QString &serverName)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("serverName", serverName);
|
||||
m_client->sendCommand("Configuration.SetServerName", params, this, "setServerNameResponse");
|
||||
}
|
||||
|
||||
bool BasicConfiguration::cloudEnabled() const
|
||||
{
|
||||
return m_cloudEnabled;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setCloudEnabled(bool cloudEnabled)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("enabled", cloudEnabled);
|
||||
m_client->sendCommand("Configuration.SetCloudEnabled", params, this, "setCloudEnabledResponse");
|
||||
}
|
||||
|
||||
void BasicConfiguration::init()
|
||||
{
|
||||
m_client->sendCommand("Configuration.GetConfigurations", this, "getConfigurationsResponse");
|
||||
}
|
||||
|
||||
void BasicConfiguration::getConfigurationsResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
// qDebug() << "have config reply" << params;
|
||||
QVariantMap basicConfig = params.value("params").toMap().value("basicConfiguration").toMap();
|
||||
m_debugServerEnabled = basicConfig.value("debugServerEnabled").toBool();
|
||||
emit debugServerEnabledChanged();
|
||||
m_serverName = basicConfig.value("serverName").toString();
|
||||
emit serverNameChanged();
|
||||
QVariantMap cloudConfig = params.value("params").toMap().value("cloud").toMap();
|
||||
m_cloudEnabled = cloudConfig.value("enabled").toBool();
|
||||
emit cloudEnabledChanged();
|
||||
}
|
||||
|
||||
void BasicConfiguration::getCloudConfigurationResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Cloud config reply" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setDebugServerEnabledResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Debug server set:" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setServerNameResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Server name set:" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setCloudEnabledResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Set cloud enabled:" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::notificationReceived(const QVariantMap ¬ification)
|
||||
{
|
||||
QString notif = notification.value("notification").toString();
|
||||
if (notif == "Configuration.BasicConfigurationChanged") {
|
||||
QVariantMap params = notification.value("params").toMap().value("basicConfiguration").toMap();
|
||||
qDebug() << "notif" << params;
|
||||
m_debugServerEnabled = params.value("debugServerEnabled").toBool();
|
||||
emit debugServerEnabled();
|
||||
m_serverName = params.value("serverName").toString();
|
||||
emit serverNameChanged();
|
||||
return;
|
||||
}
|
||||
if (notif == "Configuration.CloudConfigurationChanged") {
|
||||
QVariantMap params = notification.value("params").toMap().value("cloudConfiguration").toMap();
|
||||
qDebug() << "notif" << params;
|
||||
m_cloudEnabled = params.value("enabled").toBool();
|
||||
emit cloudEnabledChanged();
|
||||
return;
|
||||
}
|
||||
qDebug() << "Unhandled Configuration notification" << notif;
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
#ifndef BASICCONFIGURATION_H
|
||||
#define BASICCONFIGURATION_H
|
||||
|
||||
#include <QObject>
|
||||
#include "jsonrpc/jsonhandler.h"
|
||||
|
||||
class JsonRpcClient;
|
||||
|
||||
class BasicConfiguration : public JsonHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool debugServerEnabled READ debugServerEnabled WRITE setDebugServerEnabled NOTIFY debugServerEnabledChanged)
|
||||
Q_PROPERTY(QString serverName READ serverName WRITE setServerName NOTIFY serverNameChanged)
|
||||
|
||||
Q_PROPERTY(bool cloudEnabled READ cloudEnabled WRITE setCloudEnabled NOTIFY cloudEnabledChanged)
|
||||
|
||||
public:
|
||||
explicit BasicConfiguration(JsonRpcClient* client, QObject *parent = nullptr);
|
||||
|
||||
QString nameSpace() const override;
|
||||
|
||||
bool debugServerEnabled() const;
|
||||
void setDebugServerEnabled(bool debugServerEnabled);
|
||||
|
||||
QString serverName() const;
|
||||
void setServerName(const QString &serverName);
|
||||
|
||||
bool cloudEnabled() const;
|
||||
void setCloudEnabled(bool cloudEnabled);
|
||||
|
||||
void init();
|
||||
|
||||
private:
|
||||
Q_INVOKABLE void getConfigurationsResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void getCloudConfigurationResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void setDebugServerEnabledResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void setServerNameResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void setCloudEnabledResponse(const QVariantMap ¶ms);
|
||||
|
||||
Q_INVOKABLE void notificationReceived(const QVariantMap ¬ification);
|
||||
|
||||
signals:
|
||||
void debugServerEnabledChanged();
|
||||
void serverNameChanged();
|
||||
void cloudEnabledChanged();
|
||||
|
||||
private:
|
||||
JsonRpcClient* m_client = nullptr;
|
||||
bool m_debugServerEnabled = false;
|
||||
QString m_serverName;
|
||||
bool m_cloudEnabled = false;
|
||||
};
|
||||
|
||||
#endif // BASICCONFIGURATION_H
|
||||
233
libnymea-app-core/configuration/basicconfiguration.cpp
Normal file
233
libnymea-app-core/configuration/basicconfiguration.cpp
Normal file
@ -0,0 +1,233 @@
|
||||
#include "basicconfiguration.h"
|
||||
#include "serverconfiguration.h"
|
||||
|
||||
#include "jsonrpc/jsonrpcclient.h"
|
||||
|
||||
BasicConfiguration::BasicConfiguration(JsonRpcClient* client, QObject *parent) :
|
||||
JsonHandler(parent),
|
||||
m_client(client),
|
||||
m_tcpServerConfigurations(new ServerConfigurations(this)),
|
||||
m_websocketServerConfigurations(new ServerConfigurations(this))
|
||||
{
|
||||
client->registerNotificationHandler(this, "notificationReceived");
|
||||
}
|
||||
|
||||
QString BasicConfiguration::nameSpace() const
|
||||
{
|
||||
return "Configuration";
|
||||
}
|
||||
|
||||
bool BasicConfiguration::debugServerEnabled() const
|
||||
{
|
||||
return m_debugServerEnabled;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setDebugServerEnabled(bool debugServerEnabled)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("enabled", debugServerEnabled);
|
||||
m_client->sendCommand("Configuration.SetDebugServerEnabled", params, this, "setDebugServerEnabledResponse");
|
||||
}
|
||||
|
||||
QString BasicConfiguration::serverName() const
|
||||
{
|
||||
return m_serverName;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setServerName(const QString &serverName)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("serverName", serverName);
|
||||
m_client->sendCommand("Configuration.SetServerName", params, this, "setServerNameResponse");
|
||||
}
|
||||
|
||||
bool BasicConfiguration::cloudEnabled() const
|
||||
{
|
||||
return m_cloudEnabled;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setCloudEnabled(bool cloudEnabled)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("enabled", cloudEnabled);
|
||||
m_client->sendCommand("Configuration.SetCloudEnabled", params, this, "setCloudEnabledResponse");
|
||||
}
|
||||
|
||||
QString BasicConfiguration::language() const
|
||||
{
|
||||
return m_language;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setLanguage(const QString &language)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("language", language);
|
||||
m_client->sendCommand("Configuration.SetLanguage", params);
|
||||
}
|
||||
|
||||
QString BasicConfiguration::timezone() const
|
||||
{
|
||||
return m_timezone;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setTimezone(const QString &timezone)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("timeZone", timezone);
|
||||
m_client->sendCommand("Configuration.SetTimeZone", params, this, "setTimezoneResponse");
|
||||
}
|
||||
|
||||
QStringList BasicConfiguration::timezones() const
|
||||
{
|
||||
return m_timezones;
|
||||
}
|
||||
|
||||
ServerConfigurations *BasicConfiguration::tcpServerConfigurations() const
|
||||
{
|
||||
return m_tcpServerConfigurations;
|
||||
}
|
||||
|
||||
ServerConfigurations *BasicConfiguration::websocketServerConfigurations() const
|
||||
{
|
||||
return m_websocketServerConfigurations;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setTcpServerConfiguration(ServerConfiguration *configuration) const
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("id", configuration->id());
|
||||
params.insert("address", configuration->address());
|
||||
params.insert("port", configuration->address());
|
||||
params.insert("authentiactionEnabled", configuration->authenticationEnabled());
|
||||
params.insert("sslEnabled", configuration->sslEnabled());
|
||||
m_client->sendCommand("Configuration.SetTcpServerConfiguration", params);
|
||||
}
|
||||
|
||||
void BasicConfiguration::deleteTcpServerConfiguration(const QString &id)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("id", id);
|
||||
m_client->sendCommand("Configuration.DeleteTcpServerConfiguration", params, this, "deleteTcpConfigReply");
|
||||
}
|
||||
|
||||
void BasicConfiguration::deleteWebsocketServerConfiguration(const QString &id)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("id", id);
|
||||
m_client->sendCommand("Configuration.DeleteWebSocketServerConfiguration", params, this, "deleteWebSocketConfigReply");
|
||||
}
|
||||
|
||||
QStringList BasicConfiguration::availableLanguages() const
|
||||
{
|
||||
return m_availableLanguages;
|
||||
}
|
||||
|
||||
void BasicConfiguration::init()
|
||||
{
|
||||
m_client->sendCommand("Configuration.GetConfigurations", this, "getConfigurationsResponse");
|
||||
m_client->sendCommand("Configuration.GetAvailableLanguages", this, "getAvailableLanguagesResponse");
|
||||
m_client->sendCommand("Configuration.GetTimeZones", this, "getTimezonesResponse");
|
||||
}
|
||||
|
||||
void BasicConfiguration::getConfigurationsResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "have config reply" << params;
|
||||
QVariantMap basicConfig = params.value("params").toMap().value("basicConfiguration").toMap();
|
||||
m_debugServerEnabled = basicConfig.value("debugServerEnabled").toBool();
|
||||
emit debugServerEnabledChanged();
|
||||
m_serverName = basicConfig.value("serverName").toString();
|
||||
emit serverNameChanged();
|
||||
m_language = basicConfig.value("language").toString();
|
||||
emit languageChanged();
|
||||
m_timezone = basicConfig.value("timeZone").toString();
|
||||
emit timezoneChanged();
|
||||
QVariantMap cloudConfig = params.value("params").toMap().value("cloud").toMap();
|
||||
m_cloudEnabled = cloudConfig.value("enabled").toBool();
|
||||
emit cloudEnabledChanged();
|
||||
|
||||
tcpServerConfigurations()->clear();
|
||||
foreach (const QVariant &tcpServerVariant, params.value("params").toMap().value("tcpServerConfigurations").toList()) {
|
||||
qDebug() << "tcp server config:" << tcpServerVariant;
|
||||
QVariantMap tcpConfigMap = tcpServerVariant.toMap();
|
||||
ServerConfiguration *config = new ServerConfiguration(tcpConfigMap.value("id").toString(), QHostAddress(tcpConfigMap.value("address").toString()), tcpConfigMap.value("port").toInt(), tcpConfigMap.value("authenticationEnabled").toBool(), tcpConfigMap.value("sslEnabled").toBool());
|
||||
m_tcpServerConfigurations->addConfiguration(config);
|
||||
}
|
||||
websocketServerConfigurations()->clear();
|
||||
foreach (const QVariant &websocketServerVariant, params.value("params").toMap().value("webSocketServerConfigurations").toList()) {
|
||||
QVariantMap websocketConfigMap = websocketServerVariant.toMap();
|
||||
ServerConfiguration *config = new ServerConfiguration(websocketConfigMap.value("id").toString(), QHostAddress(websocketConfigMap.value("address").toString()), websocketConfigMap.value("port").toInt(), websocketConfigMap.value("authenticationEnabled").toBool(), websocketConfigMap.value("sslEnabled").toBool());
|
||||
m_websocketServerConfigurations->addConfiguration(config);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicConfiguration::getCloudConfigurationResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Cloud config reply" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setDebugServerEnabledResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Debug server set:" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setServerNameResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Server name set:" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::setCloudEnabledResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Set cloud enabled:" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::getAvailableLanguagesResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
// qDebug() << "Get available languages response" << params;
|
||||
m_availableLanguages = params.value("params").toMap().value("languages").toStringList();
|
||||
emit availableLanguagesChanged();
|
||||
}
|
||||
|
||||
void BasicConfiguration::getTimezonesResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
// qDebug() << "Get timezones response" << params;
|
||||
m_timezones = params.value("params").toMap().value("timeZones").toStringList();
|
||||
emit timezonesChanged();
|
||||
}
|
||||
|
||||
void BasicConfiguration::setTimezoneResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Set timezones response" << params;
|
||||
}
|
||||
|
||||
void BasicConfiguration::deleteTcpConfigReply(const QVariantMap ¶ms)
|
||||
{
|
||||
if (params.value("params").toMap().value("configurationError").toString() == "ConfigurationErrorNoError") {
|
||||
}
|
||||
}
|
||||
|
||||
void BasicConfiguration::deleteWebSocketConfigReply(const QVariantMap ¶ms)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BasicConfiguration::notificationReceived(const QVariantMap ¬ification)
|
||||
{
|
||||
QString notif = notification.value("notification").toString();
|
||||
if (notif == "Configuration.BasicConfigurationChanged") {
|
||||
QVariantMap params = notification.value("params").toMap().value("basicConfiguration").toMap();
|
||||
qDebug() << "notif" << params;
|
||||
m_debugServerEnabled = params.value("debugServerEnabled").toBool();
|
||||
emit debugServerEnabled();
|
||||
m_serverName = params.value("serverName").toString();
|
||||
emit serverNameChanged();
|
||||
return;
|
||||
}
|
||||
if (notif == "Configuration.CloudConfigurationChanged") {
|
||||
QVariantMap params = notification.value("params").toMap().value("cloudConfiguration").toMap();
|
||||
qDebug() << "notif" << params;
|
||||
m_cloudEnabled = params.value("enabled").toBool();
|
||||
emit cloudEnabledChanged();
|
||||
return;
|
||||
}
|
||||
qDebug() << "Unhandled Configuration notification" << notif;
|
||||
}
|
||||
98
libnymea-app-core/configuration/basicconfiguration.h
Normal file
98
libnymea-app-core/configuration/basicconfiguration.h
Normal file
@ -0,0 +1,98 @@
|
||||
#ifndef BASICCONFIGURATION_H
|
||||
#define BASICCONFIGURATION_H
|
||||
|
||||
#include <QObject>
|
||||
#include "jsonrpc/jsonhandler.h"
|
||||
#include "serverconfigurations.h"
|
||||
|
||||
class JsonRpcClient;
|
||||
|
||||
class BasicConfiguration : public JsonHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool debugServerEnabled READ debugServerEnabled WRITE setDebugServerEnabled NOTIFY debugServerEnabledChanged)
|
||||
Q_PROPERTY(QString serverName READ serverName WRITE setServerName NOTIFY serverNameChanged)
|
||||
Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged)
|
||||
Q_PROPERTY(QString timezone READ timezone WRITE setTimezone NOTIFY timezoneChanged)
|
||||
|
||||
Q_PROPERTY(bool cloudEnabled READ cloudEnabled NOTIFY cloudEnabledChanged)
|
||||
|
||||
Q_PROPERTY(QStringList availableLanguages READ availableLanguages NOTIFY availableLanguagesChanged)
|
||||
Q_PROPERTY(QStringList timezones READ timezones NOTIFY timezonesChanged)
|
||||
|
||||
Q_PROPERTY(ServerConfigurations* tcpServerConfigurations READ tcpServerConfigurations CONSTANT)
|
||||
Q_PROPERTY(ServerConfigurations* websocketServerConfigurations READ websocketServerConfigurations CONSTANT)
|
||||
|
||||
public:
|
||||
explicit BasicConfiguration(JsonRpcClient* client, QObject *parent = nullptr);
|
||||
|
||||
QString nameSpace() const override;
|
||||
|
||||
bool debugServerEnabled() const;
|
||||
void setDebugServerEnabled(bool debugServerEnabled);
|
||||
|
||||
QString serverName() const;
|
||||
void setServerName(const QString &serverName);
|
||||
|
||||
bool cloudEnabled() const;
|
||||
void setCloudEnabled(bool cloudEnabled);
|
||||
|
||||
QString language() const;
|
||||
void setLanguage(const QString &language);
|
||||
|
||||
QStringList availableLanguages() const;
|
||||
|
||||
QString timezone() const;
|
||||
void setTimezone(const QString &timezone);
|
||||
|
||||
QStringList timezones() const;
|
||||
|
||||
ServerConfigurations *tcpServerConfigurations() const;
|
||||
ServerConfigurations *websocketServerConfigurations() const;
|
||||
|
||||
void setTcpServerConfiguration(ServerConfiguration *configuration) const;
|
||||
void setWebsocketServerConfiguration(ServerConfiguration *configuration) const;
|
||||
|
||||
Q_INVOKABLE void deleteTcpServerConfiguration(const QString &id);
|
||||
Q_INVOKABLE void deleteWebsocketServerConfiguration(const QString &id);
|
||||
|
||||
void init();
|
||||
|
||||
private:
|
||||
Q_INVOKABLE void getConfigurationsResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void getCloudConfigurationResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void setDebugServerEnabledResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void setServerNameResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void setCloudEnabledResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void getAvailableLanguagesResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void getTimezonesResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void setTimezoneResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void deleteTcpConfigReply(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void deleteWebSocketConfigReply(const QVariantMap ¶ms);
|
||||
|
||||
Q_INVOKABLE void notificationReceived(const QVariantMap ¬ification);
|
||||
|
||||
signals:
|
||||
void debugServerEnabledChanged();
|
||||
void serverNameChanged();
|
||||
void languageChanged();
|
||||
void availableLanguagesChanged();
|
||||
void timezoneChanged();
|
||||
void timezonesChanged();
|
||||
void cloudEnabledChanged();
|
||||
|
||||
private:
|
||||
JsonRpcClient* m_client = nullptr;
|
||||
bool m_debugServerEnabled = false;
|
||||
QString m_serverName;
|
||||
QString m_language;
|
||||
QStringList m_availableLanguages;
|
||||
QString m_timezone;
|
||||
QStringList m_timezones;
|
||||
bool m_cloudEnabled = false;
|
||||
|
||||
ServerConfigurations *m_tcpServerConfigurations = nullptr;
|
||||
ServerConfigurations *m_websocketServerConfigurations = nullptr;
|
||||
};
|
||||
|
||||
#endif // BASICCONFIGURATION_H
|
||||
37
libnymea-app-core/configuration/serverconfiguration.cpp
Normal file
37
libnymea-app-core/configuration/serverconfiguration.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "serverconfiguration.h"
|
||||
|
||||
ServerConfiguration::ServerConfiguration(const QString &id, const QHostAddress &address, int port, bool authEnabled, bool sslEnabled, QObject *parent):
|
||||
QObject(parent),
|
||||
m_id(id),
|
||||
m_hostAddress(address),
|
||||
m_port(port),
|
||||
m_authEnabled(authEnabled),
|
||||
m_sslEnabled(sslEnabled)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString ServerConfiguration::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
QString ServerConfiguration::address() const
|
||||
{
|
||||
return m_hostAddress.toString();
|
||||
}
|
||||
|
||||
int ServerConfiguration::port() const
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
|
||||
bool ServerConfiguration::authenticationEnabled() const
|
||||
{
|
||||
return m_authEnabled;
|
||||
}
|
||||
|
||||
bool ServerConfiguration::sslEnabled() const
|
||||
{
|
||||
return m_sslEnabled;
|
||||
}
|
||||
33
libnymea-app-core/configuration/serverconfiguration.h
Normal file
33
libnymea-app-core/configuration/serverconfiguration.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef SERVERCONFIGURATION_H
|
||||
#define SERVERCONFIGURATION_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QHostAddress>
|
||||
#include <QUuid>
|
||||
|
||||
class ServerConfiguration : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString id READ id CONSTANT)
|
||||
Q_PROPERTY(QString address READ address CONSTANT)
|
||||
Q_PROPERTY(int port READ port CONSTANT)
|
||||
Q_PROPERTY(bool authenticationEnabled READ authenticationEnabled CONSTANT)
|
||||
Q_PROPERTY(bool sslEnabled READ sslEnabled CONSTANT)
|
||||
public:
|
||||
explicit ServerConfiguration(const QString &id, const QHostAddress &address, int port, bool authEnabled, bool sslEnabled, QObject *parent = nullptr);
|
||||
|
||||
QString id() const;
|
||||
QString address() const;
|
||||
int port() const;
|
||||
bool authenticationEnabled() const;
|
||||
bool sslEnabled() const;
|
||||
|
||||
private:
|
||||
QString m_id;
|
||||
QHostAddress m_hostAddress;
|
||||
int m_port;
|
||||
bool m_authEnabled;
|
||||
bool m_sslEnabled;
|
||||
};
|
||||
|
||||
#endif // SERVERCONFIGURATION_H
|
||||
59
libnymea-app-core/configuration/serverconfigurations.cpp
Normal file
59
libnymea-app-core/configuration/serverconfigurations.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
#include "serverconfigurations.h"
|
||||
#include "serverconfiguration.h"
|
||||
|
||||
ServerConfigurations::ServerConfigurations(QObject *parent) : QAbstractListModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int ServerConfigurations::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return m_list.count();
|
||||
}
|
||||
|
||||
QVariant ServerConfigurations::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
switch (role) {
|
||||
case RoleId:
|
||||
return m_list.at(index.row())->id();
|
||||
case RoleAddress:
|
||||
return m_list.at(index.row())->address();
|
||||
case RolePort:
|
||||
return m_list.at(index.row())->port();
|
||||
case RoleAuthenticationEnabled:
|
||||
return m_list.at(index.row())->authenticationEnabled();
|
||||
case RoleSslEnabled:
|
||||
return m_list.at(index.row())->sslEnabled();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ServerConfigurations::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> roles;
|
||||
roles.insert(RoleId, "id");
|
||||
roles.insert(RoleAddress, "address");
|
||||
roles.insert(RolePort, "port");
|
||||
roles.insert(RoleAuthenticationEnabled, "authenticationEnabled");
|
||||
roles.insert(RoleSslEnabled, "sslEnabled");
|
||||
return roles;
|
||||
}
|
||||
|
||||
void ServerConfigurations::addConfiguration(ServerConfiguration *configuration)
|
||||
{
|
||||
configuration->setParent(this);
|
||||
beginInsertRows(QModelIndex(), m_list.count(), m_list.count());
|
||||
m_list.append(configuration);
|
||||
endInsertRows();
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
void ServerConfigurations::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
qDeleteAll(m_list);
|
||||
m_list.clear();
|
||||
endResetModel();
|
||||
emit countChanged();
|
||||
}
|
||||
41
libnymea-app-core/configuration/serverconfigurations.h
Normal file
41
libnymea-app-core/configuration/serverconfigurations.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef SERVERCONFIGURATIONS_H
|
||||
#define SERVERCONFIGURATIONS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractListModel>
|
||||
|
||||
class ServerConfiguration;
|
||||
|
||||
class ServerConfigurations : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||
|
||||
public:
|
||||
enum Roles {
|
||||
RoleId,
|
||||
RoleAddress,
|
||||
RolePort,
|
||||
RoleAuthenticationEnabled,
|
||||
RoleSslEnabled
|
||||
};
|
||||
Q_ENUM(Roles)
|
||||
|
||||
explicit ServerConfigurations(QObject *parent = nullptr);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
void addConfiguration(ServerConfiguration *configuration);
|
||||
|
||||
void clear();
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
|
||||
private:
|
||||
QList<ServerConfiguration*> m_list;
|
||||
};
|
||||
|
||||
#endif // SERVERCONFIGURATIONS_H
|
||||
@ -99,6 +99,11 @@ QString NymeaConnection::hostAddress() const
|
||||
return m_currentUrl.host();
|
||||
}
|
||||
|
||||
int NymeaConnection::port() const
|
||||
{
|
||||
return m_currentUrl.port();
|
||||
}
|
||||
|
||||
QString NymeaConnection::bluetoothAddress() const
|
||||
{
|
||||
QUrlQuery query(m_currentUrl);
|
||||
|
||||
@ -15,8 +15,9 @@ class NymeaConnection : public QObject
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
|
||||
Q_PROPERTY(QString url READ url NOTIFY currentUrlChanged)
|
||||
Q_PROPERTY(QString hostAddress READ hostAddress NOTIFY connectedChanged)
|
||||
Q_PROPERTY(QString bluetoothAddress READ bluetoothAddress NOTIFY connectedChanged)
|
||||
Q_PROPERTY(QString hostAddress READ hostAddress NOTIFY currentUrlChanged)
|
||||
Q_PROPERTY(int port READ port NOTIFY currentUrlChanged)
|
||||
Q_PROPERTY(QString bluetoothAddress READ bluetoothAddress NOTIFY currentUrlChanged)
|
||||
|
||||
public:
|
||||
explicit NymeaConnection(QObject *parent = nullptr);
|
||||
@ -32,6 +33,7 @@ public:
|
||||
|
||||
QString url() const;
|
||||
QString hostAddress() const;
|
||||
int port() const;
|
||||
QString bluetoothAddress() const;
|
||||
|
||||
void sendData(const QByteArray &data);
|
||||
|
||||
@ -238,7 +238,7 @@ void DeviceManager::getConfiguredDevicesResponse(const QVariantMap ¶ms)
|
||||
value.convert(QVariant::Int);
|
||||
}
|
||||
device->setStateValue(stateTypeId, value);
|
||||
qDebug() << "Set device state value:" << device->stateValue(stateTypeId) << value;
|
||||
// qDebug() << "Set device state value:" << device->stateValue(stateTypeId) << value;
|
||||
}
|
||||
devices()->addDevice(device);
|
||||
}
|
||||
|
||||
@ -131,6 +131,21 @@ void DevicesProxy::setHiddenInterfaces(const QStringList &hiddenInterfaces)
|
||||
}
|
||||
}
|
||||
|
||||
QString DevicesProxy::nameFilter() const
|
||||
{
|
||||
return m_nameFilter;
|
||||
}
|
||||
|
||||
void DevicesProxy::setNameFilter(const QString &nameFilter)
|
||||
{
|
||||
if (m_nameFilter != nameFilter) {
|
||||
m_nameFilter = nameFilter;
|
||||
emit nameFilterChanged();
|
||||
invalidateFilter();
|
||||
countChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool DevicesProxy::filterBatteryCritical() const
|
||||
{
|
||||
return m_filterBatteryCritical;
|
||||
@ -249,5 +264,11 @@ bool DevicesProxy::filterAcceptsRow(int source_row, const QModelIndex &source_pa
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_nameFilter.isEmpty()) {
|
||||
if (!device->name().toLower().contains(m_nameFilter.toLower().trimmed())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ class DevicesProxy : public QSortFilterProxyModel
|
||||
Q_PROPERTY(QString filterTagId READ filterTagId WRITE setFilterTagId NOTIFY filterTagIdChanged)
|
||||
Q_PROPERTY(QStringList shownInterfaces READ shownInterfaces WRITE setShownInterfaces NOTIFY shownInterfacesChanged)
|
||||
Q_PROPERTY(QStringList hiddenInterfaces READ hiddenInterfaces WRITE setHiddenInterfaces NOTIFY hiddenInterfacesChanged)
|
||||
Q_PROPERTY(QString nameFilter READ nameFilter WRITE setNameFilter NOTIFY nameFilterChanged)
|
||||
|
||||
// Setting this to true will imply filtering for "battery" interface
|
||||
Q_PROPERTY(bool filterBatteryCritical READ filterBatteryCritical WRITE setFilterBatteryCritical NOTIFY filterBatteryCriticalChanged)
|
||||
@ -67,6 +68,9 @@ public:
|
||||
QStringList hiddenInterfaces() const;
|
||||
void setHiddenInterfaces(const QStringList &hiddenInterfaces);
|
||||
|
||||
QString nameFilter() const;
|
||||
void setNameFilter(const QString &nameFilter);
|
||||
|
||||
bool filterBatteryCritical() const;
|
||||
void setFilterBatteryCritical(bool filterBatteryCritical);
|
||||
|
||||
@ -84,6 +88,7 @@ signals:
|
||||
void filterTagIdChanged();
|
||||
void shownInterfacesChanged();
|
||||
void hiddenInterfacesChanged();
|
||||
void nameFilterChanged();
|
||||
void filterBatteryCriticalChanged();
|
||||
void filterDisconnectedChanged();
|
||||
void groupByInterfaceChanged();
|
||||
@ -97,6 +102,7 @@ private:
|
||||
QString m_filterTagId;
|
||||
QStringList m_shownInterfaces;
|
||||
QStringList m_hiddenInterfaces;
|
||||
QString m_nameFilter;
|
||||
|
||||
bool m_filterBatteryCritical = false;
|
||||
bool m_filterDisconnected = false;
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "rulemanager.h"
|
||||
#include "logmanager.h"
|
||||
#include "tagsmanager.h"
|
||||
#include "basicconfiguration.h"
|
||||
#include "configuration/basicconfiguration.h"
|
||||
#include "connection/awsclient.h"
|
||||
|
||||
#include "connection/tcpsockettransport.h"
|
||||
|
||||
@ -303,7 +303,7 @@ void JsonRpcClient::sendRequest(const QVariantMap &request)
|
||||
{
|
||||
QVariantMap newRequest = request;
|
||||
newRequest.insert("token", m_token);
|
||||
// qDebug() << "Sending request" << qUtf8Printable(QJsonDocument::fromVariant(newRequest).toJson());
|
||||
qDebug() << "Sending request" << qUtf8Printable(QJsonDocument::fromVariant(newRequest).toJson());
|
||||
m_connection->sendData(QJsonDocument::fromVariant(newRequest).toJson(QJsonDocument::Compact) + "\n");
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ void JsonRpcClient::dataReceived(const QByteArray &data)
|
||||
// qWarning() << "Could not parse json data from nymea" << m_receiveBuffer.left(splitIndex) << error.errorString();
|
||||
return;
|
||||
}
|
||||
// qDebug() << "received response" << qUtf8Printable(jsonDoc.toJson(QJsonDocument::Indented));
|
||||
qDebug() << "received response" << qUtf8Printable(jsonDoc.toJson(QJsonDocument::Indented));
|
||||
m_receiveBuffer = m_receiveBuffer.right(m_receiveBuffer.length() - splitIndex - 1);
|
||||
if (!m_receiveBuffer.isEmpty()) {
|
||||
staticMetaObject.invokeMethod(this, "dataReceived", Qt::QueuedConnection, Q_ARG(QByteArray, QByteArray()));
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
#include "models/logsmodelng.h"
|
||||
#include "models/valuelogsproxymodel.h"
|
||||
#include "models/interfacesproxy.h"
|
||||
#include "basicconfiguration.h"
|
||||
#include "configuration/basicconfiguration.h"
|
||||
#include "wifisetup/networkmanagercontroler.h"
|
||||
#include "wifisetup/wirelessaccesspoint.h"
|
||||
#include "wifisetup/wirelessaccesspoints.h"
|
||||
|
||||
@ -55,7 +55,7 @@ SOURCES += \
|
||||
models/valuelogsproxymodel.cpp \
|
||||
discovery/nymeadiscovery.cpp \
|
||||
logmanager.cpp \
|
||||
basicconfiguration.cpp \
|
||||
configuration/basicconfiguration.cpp \
|
||||
wifisetup/bluetoothdevice.cpp \
|
||||
wifisetup/bluetoothdeviceinfo.cpp \
|
||||
wifisetup/bluetoothdeviceinfos.cpp \
|
||||
@ -78,7 +78,9 @@ SOURCES += \
|
||||
discovery/bluetoothservicediscovery.cpp \
|
||||
connection/cloudtransport.cpp \
|
||||
connection/sigv4utils.cpp \
|
||||
ruletemplates/ruleactionparamtemplate.cpp
|
||||
ruletemplates/ruleactionparamtemplate.cpp \
|
||||
configuration/serverconfiguration.cpp \
|
||||
configuration/serverconfigurations.cpp
|
||||
|
||||
HEADERS += \
|
||||
engine.h \
|
||||
@ -113,7 +115,7 @@ HEADERS += \
|
||||
models/valuelogsproxymodel.h \
|
||||
discovery/nymeadiscovery.h \
|
||||
logmanager.h \
|
||||
basicconfiguration.h \
|
||||
configuration/basicconfiguration.h \
|
||||
wifisetup/bluetoothdevice.h \
|
||||
wifisetup/bluetoothdeviceinfo.h \
|
||||
wifisetup/bluetoothdeviceinfos.h \
|
||||
@ -136,7 +138,9 @@ HEADERS += \
|
||||
ruletemplates/statedescriptortemplate.h \
|
||||
discovery/bluetoothservicediscovery.h \
|
||||
connection/cloudtransport.h \
|
||||
ruletemplates/ruleactionparamtemplate.h
|
||||
ruletemplates/ruleactionparamtemplate.h \
|
||||
configuration/serverconfiguration.h \
|
||||
configuration/serverconfigurations.h
|
||||
|
||||
unix {
|
||||
target.path = /usr/lib
|
||||
|
||||
@ -37,14 +37,38 @@ void PluginsProxy::setPlugins(Plugins *plugins)
|
||||
{
|
||||
m_plugins = plugins;
|
||||
setSourceModel(plugins);
|
||||
setSortRole(Plugins::NameRole);
|
||||
sort(0);
|
||||
}
|
||||
|
||||
bool PluginsProxy::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
bool PluginsProxy::showOnlyConfigurable() const
|
||||
{
|
||||
QVariant leftName = sourceModel()->data(left);
|
||||
QVariant rightName = sourceModel()->data(right);
|
||||
|
||||
return QString::localeAwareCompare(leftName.toString(), rightName.toString()) < 0;
|
||||
return m_showOnlyConfigurable;
|
||||
}
|
||||
|
||||
void PluginsProxy::setShowOnlyConfigurable(bool showOnlyConfigurable)
|
||||
{
|
||||
if (m_showOnlyConfigurable != showOnlyConfigurable) {
|
||||
m_showOnlyConfigurable = showOnlyConfigurable;
|
||||
emit showOnlyConfigurableChanged();
|
||||
invalidateFilter();
|
||||
}
|
||||
}
|
||||
|
||||
Plugin *PluginsProxy::get(int index) const
|
||||
{
|
||||
return m_plugins->get(mapToSource(this->index(index, 0)).row());
|
||||
}
|
||||
|
||||
bool PluginsProxy::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
Q_UNUSED(source_parent)
|
||||
|
||||
Plugin *plugin = m_plugins->get(source_row);
|
||||
if (m_showOnlyConfigurable) {
|
||||
if (plugin->paramTypes()->rowCount() == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -31,19 +31,28 @@
|
||||
class PluginsProxy : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Plugins* plugins READ plugins WRITE setPlugins NOTIFY pluginsChanged)
|
||||
Q_PROPERTY(bool showOnlyConfigurable READ showOnlyConfigurable WRITE setShowOnlyConfigurable NOTIFY showOnlyConfigurableChanged)
|
||||
public:
|
||||
explicit PluginsProxy(QObject *parent = 0);
|
||||
explicit PluginsProxy(QObject *parent = nullptr);
|
||||
|
||||
Plugins *plugins();
|
||||
void setPlugins(Plugins *plugins);
|
||||
|
||||
private:
|
||||
Plugins *m_plugins;
|
||||
bool showOnlyConfigurable() const;
|
||||
void setShowOnlyConfigurable(bool showOnlyConfigurable);
|
||||
|
||||
Q_INVOKABLE Plugin* get(int index) const;
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||
|
||||
signals:
|
||||
void pluginsChanged();
|
||||
void showOnlyConfigurableChanged();
|
||||
|
||||
private:
|
||||
Plugins *m_plugins = nullptr;
|
||||
bool m_showOnlyConfigurable = false;
|
||||
};
|
||||
|
||||
#endif // PLUGINSPROXY_H
|
||||
|
||||
@ -264,5 +264,11 @@
|
||||
<file>ui/images/fingerprint/fingerprint_boxes.json</file>
|
||||
<file>ui/images/fingerprint/fingerprint_segmented.png</file>
|
||||
<file>ui/images/fingerprint.svg</file>
|
||||
<file>ui/components/ListSectionHeader.qml</file>
|
||||
<file>ui/images/find.svg</file>
|
||||
<file>ui/images/erase.svg</file>
|
||||
<file>ui/components/ListFilterInput.qml</file>
|
||||
<file>ui/system/ConnectionInterfacesPage.qml</file>
|
||||
<file>ui/system/ConnectionInterfaceDelegate.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -11,6 +11,13 @@ Page {
|
||||
text: qsTr("Configure Things")
|
||||
onBackPressed: pageStack.pop()
|
||||
|
||||
HeaderButton {
|
||||
imageSource: "../images/find.svg"
|
||||
color: filterInput.shown ? app.accentColor : keyColor
|
||||
onClicked: filterInput.shown = !filterInput.shown
|
||||
|
||||
}
|
||||
|
||||
HeaderButton {
|
||||
imageSource: "../images/add.svg"
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("NewDeviceWizard.qml"))
|
||||
@ -45,41 +52,46 @@ Page {
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
model: DevicesProxy {
|
||||
id: deviceProxy
|
||||
engine: _engine
|
||||
groupByInterface: true
|
||||
}
|
||||
section.property: "baseInterface"
|
||||
section.criteria: ViewSection.FullString
|
||||
section.delegate: ColumnLayout {
|
||||
width: parent.width
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
Layout.topMargin: app.margins
|
||||
text: app.interfaceToString(section)
|
||||
horizontalAlignment: Text.AlignRight
|
||||
}
|
||||
ThinDivider {}
|
||||
|
||||
ListFilterInput {
|
||||
id: filterInput
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
delegate: ThingDelegate {
|
||||
device: deviceProxy.get(index)
|
||||
canDelete: true
|
||||
onClicked: {
|
||||
pageStack.push(Qt.resolvedUrl("devicepages/ConfigureThingPage.qml"), {device: deviceProxy.get(index)})
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
clip: true
|
||||
|
||||
model: DevicesProxy {
|
||||
id: deviceProxy
|
||||
engine: _engine
|
||||
groupByInterface: true
|
||||
nameFilter: filterInput.shown ? filterInput.text : ""
|
||||
}
|
||||
onDeleteClicked: {
|
||||
d.deviceToRemove = deviceProxy.get(index);
|
||||
engine.deviceManager.removeDevice(d.deviceToRemove.id)
|
||||
section.property: "baseInterface"
|
||||
section.criteria: ViewSection.FullString
|
||||
section.delegate: ListSectionHeader {
|
||||
text: app.interfaceToString(section)
|
||||
}
|
||||
|
||||
delegate: ThingDelegate {
|
||||
device: deviceProxy.get(index)
|
||||
canDelete: true
|
||||
onClicked: {
|
||||
pageStack.push(Qt.resolvedUrl("devicepages/ConfigureThingPage.qml"), {device: deviceProxy.get(index)})
|
||||
}
|
||||
onDeleteClicked: {
|
||||
d.deviceToRemove = deviceProxy.get(index);
|
||||
engine.deviceManager.removeDevice(d.deviceToRemove.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EmptyViewPlaceholder {
|
||||
anchors { left: parent.left; right: parent.right; margins: app.margins }
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@ -13,60 +13,43 @@ Page {
|
||||
onBackPressed: pageStack.pop()
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors { left: parent.left; right: parent.right; top: parent.top }
|
||||
Flickable {
|
||||
anchors.fill: parent
|
||||
contentHeight: settingsColumn.implicitHeight
|
||||
interactive: contentHeight > height
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
id: settingsColumn
|
||||
anchors { left: parent.left; right: parent.right; top: parent.top }
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Connected to:")
|
||||
color: Material.accent
|
||||
}
|
||||
RowLayout {
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideMiddle
|
||||
text: engine.connection.url
|
||||
text: qsTr("Connected to:")
|
||||
color: Material.accent
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Disconnect")
|
||||
onClicked: {
|
||||
tabSettings.lastConnectedHost = "";
|
||||
engine.connection.disconnect();
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideMiddle
|
||||
text: engine.connection.url
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Disconnect")
|
||||
onClicked: {
|
||||
tabSettings.lastConnectedHost = "";
|
||||
engine.connection.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ThinDivider {}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
spacing: app.margins
|
||||
Label {
|
||||
text: qsTr("Server name")
|
||||
}
|
||||
TextField {
|
||||
id: nameTextField
|
||||
Layout.fillWidth: true
|
||||
text: engine.basicConfiguration.serverName
|
||||
}
|
||||
Button {
|
||||
text: qsTr("OK")
|
||||
visible: nameTextField.displayText !== engine.basicConfiguration.serverName
|
||||
onClicked: engine.basicConfiguration.serverName = nameTextField.displayText
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
ThinDivider {}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
@ -74,53 +57,119 @@ Page {
|
||||
Layout.rightMargin: app.margins
|
||||
spacing: app.margins
|
||||
Label {
|
||||
text: qsTr("Debug server enabled")
|
||||
text: qsTr("Name")
|
||||
}
|
||||
TextField {
|
||||
id: nameTextField
|
||||
Layout.fillWidth: true
|
||||
text: engine.basicConfiguration.serverName
|
||||
}
|
||||
Switch {
|
||||
id: debugServerEnabledSwitch
|
||||
checked: engine.basicConfiguration.debugServerEnabled
|
||||
onClicked: engine.basicConfiguration.debugServerEnabled = checked
|
||||
Button {
|
||||
text: qsTr("OK")
|
||||
visible: nameTextField.displayText !== engine.basicConfiguration.serverName
|
||||
onClicked: engine.basicConfiguration.serverName = nameTextField.displayText
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: debugServerButton
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
visible: debugServerEnabledSwitch.checked
|
||||
text: qsTr("Open debug interface")
|
||||
onClicked: Qt.openUrlExternally("http://" + engine.connection.hostAddress + "/debug")
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
spacing: app.margins
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Language")
|
||||
}
|
||||
ComboBox {
|
||||
model: engine.basicConfiguration.availableLanguages
|
||||
currentIndex: model.indexOf(engine.basicConfiguration.language)
|
||||
onActivated: {
|
||||
engine.basicConfiguration.language = currentText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
spacing: app.margins
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Time zone")
|
||||
}
|
||||
ComboBox {
|
||||
Layout.minimumWidth: 200
|
||||
model: engine.basicConfiguration.timezones
|
||||
currentIndex: model.indexOf(engine.basicConfiguration.timezone)
|
||||
onActivated: {
|
||||
engine.basicConfiguration.timezone = currentText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/cloud.svg"
|
||||
text: qsTr("Cloud")
|
||||
visible: engine.jsonRpcClient.ensureServerVersion("1.9")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("system/CloudSettingsPage.qml"))
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/plugin.svg"
|
||||
text: qsTr("Plugins")
|
||||
onClicked:pageStack.push(Qt.resolvedUrl("system/PluginsPage.qml"))
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
spacing: app.margins
|
||||
Label {
|
||||
text: qsTr("Debug server enabled")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Switch {
|
||||
id: debugServerEnabledSwitch
|
||||
checked: engine.basicConfiguration.debugServerEnabled
|
||||
onClicked: engine.basicConfiguration.debugServerEnabled = checked
|
||||
}
|
||||
}
|
||||
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/logs.svg"
|
||||
text: qsTr("Log viewer")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("system/LogViewerPage.qml"))
|
||||
}
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/info.svg"
|
||||
text: qsTr("About nymea")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("system/AboutNymeaPage.qml"))
|
||||
Button {
|
||||
id: debugServerButton
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
visible: debugServerEnabledSwitch.checked
|
||||
text: qsTr("Open debug interface")
|
||||
onClicked: Qt.openUrlExternally("http://" + engine.connection.hostAddress + "/debug")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/cloud.svg"
|
||||
text: qsTr("Cloud")
|
||||
visible: engine.jsonRpcClient.ensureServerVersion("1.9")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("system/CloudSettingsPage.qml"))
|
||||
}
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/plugin.svg"
|
||||
text: qsTr("Plugins")
|
||||
onClicked:pageStack.push(Qt.resolvedUrl("system/PluginsPage.qml"))
|
||||
}
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/logs.svg"
|
||||
text: qsTr("Log viewer")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("system/LogViewerPage.qml"))
|
||||
}
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/network-vpn.svg"
|
||||
text: qsTr("Server interfaces")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("system/ConnectionInterfacesPage.qml"))
|
||||
}
|
||||
MeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
iconName: "../images/info.svg"
|
||||
text: qsTr("About %1:core").arg(app.systemName)
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("system/AboutNymeaPage.qml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
38
nymea-app/ui/components/ListFilterInput.qml
Normal file
38
nymea-app/ui/components/ListFilterInput.qml
Normal file
@ -0,0 +1,38 @@
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Controls 2.1
|
||||
import "../components"
|
||||
import "../delegates"
|
||||
import Nymea 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
opacity: shown ? 1 : 0
|
||||
implicitWidth: searchColumn.implicitWidth
|
||||
implicitHeight: shown ? searchColumn.implicitHeight : 0
|
||||
Behavior on implicitHeight {NumberAnimation { duration: 130; easing.type: Easing.InOutQuad }}
|
||||
|
||||
property bool shown: false
|
||||
property alias text: searchTextField.displayText
|
||||
|
||||
ColumnLayout {
|
||||
id: searchColumn
|
||||
anchors { left: parent.left; bottom: parent.bottom; right: parent.right }
|
||||
RowLayout {
|
||||
Layout.margins: app.margins
|
||||
spacing: app.margins
|
||||
TextField {
|
||||
id: searchTextField
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
HeaderButton {
|
||||
imageSource: "../images/erase.svg"
|
||||
onClicked: searchTextField.text = ""
|
||||
enabled: searchTextField.displayText.length > 0
|
||||
color: enabled ? app.accentColor : keyColor
|
||||
}
|
||||
}
|
||||
ThinDivider {}
|
||||
}
|
||||
}
|
||||
17
nymea-app/ui/components/ListSectionHeader.qml
Normal file
17
nymea-app/ui/components/ListSectionHeader.qml
Normal file
@ -0,0 +1,17 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
property alias text: label.text
|
||||
Label {
|
||||
id: label
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
Layout.topMargin: app.margins
|
||||
horizontalAlignment: Text.AlignRight
|
||||
}
|
||||
ThinDivider {}
|
||||
}
|
||||
@ -16,10 +16,13 @@ SwipeDelegate {
|
||||
property string iconName
|
||||
property int iconSize: app.iconSize
|
||||
property color iconColor: app.accentColor
|
||||
property alias iconKeyColor: icon.keyColor
|
||||
property alias secondaryIconName: secondaryIcon.name
|
||||
property alias secondaryIconColor: secondaryIcon.color
|
||||
property alias secondaryIconKeyColor: secondaryIcon.keyColor
|
||||
property alias tertiaryIconName: tertiaryIcon.name
|
||||
property alias tertiaryIconColor: tertiaryIcon.color
|
||||
property alias tertiaryIconKeyColor: tertiaryIcon.keyColor
|
||||
|
||||
signal deleteClicked()
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ MeaListItemDelegate {
|
||||
id: root
|
||||
width: parent.width
|
||||
iconName: deviceClass ? app.interfacesToIcon(deviceClass.interfaces) : ""
|
||||
text: device.name
|
||||
text: device ? device.name : ""
|
||||
progressive: true
|
||||
secondaryIconName: batteryCritical ? "../images/battery/battery-010.svg" : ""
|
||||
tertiaryIconName: disconnected ? "../images/dialog-warning-symbolic.svg" : ""
|
||||
|
||||
170
nymea-app/ui/images/erase.svg
Normal file
170
nymea-app/ui/images/erase.svg
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="96"
|
||||
height="96"
|
||||
id="svg4874"
|
||||
version="1.1"
|
||||
inkscape:version="0.91+devel r"
|
||||
viewBox="0 0 96 96.000001"
|
||||
sodipodi:docname="erase.svg">
|
||||
<defs
|
||||
id="defs4876" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="13.720701"
|
||||
inkscape:cx="49.629384"
|
||||
inkscape:cy="43.339612"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="g4780"
|
||||
showgrid="true"
|
||||
showborder="true"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:bbox-paths="true"
|
||||
inkscape:bbox-nodes="true"
|
||||
inkscape:snap-bbox-edge-midpoints="true"
|
||||
inkscape:snap-bbox-midpoints="true"
|
||||
inkscape:object-paths="true"
|
||||
inkscape:snap-intersection-paths="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:snap-smooth-nodes="true"
|
||||
inkscape:snap-midpoints="true"
|
||||
inkscape:snap-object-midpoints="true"
|
||||
inkscape:snap-center="true"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:snap-global="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid5451"
|
||||
empspacing="8" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="8,-8.0000001"
|
||||
id="guide4063" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="4,-8.0000001"
|
||||
id="guide4065" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,88.000001"
|
||||
id="guide4067" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,92.000001"
|
||||
id="guide4069" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="104,4"
|
||||
id="guide4071" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-5,8.0000001"
|
||||
id="guide4073" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="88,-8.0000001"
|
||||
id="guide4077" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,84.000001"
|
||||
id="guide4074" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="12,-8.0000001"
|
||||
id="guide4076" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="84,-8.0000001"
|
||||
id="guide4080" />
|
||||
<sodipodi:guide
|
||||
position="48,-8.0000001"
|
||||
orientation="1,0"
|
||||
id="guide4170" />
|
||||
<sodipodi:guide
|
||||
position="-8,48"
|
||||
orientation="0,1"
|
||||
id="guide4172" />
|
||||
<sodipodi:guide
|
||||
position="92,-8.0000001"
|
||||
orientation="1,0"
|
||||
id="guide4760" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4879">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(67.857146,-78.50504)">
|
||||
<g
|
||||
transform="matrix(0,-1,-1,0,373.50506,516.50504)"
|
||||
id="g4845"
|
||||
style="display:inline">
|
||||
<g
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-filename="next01.png"
|
||||
transform="matrix(-0.9996045,0,0,1,575.94296,-611.00001)"
|
||||
id="g4778"
|
||||
inkscape:label="Layer 1">
|
||||
<g
|
||||
transform="matrix(-1,0,0,1,575.99999,611)"
|
||||
id="g4780"
|
||||
style="display:inline">
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:4;marker:none;enable-background:accumulate"
|
||||
id="rect4782"
|
||||
width="96.037987"
|
||||
height="96"
|
||||
x="-438.00244"
|
||||
y="345.36221"
|
||||
transform="scale(-1,1)" />
|
||||
<path
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;enable-background:accumulate"
|
||||
d="M 44.933594 23.953125 C 44.933604 23.953125 22.056529 34.707236 2.0371094 51 L 2.0292969 51 C 2.0202969 51.006997 2.0093 51.013787 2 51.021484 L 2.0058594 51.021484 L 2.0058594 51.023438 L 2 51.023438 C 2.009 51.030435 2.0200969 51.037725 2.0292969 51.044922 L 2.0371094 51.044922 C 22.056659 67.337696 44.933604 78.044922 44.933594 78.044922 L 44.933594 78 L 94 78 L 94 51.044922 L 94 51 L 94 24 L 44.933594 24 L 44.933594 23.955078 L 44.933594 23.953125 z M 45.837891 28.023438 L 89.976562 28.023438 L 89.976562 51 L 89.976562 51.044922 L 89.976562 73.978516 L 45.837891 73.978516 C 44.673341 73.426294 26.633924 64.608888 8.8027344 51.021484 C 26.632604 37.429642 44.665521 28.581657 45.837891 28.023438 z "
|
||||
transform="matrix(0,-1,-1.0003957,0,438.00245,441.36222)"
|
||||
id="path4209" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:none;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 373.80469,359.36133 -2.82813,2.83008 28.1836,28.17187 2.82812,-2.83008 -28.18359,-28.17187 z"
|
||||
id="path4216"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:none;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 399.16016,359.36133 -28.1836,28.17187 2.82813,2.83008 28.18359,-28.17187 -2.82812,-2.83008 z"
|
||||
id="path4218"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.1 KiB |
176
nymea-app/ui/images/find.svg
Normal file
176
nymea-app/ui/images/find.svg
Normal file
@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="96"
|
||||
height="96"
|
||||
id="svg4874"
|
||||
version="1.1"
|
||||
inkscape:version="0.91+devel r"
|
||||
viewBox="0 0 96 96.000001"
|
||||
sodipodi:docname="find.svg">
|
||||
<defs
|
||||
id="defs4876" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="3.5967996"
|
||||
inkscape:cx="-36.35177"
|
||||
inkscape:cy="61.234959"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="g4780"
|
||||
showgrid="true"
|
||||
showborder="true"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:bbox-paths="true"
|
||||
inkscape:bbox-nodes="true"
|
||||
inkscape:snap-bbox-edge-midpoints="true"
|
||||
inkscape:snap-bbox-midpoints="true"
|
||||
inkscape:object-paths="true"
|
||||
inkscape:snap-intersection-paths="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:snap-smooth-nodes="true"
|
||||
inkscape:snap-midpoints="true"
|
||||
inkscape:snap-object-midpoints="true"
|
||||
inkscape:snap-center="true"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid5451"
|
||||
empspacing="8" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="8,-8.0000001"
|
||||
id="guide4063" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="4,-8.0000001"
|
||||
id="guide4065" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,88.000001"
|
||||
id="guide4067" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,92.000001"
|
||||
id="guide4069" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="104,4"
|
||||
id="guide4071" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-5,8.0000001"
|
||||
id="guide4073" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="92,-8.0000001"
|
||||
id="guide4075" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="88,-8.0000001"
|
||||
id="guide4077" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,84.000001"
|
||||
id="guide4074" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="12,-8.0000001"
|
||||
id="guide4076" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-5,12"
|
||||
id="guide4078" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="84,-9.0000001"
|
||||
id="guide4080" />
|
||||
<sodipodi:guide
|
||||
position="48,-8.0000001"
|
||||
orientation="1,0"
|
||||
id="guide4170" />
|
||||
<sodipodi:guide
|
||||
position="-8,48"
|
||||
orientation="0,1"
|
||||
id="guide4172" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4879">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(67.857146,-78.50504)">
|
||||
<g
|
||||
transform="matrix(0,-1,-1,0,373.50506,516.50504)"
|
||||
id="g4845"
|
||||
style="display:inline">
|
||||
<g
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-filename="next01.png"
|
||||
transform="matrix(-0.9996045,0,0,1,575.94296,-611.00001)"
|
||||
id="g4778"
|
||||
inkscape:label="Layer 1">
|
||||
<g
|
||||
transform="matrix(-1,0,0,1,575.99999,611)"
|
||||
id="g4780"
|
||||
style="display:inline">
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:4;marker:none;enable-background:accumulate"
|
||||
id="rect4782"
|
||||
width="96.037987"
|
||||
height="96"
|
||||
x="-438.00244"
|
||||
y="345.36221"
|
||||
transform="scale(-1,1)" />
|
||||
<path
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#808080;fill-opacity:1;stroke:none"
|
||||
d="m 364.0904,368.96573 c -0.0215,-0.0161 -0.0354,-0.0404 -0.0567,-0.0566 -0.0253,-0.0201 -0.057,-0.0305 -0.0821,-0.0508 z"
|
||||
id="path4157" />
|
||||
<path
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:125%;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#808080;fill-opacity:1;stroke:none"
|
||||
d="m 364.07673,417.80167 -0.13873,0.10742 c 0.0251,-0.0203 0.0569,-0.0307 0.0821,-0.0508 0.0214,-0.0162 0.0353,-0.0405 0.0567,-0.0566 z"
|
||||
id="path4344" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:none;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 432,400.36133 c 0,19.30739 -15.69992,35 -35.01367,35 -19.31376,0 -35.01367,-15.69261 -35.01367,-35 0,-19.30739 15.69991,-35.00195 35.01367,-35.00195 19.31375,0 35.01367,15.69456 35.01367,35.00195 z m -4,0 c 0,-17.14435 -13.86125,-31.00196 -31.01367,-31.00195 -17.15243,0 -31.01367,13.8576 -31.01367,31.00195 0,17.14434 13.86124,31 31.01367,31 17.15242,0 31.01367,-13.85566 31.01367,-31 z"
|
||||
id="path4116"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:none;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:6.00118685;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 353.08984,352.24023 -4.24218,4.24415 22.67187,22.66406 4.24219,-4.24414 -22.67188,-22.66407 z"
|
||||
id="path4229"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.4 KiB |
@ -25,6 +25,12 @@ Page {
|
||||
qsTr("Select a kind of things") :
|
||||
root.shownInterfaces.length > 0 ? qsTr("Select a %1").arg(app.interfaceToDisplayName(root.shownInterfaces[0])) : qsTr("Select a thing")
|
||||
onBackPressed: root.backPressed()
|
||||
|
||||
HeaderButton {
|
||||
imageSource: "../images/find.svg"
|
||||
color: filterInput.shown ? app.accentColor : keyColor
|
||||
onClicked: filterInput.shown = !filterInput.shown
|
||||
}
|
||||
}
|
||||
|
||||
InterfacesProxy {
|
||||
@ -35,6 +41,8 @@ Page {
|
||||
DevicesProxy {
|
||||
id: devicesProxy
|
||||
engine: _engine
|
||||
groupByInterface: true
|
||||
nameFilter: filterInput.shown ? filterInput.text : ""
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
@ -50,11 +58,21 @@ Page {
|
||||
}
|
||||
ThinDivider { visible: root.allowSelectAny }
|
||||
|
||||
ListFilterInput {
|
||||
id: filterInput
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: root.selectInterface ? interfacesProxy : devicesProxy
|
||||
clip: true
|
||||
section.property: "baseInterface"
|
||||
section.criteria: ViewSection.FullString
|
||||
section.delegate: ListSectionHeader {
|
||||
text: app.interfaceToString(section)
|
||||
}
|
||||
delegate: MeaListItemDelegate {
|
||||
width: parent.width
|
||||
text: root.selectInterface ? model.displayName : model.name
|
||||
|
||||
26
nymea-app/ui/system/ConnectionInterfaceDelegate.qml
Normal file
26
nymea-app/ui/system/ConnectionInterfaceDelegate.qml
Normal file
@ -0,0 +1,26 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import Nymea 1.0
|
||||
import "../components"
|
||||
|
||||
MeaListItemDelegate {
|
||||
text: model.address
|
||||
subText: model.port
|
||||
iconName: "../images/network-wifi-symbolic.svg"
|
||||
progressive: false
|
||||
iconColor: {
|
||||
if ((engine.connection.hostAddress === model.address || model.address === "0.0.0.0")
|
||||
&& engine.connection.port === model.port) {
|
||||
return app.accentColor
|
||||
}
|
||||
return iconKeyColor
|
||||
}
|
||||
|
||||
secondaryIconName: "../images/account.svg"
|
||||
secondaryIconColor: model.authenticationEnabled ? app.accentColor : secondaryIconKeyColor
|
||||
tertiaryIconName: "../images/network-secure.svg"
|
||||
tertiaryIconColor: model.sslEnabled ? app.accentColor : tertiaryIconKeyColor
|
||||
|
||||
// canDelete: true
|
||||
}
|
||||
63
nymea-app/ui/system/ConnectionInterfacesPage.qml
Normal file
63
nymea-app/ui/system/ConnectionInterfacesPage.qml
Normal file
@ -0,0 +1,63 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import Nymea 1.0
|
||||
import "../components"
|
||||
|
||||
Page {
|
||||
id: root
|
||||
header: GuhHeader {
|
||||
text: qsTr("Connection interfaces")
|
||||
onBackPressed: pageStack.pop();
|
||||
}
|
||||
|
||||
Flickable {
|
||||
anchors.fill: parent
|
||||
contentHeight: connectionsColumn.implicitHeight
|
||||
interactive: contentHeight > height
|
||||
|
||||
ColumnLayout {
|
||||
id: connectionsColumn
|
||||
anchors { left: parent.left; top: parent.top; right: parent.right }
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
Layout.topMargin: app.margins
|
||||
text: qsTr("TCP Server Interfaces")
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: engine.basicConfiguration.tcpServerConfigurations
|
||||
delegate: ConnectionInterfaceDelegate {
|
||||
Layout.fillWidth: true
|
||||
onDeleteClicked: {
|
||||
print("should delete")
|
||||
engine.basicConfiguration.deleteTcpServerConfiguration(model.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
Layout.topMargin: app.margins
|
||||
text: qsTr("WebSocket Server Interfaces")
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: engine.basicConfiguration.websocketServerConfigurations
|
||||
delegate: ConnectionInterfaceDelegate {
|
||||
Layout.fillWidth: true
|
||||
onDeleteClicked: {
|
||||
print("should delete", model.id)
|
||||
engine.basicConfiguration.deleteWebsocketServerConfiguration(model.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,18 +11,46 @@ Page {
|
||||
text: qsTr("Plugins")
|
||||
backButtonVisible: true
|
||||
onBackPressed: pageStack.pop()
|
||||
}
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: engine.deviceManager.plugins
|
||||
clip: true
|
||||
|
||||
delegate: MeaListItemDelegate {
|
||||
width: parent.width
|
||||
iconName: "../images/plugin.svg"
|
||||
text: model.name
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("PluginParamsPage.qml"), {plugin: engine.deviceManager.plugins.get(index)})
|
||||
HeaderButton {
|
||||
imageSource: "../images/configure.svg"
|
||||
color: pluginsProxy.showOnlyConfigurable ? app.accentColor : keyColor
|
||||
onClicked: {
|
||||
pluginsProxy.showOnlyConfigurable = !pluginsProxy.showOnlyConfigurable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("This list shows the list of installed plugins on this %1 box.").arg(app.systemName)
|
||||
}
|
||||
|
||||
ThinDivider {}
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: PluginsProxy {
|
||||
id: pluginsProxy
|
||||
plugins: engine.deviceManager.plugins
|
||||
}
|
||||
clip: true
|
||||
|
||||
delegate: MeaListItemDelegate {
|
||||
property var plugin: pluginsProxy.get(index)
|
||||
width: parent.width
|
||||
iconName: "../images/plugin.svg"
|
||||
text: model.name
|
||||
progressive: plugin.paramTypes.count > 0
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("PluginParamsPage.qml"), {plugin: plugin})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user