-- fy
This commit is contained in:
@@ -201,7 +201,7 @@ void BCAnimatedDelegate::paint(QPainter *painter, const QStyleOptionViewItem& op
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
if( m_rowOpacities.contains(row))
|
if(_rowOpacities.contains(row))
|
||||||
paintHighlightRow(painter,option,index);
|
paintHighlightRow(painter,option,index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOption
|
|||||||
painter->save();
|
painter->save();
|
||||||
painter->setRenderHint(QPainter::Antialiasing);
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
qreal opacity = m_rowOpacities.value(row);
|
qreal opacity =_rowOpacities.value(row);
|
||||||
painter->setOpacity(opacity);
|
painter->setOpacity(opacity);
|
||||||
// Margin von 4px
|
// Margin von 4px
|
||||||
QRect itemRect = option.rect.adjusted(3, 3, -3, -3);
|
QRect itemRect = option.rect.adjusted(3, 3, -3, -3);
|
||||||
@@ -238,21 +238,6 @@ void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOption
|
|||||||
|
|
||||||
void BCAnimatedDelegate::paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
void BCAnimatedDelegate::paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
if (option.state & QStyle::State_Selected)
|
|
||||||
{
|
|
||||||
// 1. Die originale Highlight-Farbe holen (z.B. das Blau aus dem CSS)
|
|
||||||
QColor highlightColor = option.palette.highlight().color();
|
|
||||||
|
|
||||||
// 2. Transparenz setzen (z.B. nur 30% Deckkraft für "Glass"-Effekt)
|
|
||||||
highlightColor.setAlphaF(0.3); // 0.0 bis 1.0 (float ist oft lesbarer)
|
|
||||||
|
|
||||||
// 3. Zeichnen (Brush setzt die Füllfarbe)
|
|
||||||
painter->fillRect(option.rect, highlightColor);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
||||||
|
|
||||||
qDebug() << " --- paintSLider: " << bcValue.label << ": " << (int)bcValue.valueType;
|
qDebug() << " --- paintSLider: " << bcValue.label << ": " << (int)bcValue.valueType;
|
||||||
@@ -303,10 +288,10 @@ void BCAnimatedDelegate::paintSliderIndicator(QPainter* painter, const QStyleOpt
|
|||||||
void BCAnimatedDelegate::onHighlightRow(int row)
|
void BCAnimatedDelegate::onHighlightRow(int row)
|
||||||
{
|
{
|
||||||
// Alte Animation für diese Zeile stoppen falls vorhanden
|
// Alte Animation für diese Zeile stoppen falls vorhanden
|
||||||
if (m_rowAnimations.contains(row))
|
if (_rowAnimations.contains(row))
|
||||||
{
|
{
|
||||||
m_rowAnimations[row]->stop();
|
_rowAnimations[row]->stop();
|
||||||
m_rowAnimations[row]->deleteLater();
|
_rowAnimations[row]->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
// QVariantAnimation ist flexibler als QPropertyAnimation
|
// QVariantAnimation ist flexibler als QPropertyAnimation
|
||||||
@@ -330,32 +315,32 @@ void BCAnimatedDelegate::onHighlightRow(int row)
|
|||||||
opacity = 1.0 - ((progress - 0.2) / 0.8); // 1->0 in 80%
|
opacity = 1.0 - ((progress - 0.2) / 0.8); // 1->0 in 80%
|
||||||
}
|
}
|
||||||
|
|
||||||
m_rowOpacities[row] = opacity;
|
_rowOpacities[row] = opacity;
|
||||||
updateRow(row);
|
updateRow(row);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(anim, &QVariantAnimation::finished, this, [this, row, anim]()
|
connect(anim, &QVariantAnimation::finished, this, [this, row, anim]()
|
||||||
{
|
{
|
||||||
m_rowOpacities.remove(row);
|
_rowOpacities.remove(row);
|
||||||
m_rowAnimations.remove(row);
|
_rowAnimations.remove(row);
|
||||||
updateRow(row);
|
updateRow(row);
|
||||||
anim->deleteLater();
|
anim->deleteLater();
|
||||||
});
|
});
|
||||||
|
|
||||||
m_rowAnimations[row] = anim;
|
_rowAnimations[row] = anim;
|
||||||
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optional: alle Highlights sofort clearen
|
// Optional: alle Highlights sofort clearen
|
||||||
void BCAnimatedDelegate::clearAllHighlights()
|
void BCAnimatedDelegate::clearAllHighlights()
|
||||||
{
|
{
|
||||||
for(auto* anim : std::as_const(m_rowAnimations))
|
for(auto* anim : std::as_const(_rowAnimations))
|
||||||
{
|
{
|
||||||
anim->stop();
|
anim->stop();
|
||||||
anim->deleteLater();
|
anim->deleteLater();
|
||||||
}
|
}
|
||||||
m_rowAnimations.clear();
|
_rowAnimations.clear();
|
||||||
m_rowOpacities.clear();
|
_rowOpacities.clear();
|
||||||
|
|
||||||
if (_view)
|
if (_view)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,14 +78,18 @@ protected:
|
|||||||
void paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
void paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||||
void paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
void paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||||
|
|
||||||
|
// Das ist ein Quickhack, der Delegate sollte
|
||||||
|
// nichts über die Originaldaten wissen. Die
|
||||||
|
// Datenbeschaffung ist alleine Sache des Models.
|
||||||
|
|
||||||
const BCValueList& _valueList;
|
const BCValueList& _valueList;
|
||||||
QTableView* _view{};
|
QTableView* _view{};
|
||||||
|
|
||||||
QPropertyAnimation* _animation{};
|
QPropertyAnimation* _animation{};
|
||||||
|
|
||||||
|
|
||||||
QHash<int, qreal> m_rowOpacities;
|
QHash<int, qreal> _rowOpacities;
|
||||||
QHash<int, QVariantAnimation*> m_rowAnimations;
|
QHash<int, QVariantAnimation*> _rowAnimations;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -39,27 +39,7 @@ BCThemeSwitchButton::BCThemeSwitchButton(QWidget *parent )
|
|||||||
// Visuelles Setup: Flach, keine Ränder, Hand-Cursor
|
// Visuelles Setup: Flach, keine Ränder, Hand-Cursor
|
||||||
setFlat(true);
|
setFlat(true);
|
||||||
setCursor(Qt::PointingHandCursor);
|
setCursor(Qt::PointingHandCursor);
|
||||||
setFixedSize(24, 24); // Kleiner Footprint im StatusBar
|
setFixedSize(24, 24);
|
||||||
|
|
||||||
// CSS: Transparent, damit es sich nahtlos in den StatusBar einfügt
|
|
||||||
// Schriftgröße etwas erhöhen, damit die Emojis gut erkennbar sind
|
|
||||||
|
|
||||||
/*
|
|
||||||
setStyleSheet(R"(
|
|
||||||
BCThemeSwitchButton
|
|
||||||
{
|
|
||||||
border: none;
|
|
||||||
background-color: transparent;
|
|
||||||
font-size: 11pt;
|
|
||||||
}
|
|
||||||
BCThemeSwitchButton:Hover
|
|
||||||
{
|
|
||||||
background-color: rgba(128, 128, 128, 30);
|
|
||||||
border-radius: 24px;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
*/
|
|
||||||
// Initialer Status (Startet im Dark Mode -> zeigt Mond)
|
|
||||||
updateIcon();
|
updateIcon();
|
||||||
|
|
||||||
connect(this, &QPushButton::clicked, this, &BCThemeSwitchButton::toggleMode);
|
connect(this, &QPushButton::clicked, this, &BCThemeSwitchButton::toggleMode);
|
||||||
@@ -134,53 +114,9 @@ BCDriverStateWidget::BCDriverStateWidget(QWidget* parent)
|
|||||||
void BCDriverStateWidget::onDriverStateChanged(BCDriver::DriverState state, const QString& customMessage)
|
void BCDriverStateWidget::onDriverStateChanged(BCDriver::DriverState state, const QString& customMessage)
|
||||||
{
|
{
|
||||||
_state = state;
|
_state = state;
|
||||||
qDebug() << " --- StateWidget: " << state << " - " << customMessage;
|
|
||||||
updateStyle();
|
updateStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void BCDriverStateWidget::updateStyle()
|
|
||||||
{
|
|
||||||
QString ledStyle;
|
|
||||||
QString labelColor;
|
|
||||||
QString toolTipText;
|
|
||||||
|
|
||||||
switch (_state)
|
|
||||||
{
|
|
||||||
case BCDriver::DriverState::DeviceReady:
|
|
||||||
// FLUENT GREEN (Success)
|
|
||||||
ledStyle = "background-color: #107C10; border: 1px solid #0E600E;#FF5F1F; #FF8C00;<- das isses #FF6700";
|
|
||||||
labelColor = "#FFFFFF"; // Weiß (Hervorgehoben)
|
|
||||||
toolTipText = "Verbindung erfolgreich hergestellt.";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BCDriver::DriverState::Error:
|
|
||||||
// FLUENT RED (Critical)
|
|
||||||
ledStyle = "background-color: #C42B1C; border: 1px solid #A80000;";
|
|
||||||
labelColor = "#FF99A4"; // Ein helleres Rot für Text, damit es auf Dunkel lesbar ist
|
|
||||||
toolTipText = "Kritischer Fehler bei der Verbindung!";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// FLUENT GRAY (Neutral)
|
|
||||||
// Wir machen es dunkelgrau mit hellem Rand -> "Ausgeschaltet"-Look
|
|
||||||
ledStyle = "background-color: #3B3B3B; border: 1px solid #606060;";
|
|
||||||
labelColor = "#9E9E9E"; // Ausgegrauter Text
|
|
||||||
toolTipText = "System ist offline.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Styles anwenden (immer rund machen)
|
|
||||||
_led->setStyleSheet(ledStyle + "border-radius: 6px;");
|
|
||||||
|
|
||||||
// Textfarbe setzen
|
|
||||||
_label->setStyleSheet(QString("color: %1; font-weight: %2;")
|
|
||||||
.arg(labelColor)
|
|
||||||
.arg(_state == BCDriver::DriverState::DeviceReady ? "bold" : "normal"));
|
|
||||||
|
|
||||||
setToolTip(toolTipText);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void BCDriverStateWidget::updateStyle()
|
void BCDriverStateWidget::updateStyle()
|
||||||
{
|
{
|
||||||
@@ -223,27 +159,22 @@ void BCDriverStateWidget::updateStyle()
|
|||||||
ledStyle = "background-color: #107C10; border: 1px solid #0E600E;";
|
ledStyle = "background-color: #107C10; border: 1px solid #0E600E;";
|
||||||
toolTipText = "Verbindung erfolgreich hergestellt.";
|
toolTipText = "Verbindung erfolgreich hergestellt.";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Styles anwenden (immer rund machen)
|
// Styles anwenden (immer rund machen)
|
||||||
_led->setStyleSheet(ledStyle + "border-radius: 6px;");
|
_led->setStyleSheet(ledStyle + "border-radius: 6px;");
|
||||||
|
|
||||||
/*
|
|
||||||
// Textfarbe setzen
|
|
||||||
_setStyleSheet(QString("color: %1; font-weight: %2;")
|
|
||||||
.arg(labelColor)
|
|
||||||
.arg(_state == BCDriver::DriverState::DeviceReady ? "bold" : "normal"));
|
|
||||||
*/
|
|
||||||
setToolTip(toolTipText);
|
setToolTip(toolTipText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief minimale click event
|
||||||
|
*/
|
||||||
|
|
||||||
void BCDriverStateWidget::mouseReleaseEvent(QMouseEvent* event)
|
void BCDriverStateWidget::mouseReleaseEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton)
|
||||||
{
|
|
||||||
emit clicked();
|
emit clicked();
|
||||||
}
|
|
||||||
QWidget::mouseReleaseEvent(event);
|
QWidget::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ void BCTransmitter::onProcessValue()
|
|||||||
uint8_t regID = static_cast<uint8_t> (value.registerID);
|
uint8_t regID = static_cast<uint8_t> (value.registerID);
|
||||||
|
|
||||||
// Für den Fehlerfall: Wir senden den alten Wert einfach zurück
|
// Für den Fehlerfall: Wir senden den alten Wert einfach zurück
|
||||||
uint32_t newValue = value.rawUIntValue;
|
uint32_t newValue = value.rawValue;
|
||||||
BCValue::Flag newState = BCValue::Flag::Failed;;
|
BCValue::Flag newState = BCValue::Flag::Failed;;
|
||||||
|
|
||||||
if(value.flags.testFlag( BCValue::Flag::WriteMe ) )
|
if(value.flags.testFlag( BCValue::Flag::WriteMe ) )
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ BCValue::BCValue( BCDevice::ID deviceID_, BC::ID registerID_)
|
|||||||
QString BCValue::formatValue() const
|
QString BCValue::formatValue() const
|
||||||
{
|
{
|
||||||
if( factor == 1 )
|
if( factor == 1 )
|
||||||
return QString::number( rawUIntValue );
|
return QString::number( rawValue );
|
||||||
|
|
||||||
double result = rawUIntValue * factor;
|
double result = rawValue * factor;
|
||||||
return QString::number(result, 'f', 2);
|
return QString::number(result, 'f', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ double BCValue::calcRatio() const
|
|||||||
return ratio;
|
return ratio;
|
||||||
|
|
||||||
// Die eigentliche Formel
|
// Die eigentliche Formel
|
||||||
ratio = ((rawDoubleValue - min) / range);
|
ratio = ((rawValue - min) / range);
|
||||||
//ratio = (int) qBound( min,ratio, max);
|
//ratio = (int) qBound( min,ratio, max);
|
||||||
}
|
}
|
||||||
return ratio;
|
return ratio;
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ public:
|
|||||||
ValueType valueType{ValueType::Plain};
|
ValueType valueType{ValueType::Plain};
|
||||||
int indexRow{-1};
|
int indexRow{-1};
|
||||||
QString label;
|
QString label;
|
||||||
mutable double rawDoubleValue;
|
mutable uint32_t rawValue{};
|
||||||
mutable uint32_t rawUIntValue;
|
|
||||||
QString unitLabel;
|
QString unitLabel;
|
||||||
double factor{1};
|
double factor{1};
|
||||||
OptDouble optMin;
|
OptDouble optMin;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void BCValueModel::updateValue(int row, BCValue::Flag state, uint32_t rawValue )
|
|||||||
const BCValue& value = *(_valueList[row].get());
|
const BCValue& value = *(_valueList[row].get());
|
||||||
|
|
||||||
value.flags = state;
|
value.flags = state;
|
||||||
value.rawUIntValue = rawValue;
|
value.rawValue = rawValue;
|
||||||
|
|
||||||
QModelIndex idx1 = index(row,1);
|
QModelIndex idx1 = index(row,1);
|
||||||
QModelIndex idx2 = index(row,2);
|
QModelIndex idx2 = index(row,2);
|
||||||
@@ -200,7 +200,7 @@ bool BCValueModel::setData(const QModelIndex& index, const QVariant& variant, in
|
|||||||
// Checken ob Int oder Double
|
// Checken ob Int oder Double
|
||||||
if (variant.canConvert<int>())
|
if (variant.canConvert<int>())
|
||||||
{
|
{
|
||||||
value->rawUIntValue = variant.toInt();
|
value->rawValue = variant.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ void BCXmlLoader::loadXmlBikeData( const QString& fileName )
|
|||||||
qDebug().noquote() << parts.join(" ");
|
qDebug().noquote() << parts.join(" ");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
QMetaEnum bcDeviceEnum{QMetaEnum::fromType<BCDevice::ID>()};
|
QMetaEnum bcDeviceEnum{QMetaEnum::fromType<BCDevice::ID>()};
|
||||||
|
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
@@ -88,22 +87,31 @@ void BCXmlLoader::loadXmlBikeData( const QString& fileName )
|
|||||||
if (token == QXmlStreamReader::StartElement)
|
if (token == QXmlStreamReader::StartElement)
|
||||||
{
|
{
|
||||||
QString deviceType = _xml.attributes().value("Type"_L1).toString();
|
QString deviceType = _xml.attributes().value("Type"_L1).toString();
|
||||||
//printAttrs (_xml);
|
|
||||||
|
|
||||||
|
qDebug() << " --- FETCH 1: " << deviceType;
|
||||||
|
|
||||||
// Wir wollen die Device-ID aus dem XML Tag ermitteln
|
// Wir wollen die Device-ID aus dem XML Tag ermitteln
|
||||||
const char* deviceKey = _xml.attributes().value("Type"_L1).toLatin1().constData();
|
if( deviceType.isEmpty() )
|
||||||
bool ok;
|
{
|
||||||
|
printAttrs (_xml);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QByteArray byteArray = deviceType.toUtf8();
|
||||||
|
const char* deviceKey = byteArray.constData();
|
||||||
|
bool ok=false;
|
||||||
auto optDeviceID = bcDeviceEnum.keyToValue(deviceKey,&ok);
|
auto optDeviceID = bcDeviceEnum.keyToValue(deviceKey,&ok);
|
||||||
//_currentDeviceID = BCDevice::ID( deviceID.value_or( BCDevice::ID::Invalid ) );
|
//_currentDeviceID = BCDevice::ID( deviceID.value_or( BCDevice::ID::Invalid ) );
|
||||||
//if( optDeviceID.has_value())
|
//if( optDeviceID.has_value())
|
||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
qDebug() << " --- Device: " << _xml.name() << ": " << deviceType << " : " << optDeviceID;
|
qDebug() << " --- FETCH 2: Device: " << deviceType << " : " << optDeviceID;
|
||||||
//BCDevice::ID currentDeviceID = BCDevice::ID( optDeviceID.value() );
|
//BCDevice::ID currentDeviceID = BCDevice::ID( optDeviceID.value() );
|
||||||
BCDevice::ID currentDeviceID = BCDevice::ID( optDeviceID );
|
BCDevice::ID currentDeviceID = BCDevice::ID( optDeviceID );
|
||||||
loadXmlBikeDeviceData(currentDeviceID);
|
loadXmlBikeDeviceData(currentDeviceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // if start element
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +135,6 @@ void BCXmlLoader::loadXmlBikeDeviceData(BCDevice::ID deviceID)
|
|||||||
printAttrs (_xml);
|
printAttrs (_xml);
|
||||||
Q_ASSERT(_xml.isStartElement() && _xml.name() == "Device"_L1);
|
Q_ASSERT(_xml.isStartElement() && _xml.name() == "Device"_L1);
|
||||||
|
|
||||||
|
|
||||||
// temporäre Wertliste für neues Device
|
// temporäre Wertliste für neues Device
|
||||||
BCValueList currentValues;
|
BCValueList currentValues;
|
||||||
|
|
||||||
@@ -135,7 +142,7 @@ void BCXmlLoader::loadXmlBikeDeviceData(BCDevice::ID deviceID)
|
|||||||
{
|
{
|
||||||
if( _xml.attributes().hasAttribute(BCTags::ID) )
|
if( _xml.attributes().hasAttribute(BCTags::ID) )
|
||||||
{
|
{
|
||||||
//qDebug() << " --- found: " << _xml.name() << " : " << _xml.attributes().value(BCTags::ID);
|
qDebug() << " --- found: " << _xml.name() << " : " << _xml.attributes().value(BCTags::ID);
|
||||||
|
|
||||||
// füllen des Parameter packs
|
// füllen des Parameter packs
|
||||||
BCValueParams params
|
BCValueParams params
|
||||||
@@ -205,7 +212,8 @@ std::optional<BCValuePtr> BCXmlLoader::makeValue( BCDevice::ID deviceID, const B
|
|||||||
//std::optional<quint64> IDVal = s_bcValueEnum.keyToValue64( params.ID.toLatin1().constData() );
|
//std::optional<quint64> IDVal = s_bcValueEnum.keyToValue64( params.ID.toLatin1().constData() );
|
||||||
bool ok;
|
bool ok;
|
||||||
static QMetaEnum s_bcValueEnum{QMetaEnum::fromType<BC::ID>()};
|
static QMetaEnum s_bcValueEnum{QMetaEnum::fromType<BC::ID>()};
|
||||||
int IDVal = s_bcValueEnum.keyToValue( params.ID.toLatin1().constData(), &ok );
|
QByteArray byteArray = params.ID.toUtf8();
|
||||||
|
int IDVal = s_bcValueEnum.keyToValue( byteArray.constData(), &ok );
|
||||||
qDebug() << " --- should create: " << params.Label;
|
qDebug() << " --- should create: " << params.Label;
|
||||||
//if( IDVal.has_value() )
|
//if( IDVal.has_value() )
|
||||||
if( ok )
|
if( ok )
|
||||||
@@ -218,25 +226,12 @@ std::optional<BCValuePtr> BCXmlLoader::makeValue( BCDevice::ID deviceID, const B
|
|||||||
setIfExists( params.Max, newValue.optMax );
|
setIfExists( params.Max, newValue.optMax );
|
||||||
//setIfExists( params.IsWord, newValue.isWord );
|
//setIfExists( params.IsWord, newValue.isWord );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
newValue.label = params.Label;
|
newValue.label = params.Label;
|
||||||
newValue.unitLabel = params.UnitLabel;
|
newValue.unitLabel = params.UnitLabel;
|
||||||
|
|
||||||
if( s_valueTypes.contains( params.ValueType ) )
|
if( s_valueTypes.contains( params.ValueType ) )
|
||||||
newValue.valueType = s_valueTypes[params.ValueType];
|
newValue.valueType = s_valueTypes[params.ValueType];
|
||||||
|
|
||||||
/*
|
|
||||||
QString ID;
|
|
||||||
QString Label;
|
|
||||||
QString UnitLabel;
|
|
||||||
QString Factor;
|
|
||||||
QString Min;
|
|
||||||
QString Max;
|
|
||||||
QString IsWord;
|
|
||||||
QString ValueType;
|
|
||||||
*/
|
|
||||||
|
|
||||||
qDebug() << " --- created: " << params.Label;
|
qDebug() << " --- created: " << params.Label;
|
||||||
newValue.dumpValue();
|
newValue.dumpValue();
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,21 @@
|
|||||||
|
|
||||||
<Bike name='franken-wheeler'>
|
<Bike name='franken-wheeler'>
|
||||||
|
|
||||||
|
<Device Type='Battery'>
|
||||||
|
<Value ID='Battery_Rev_Hw' Label='Hardware Version' ValueType='Plain' />
|
||||||
|
<Value ID='Battery_Rev_Sw' Label='Software Version' ValueType='Plain' />
|
||||||
|
</Device>
|
||||||
|
|
||||||
|
<Device Type='Motor'>
|
||||||
|
<Value ID='Motor_Rev_Hw' Label='Hardware Version' ValueType='Plain'/>
|
||||||
|
<Value ID='Motor_Rev_Sw' Label='Software Version' ValueType='Plain'/>
|
||||||
|
<Value ID='Motor_Sn_Item_Hi' Label='Motor Part Number' ValueType='Plain' IsWord='1'/>
|
||||||
|
<Value ID='Motor_Sn_Item_Hi' Label='Motor Serial Number' ValueType='Plain' IsWord='1' />
|
||||||
|
<Value ID='Motor_Status_Temperature' Label='Motor Temperature' ValueType='Float' UnitLabel='°C' />
|
||||||
|
<Value ID='Motor_Assist_Maxspeed' Label='Motor max. Speed' UnitLabel='km/h' Factor='0.1' Min='0' Max='70' ValueType='Float' />
|
||||||
|
<Value ID='Motor_Geometry_Circ_Hi' Label='Wheel Circumference' IsWord='1' UnitLabel='mm' Min='0' Max='2300' ValueType='Number' Factor='1.5625' />
|
||||||
|
</Device>
|
||||||
|
|
||||||
<Device Type='Console'>
|
<Device Type='Console'>
|
||||||
<Value ID='Cons_Rev_Hw' Label='Hardware Version' ValueType='Plain'/>
|
<Value ID='Cons_Rev_Hw' Label='Hardware Version' ValueType='Plain'/>
|
||||||
<Value ID='Cons_Rev_Sw' Label='Software Version' ValueType='Plain'/>
|
<Value ID='Cons_Rev_Sw' Label='Software Version' ValueType='Plain'/>
|
||||||
@@ -30,21 +45,6 @@
|
|||||||
</Device>
|
</Device>
|
||||||
|
|
||||||
|
|
||||||
<Device Type='Motor'>
|
|
||||||
<Value ID='Motor_Rev_Hw' Label='Hardware Version' ValueType='Plain'/>
|
|
||||||
<Value ID='Motor_Rev_Sw' Label='Software Version' ValueType='Plain'/>
|
|
||||||
<Value ID='Motor_Sn_Item_Hi' Label='Motor Part Number' ValueType='Plain' IsWord='1'/>
|
|
||||||
<Value ID='Motor_Sn_Item_Hi' Label='Motor Serial Number' ValueType='Plain' IsWord='1' />
|
|
||||||
<Value ID='Motor_Status_Temperature' Label='Motor Temperature' ValueType='Float' UnitLabel='°C' />
|
|
||||||
<Value ID='Motor_Assist_Maxspeed' Label='Motor max. Speed' UnitLabel='km/h' Factor='0.1' Min='0' Max='70' />
|
|
||||||
<Value ID='Motor_Geometry_Circ_Hi' Label='Wheel Circumference' IsWord='1' UnitLabel='mm' Min='0' Max='2300' Factor='1.5625' />
|
|
||||||
</Device>
|
|
||||||
|
|
||||||
<Device Type='Battery'>
|
|
||||||
<Value ID='Battery_Rev_Hw' Label='Hardware Version' />
|
|
||||||
<Value ID='Battery_Rev_Sw' Label='Software Version' />
|
|
||||||
</Device>
|
|
||||||
|
|
||||||
</Bike>
|
</Bike>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
Reference in New Issue
Block a user