Added BCValueType
This commit is contained in:
@@ -28,25 +28,24 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QTableView>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
#include <QStatusBar>
|
||||
|
||||
#include <bcvaluemanager.h>
|
||||
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
|
||||
BCValueManager::BCValueManager()
|
||||
BCValueManager::BCValueManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
loadTypeData();
|
||||
|
||||
qRegisterMetaType<BCValue>("BCValue");
|
||||
|
||||
_transmitter.moveToThread(&_worker);
|
||||
@@ -145,7 +144,7 @@ std::optional<BCValueModel*> BCValueManager::getModel(const QString& key )
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void BCValueManager::loadXml()
|
||||
void BCValueManager::loadBikeData()
|
||||
{
|
||||
auto printAttrs = [](const QXmlStreamReader& xml)
|
||||
{
|
||||
@@ -195,7 +194,7 @@ void BCValueManager::loadXml()
|
||||
if(deviceID.has_value())
|
||||
{
|
||||
BCValueList parsedValues;
|
||||
readDevice( parsedValues );
|
||||
loadDeviceData( parsedValues );
|
||||
if( parsedValues.count() )
|
||||
{
|
||||
BCValueModel* valueModel = new BCValueModel( this );
|
||||
@@ -222,7 +221,7 @@ void BCValueManager::loadXml()
|
||||
|
||||
}
|
||||
|
||||
void BCValueManager::readDevice( BCValueList& parsedValues )
|
||||
void BCValueManager::loadDeviceData( BCValueList& parsedValues )
|
||||
{
|
||||
auto printAttrs = [](const QXmlStreamReader& xml)
|
||||
{
|
||||
@@ -271,9 +270,52 @@ void BCValueManager::readDevice( BCValueList& parsedValues )
|
||||
}
|
||||
}
|
||||
|
||||
void BCValueManager::loadTypeData()
|
||||
{
|
||||
/*
|
||||
Invalid = 0x0,
|
||||
"Text"
|
||||
"Number"
|
||||
"Float"
|
||||
"Percent"
|
||||
"KWh"
|
||||
"Watt"
|
||||
"Km"
|
||||
"Kmh"
|
||||
"Mm"
|
||||
"Sec"
|
||||
"SoC"
|
||||
"Odo"
|
||||
"Date"
|
||||
|
||||
*/
|
||||
//_valueTypes.insert( { BCValueType::TypeID::Invalid, "Invalid" } );
|
||||
|
||||
_valueTypes.insert( "Invalid", { BCValueType::TypeID::Invalid, "Invalid" } );
|
||||
_valueTypes.insert( "Text", { BCValueType::TypeID::Text } );
|
||||
_valueTypes.insert( "Number", { BCValueType::TypeID::Number } );
|
||||
|
||||
_valueTypes.insert( "Float", { BCValueType::TypeID::Float, "", 1.5625} );
|
||||
_valueTypes.insert( "Percent",{ BCValueType::TypeID::Percent, "%", 1.5625 } );
|
||||
_valueTypes.insert( "KWh", { BCValueType::TypeID::KWh, "kwh", 1.5625 } );
|
||||
_valueTypes.insert( "Watt", { BCValueType::TypeID::Watt, "w", 1.5625 } );
|
||||
_valueTypes.insert( "Km", { BCValueType::TypeID::Km, "km", 1.5625 } );
|
||||
_valueTypes.insert( "Kmh", { BCValueType::TypeID::Kmh, "km/h", 0.1 } );
|
||||
_valueTypes.insert( "Mm", { BCValueType::TypeID::Mm, "mm", 1.5625 } );
|
||||
_valueTypes.insert( "Sec", { BCValueType::TypeID::Sec, "s", 1.5625 } );
|
||||
_valueTypes.insert( "SoC", { BCValueType::TypeID::SoC, "%", 1.5625 } );
|
||||
_valueTypes.insert( "Odo", { BCValueType::TypeID::Odo, "km", 1.5625 } );
|
||||
_valueTypes.insert( "Assist", { BCValueType::TypeID::Assist, "", 0 ,4 } );
|
||||
_valueTypes.insert( "Assist", { BCValueType::TypeID::AssistFac, "%" } );
|
||||
_valueTypes.insert( "Date", { BCValueType::TypeID::Date } );
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// --- NEU: Speichern mit QXmlStreamWriter ---
|
||||
void BCValueManager::saveXml()
|
||||
void BCValueManager::saveBikeData()
|
||||
{
|
||||
/*
|
||||
QString fileName = QFileDialog::getSaveFileName(this, "XML speichern", "", "XML Files (*.xml)");
|
||||
|
||||
Reference in New Issue
Block a user