Reinserts original comments
This commit is contained in:
112 files changed
+7113
-5131
No files matched your search
@@ -1,17 +1,17 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
|
||||
// manual class headers
|
||||
#include "LogViewWidget.hpp"
|
||||
|
||||
#include "LogViewField.hpp"
|
||||
@@ -23,7 +23,7 @@
|
||||
namespace N_LogView
|
||||
{
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
LogViewWidget::LogViewWidget(LogViewField* a_field, QWidget* a_widget, QWidget* a_parent, bool a_readonly)
|
||||
: m_Readonly(a_readonly)
|
||||
, m_Valid(true)
|
||||
@@ -34,21 +34,21 @@ LogViewWidget::LogViewWidget(LogViewField* a_field, QWidget* a_widget, QWidget*
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
uint16_t LogViewWidget::getSize() const
|
||||
{
|
||||
|
||||
// todo: check whether really a standardtype
|
||||
const LogViewXdrStandardType* xdrStandardType = static_cast<const LogViewXdrStandardType*>(m_Field->xdrElement());
|
||||
return xdrStandardType->getValueSize();
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
void LogViewWidget::showMessageBox(const QString &a_errorText) const
|
||||
{
|
||||
QMessageBox::warning(m_Parent, QObject::tr("Fehler"), a_errorText);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
void LogViewWidget::updateToolTip(const QString &a_text)
|
||||
{
|
||||
bool isList = m_Field->valueListSize() > 1 || m_Field->isDynamicArray();
|
||||
@@ -74,7 +74,7 @@ void LogViewWidget::updateToolTip(const QString &a_text)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// fixme: bei 3-byte werten werden fälschlicherweise 4 Bytes angezeigt
|
||||
if (m_Field->isDateTimeField())
|
||||
{
|
||||
m_Widget->setToolTip(QObject::tr("Unixzeit: %1 ").arg(a_text));
|
||||
@@ -83,13 +83,13 @@ void LogViewWidget::updateToolTip(const QString &a_text)
|
||||
{
|
||||
m_Widget->setToolTip(QString());
|
||||
}
|
||||
|
||||
// actual value in hex and binary
|
||||
if (!isList)
|
||||
{
|
||||
int64_t value = a_text.toLong();
|
||||
m_Widget->setToolTip(QStringLiteral("%1<b>%2</b> %3").arg(m_Widget->toolTip(), toHex(value), toBin(value)));
|
||||
}
|
||||
|
||||
// range
|
||||
if (!m_Field->isDateTimeField() && !m_Readonly)
|
||||
{
|
||||
const QString sep(isList ? QString() : QStringLiteral("<br>"));
|
||||
@@ -120,12 +120,12 @@ void LogViewWidget::updateToolTip(const QString &a_text)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
double LogViewWidget::getFloat(const QString& a_text, uint64_t& a_FloatAsData, bool& a_ok, const bool a_reverse)
|
||||
{
|
||||
// INFO_LOG(m_logger) << "a_text=" << a_text.toStdString();
|
||||
|
||||
|
||||
|
||||
//LogViewXdrStandardType::E_ByteOrder byteOrder = ((LogViewXdrStandardType*)m_Field->xdrElement())->getByteOrder();
|
||||
double value;
|
||||
if (8 == getSize())
|
||||
{
|
||||
@@ -136,14 +136,14 @@ double LogViewWidget::getFloat(const QString& a_text, uint64_t& a_FloatAsData, b
|
||||
a_FloatAsData = LogViewTelegram::floatToXdr(value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// show error-message
|
||||
// fixme zeige fehler genauer
|
||||
if (!a_ok)
|
||||
showMessageBox(QStringLiteral("Inalid real value: '%1'").arg(a_text));
|
||||
|
||||
m_Valid = a_ok;
|
||||
|
||||
|
||||
// swap for display data on table
|
||||
if (a_reverse)
|
||||
{
|
||||
int j = getSize() - 1;
|
||||
@@ -157,7 +157,7 @@ double LogViewWidget::getFloat(const QString& a_text, uint64_t& a_FloatAsData, b
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set the upper 4 bytes to 0 for float
|
||||
if (4 == getSize())
|
||||
{
|
||||
((uint8_t*)&a_FloatAsData)[4] = 0;
|
||||
@@ -169,17 +169,17 @@ double LogViewWidget::getFloat(const QString& a_text, uint64_t& a_FloatAsData, b
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Converts a_text into a signed integer and returns it. The
|
||||
// parameter a_ok will be true if all was successful. The
|
||||
// attribute m_Valid will be set to a_ok.
|
||||
// The range will be checked, if the value is out of range, an
|
||||
// error will be shown as messge-box and a_ok will be false.
|
||||
// The input a_text can be a calculation.
|
||||
// ---------------------------------------------------------------
|
||||
int64_t LogViewWidget::getInteger(const QString& a_text, bool& a_ok)
|
||||
{
|
||||
|
||||
// calculate the expression into a number
|
||||
N_SST::IntegerCalculator calculator;
|
||||
N_SST::IntegerCalculator::E_Error error;
|
||||
int64_t value = calculator.calc(a_text.toStdString(), error);
|
||||
@@ -187,7 +187,7 @@ int64_t LogViewWidget::getInteger(const QString& a_text, bool& a_ok)
|
||||
a_ok = true;
|
||||
if (N_SST::IntegerCalculator::e_Ok != error)
|
||||
{
|
||||
|
||||
// todo: show exact error-message
|
||||
if (a_text != m_LastErrorValueText)
|
||||
{
|
||||
showMessageBox(QString::fromUtf8("Die Berechnung '%1' ist falsch").arg(a_text));
|
||||
@@ -197,19 +197,19 @@ int64_t LogViewWidget::getInteger(const QString& a_text, bool& a_ok)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// check the range
|
||||
int64_t highest = m_Field->getHighestValue();
|
||||
if (value > highest)
|
||||
{
|
||||
a_ok = false;
|
||||
|
||||
|
||||
// fixme: dieser Trick mit m_LastErrorValueText ist für den Benutzer etwas verwirrend, da
|
||||
// plötzlich keine Reaktion mehr auf Tab, Ok oder wählen eines anderen Feldes passiert...
|
||||
if (a_text != m_LastErrorValueText)
|
||||
{
|
||||
showMessageBox(QString::fromUtf8("Der Wert '%1' ist zu hoch. Maximalwert: %2").arg(a_text).arg(highest));
|
||||
m_LastErrorValueText = a_text;
|
||||
}
|
||||
return value;
|
||||
return value; // abort
|
||||
}
|
||||
int64_t lowest = m_Field->getLowestValue();
|
||||
if (value < lowest)
|
||||
@@ -220,11 +220,11 @@ int64_t LogViewWidget::getInteger(const QString& a_text, bool& a_ok)
|
||||
showMessageBox(QString::fromUtf8("Der Wert '%1' ist zu tief. Minimalwert: %2").arg(a_text).arg(lowest));
|
||||
m_LastErrorValueText = a_text;
|
||||
}
|
||||
return value;
|
||||
return value; // abort
|
||||
}
|
||||
m_Valid = true;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace N_LogView
|
||||
Reference in new issue
Block a user