Merge PR #385: Add ID to the thing config page
This commit is contained in:
commit
6f2986d3ce
@ -130,7 +130,7 @@ Interfaces::Interfaces(QObject *parent) : QAbstractListModel(parent)
|
||||
addInterface("extendedevcharger", tr("EV chargers"), {"evcharger"});
|
||||
addStateType("extendedevcharger", "maxChargingCurrent", QVariant::UInt, true, tr("Maximum charging current"), tr("Maximum charging current changed"), tr("Set maximum charging current"));
|
||||
|
||||
addInterface("heating", tr("Heatings"));
|
||||
addInterface("heating", tr("Heating"));
|
||||
addStateType("heating", "power", QVariant::Bool, true, tr("Heating enabled"), tr("Heating enabled changed"), tr("Enable heating"));
|
||||
|
||||
addInterface("extendedheating", tr("Heatings"), {"heating"});
|
||||
|
||||
@ -30,6 +30,9 @@
|
||||
|
||||
#include "platformhelper.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
|
||||
PlatformHelper::PlatformHelper(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
@ -85,3 +88,13 @@ void PlatformHelper::setBottomPanelColor(const QColor &color)
|
||||
emit bottomPanelColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void PlatformHelper::toClipBoard(const QString &text)
|
||||
{
|
||||
QApplication::clipboard()->setText(text);
|
||||
}
|
||||
|
||||
QString PlatformHelper::fromClipBoard()
|
||||
{
|
||||
return QApplication::clipboard()->text();
|
||||
}
|
||||
|
||||
@ -85,6 +85,9 @@ public:
|
||||
|
||||
Q_INVOKABLE virtual void vibrate(HapticsFeedback feedbackType) = 0;
|
||||
|
||||
Q_INVOKABLE virtual void toClipBoard(const QString &text);
|
||||
Q_INVOKABLE virtual QString fromClipBoard();
|
||||
|
||||
signals:
|
||||
void permissionsRequestFinished();
|
||||
void screenTimeoutChanged();
|
||||
|
||||
@ -110,42 +110,36 @@ SettingsPageBase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Information")
|
||||
color: app.accentColor
|
||||
}
|
||||
RowLayout {
|
||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins
|
||||
Label {
|
||||
text: qsTr("Vendor:")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label {
|
||||
text: engine.deviceManager.vendors.getVendor(root.deviceClass.vendorId).displayName
|
||||
}
|
||||
|
||||
NymeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Vendor:")
|
||||
subText: engine.deviceManager.vendors.getVendor(root.deviceClass.vendorId).displayName
|
||||
progressive: false
|
||||
}
|
||||
RowLayout {
|
||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins
|
||||
Label {
|
||||
text: qsTr("Type:")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label {
|
||||
text: root.deviceClass.displayName
|
||||
NymeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Type:")
|
||||
subText: root.deviceClass.displayName
|
||||
progressive: false
|
||||
}
|
||||
NymeaListItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("ID:")
|
||||
subText: root.device.id.toString().replace(/[{}]/g, "")
|
||||
progressive: false
|
||||
onClicked: {
|
||||
PlatformHelper.toClipBoard(root.device.id.toString().replace(/[{}]/g, ""));
|
||||
ToolTip.show(qsTr("ID copied to clipboard"), 500);
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
Layout.topMargin: app.margins
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Parameters")
|
||||
color: app.accentColor
|
||||
visible: root.deviceClass.paramTypes.count > 0
|
||||
visible: root.device.params.count > 0
|
||||
}
|
||||
|
||||
Repeater {
|
||||
@ -158,13 +152,8 @@ SettingsPageBase {
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
Layout.topMargin: app.margins
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Input/Output Connections")
|
||||
color: app.accentColor
|
||||
visible: ioModel.count > 0
|
||||
}
|
||||
|
||||
@ -224,13 +213,8 @@ SettingsPageBase {
|
||||
}
|
||||
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
Layout.topMargin: app.margins
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Settings")
|
||||
color: app.accentColor
|
||||
visible: root.deviceClass.settingsTypes.count > 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user