Browse Source

Supported now CR, LF, and CR+LF line breaks

QGC4.4
lm 15 years ago
parent
commit
076e240a57
  1. 14
      src/ui/DebugConsole.cc
  2. 4
      src/ui/HDDisplay.cc

14
src/ui/DebugConsole.cc

@ -299,12 +299,21 @@ void DebugConsole::receiveBytes(LinkInterface* link, QByteArray bytes)
{ {
// Accept line feed and tab // Accept line feed and tab
case (unsigned char)'\n': case (unsigned char)'\n':
{
if (lastByte != '\r')
{
// Do not break line again for CR+LF
// only break line for single LF bytes
str.append(byte);
}
}
break;
case (unsigned char)'\t': case (unsigned char)'\t':
str.append(byte); str.append(byte);
break; break;
// Catch and ignore carriage return // Catch and ignore carriage return
case (unsigned char)'\r': case (unsigned char)'\r':
// Ignore str.append(byte);
break; break;
default: default:
str.append(QChar(QChar::ReplacementCharacter)); str.append(QChar(QChar::ReplacementCharacter));
@ -324,6 +333,7 @@ void DebugConsole::receiveBytes(LinkInterface* link, QByteArray bytes)
str.append(str2); str.append(str2);
} }
lineBuffer.append(str); lineBuffer.append(str);
lastByte = byte;
} }
else else
{ {
@ -340,8 +350,6 @@ void DebugConsole::receiveBytes(LinkInterface* link, QByteArray bytes)
m_ui->receiveText->ensureCursorVisible(); m_ui->receiveText->ensureCursorVisible();
lineBuffer.clear(); lineBuffer.clear();
} }
} }
else if (link == currLink && holdOn) else if (link == currLink && holdOn)
{ {

4
src/ui/HDDisplay.cc

@ -293,12 +293,12 @@ void HDDisplay::addGauge()
} }
else else
{ {
items.append(QString("%1,%2,%3,%4").arg("-180").arg(key).arg(unit).arg("+180")); items.append(QString("%1,%2,%3,%4").arg("0").arg(key).arg(unit).arg("+100"));
} }
} }
bool ok; bool ok;
QString item = QInputDialog::getItem(this, tr("Add Gauge Instrument"), QString item = QInputDialog::getItem(this, tr("Add Gauge Instrument"),
tr("Format: min, curve name, max[,s]"), items, 0, true, &ok); tr("Format: min, curve name, unit, max[,s]"), items, 0, true, &ok);
if (ok && !item.isEmpty()) if (ok && !item.isEmpty())
{ {
addGauge(item); addGauge(item);

Loading…
Cancel
Save