UX: Show stream check results as a bulleted list

This commit is contained in:
Srivats P 2017-09-30 22:17:06 +05:30
parent a757b9e353
commit c53a1866b8
3 changed files with 23 additions and 17 deletions

View File

@ -1203,20 +1203,26 @@ void StreamConfigDialog::on_leBitsPerSec_textEdited(const QString &text)
bool StreamConfigDialog::isCurrentStreamValid() bool StreamConfigDialog::isCurrentStreamValid()
{ {
QString log; QStringList log;
if ((mPort.transmitMode() == OstProto::kInterleavedTransmit) if ((mPort.transmitMode() == OstProto::kInterleavedTransmit)
&& (mpStream->isFrameVariable())) && (mpStream->isFrameVariable()))
{ {
log += "In 'Interleaved Streams' transmit mode, the count for " log << tr("In 'Interleaved Streams' transmit mode, the count for "
"varying fields at transmit time may not be same as configured\n"; "varying fields at transmit time may not be same as configured");
} }
mpStream->preflightCheck(log); mpStream->preflightCheck(log);
if (log.length()) if (log.size())
{ {
if (QMessageBox::warning(this, "Preflight Check", log + "\nContinue?", if (QMessageBox::warning(this, "Preflight Check",
tr("<p>We found possible problems with this stream -</p>")
+ "<ul>"
+ log.replaceInStrings(QRegExp("(.*)"), "<li>\\1</li>")
.join("\n")
+ "</ul>"
+ tr("<p>Ignore?</p>"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
== QMessageBox::No) == QMessageBox::No)
return false; return false;

View File

@ -581,7 +581,7 @@ quint64 StreamBase::neighborMacAddress(int frameIndex) const
return getNeighborMacAddress(portId_, int(mStreamId->id()), frameIndex); return getNeighborMacAddress(portId_, int(mStreamId->id()), frameIndex);
} }
bool StreamBase::preflightCheck(QString &result) const bool StreamBase::preflightCheck(QStringList &result) const
{ {
bool pass = true; bool pass = true;
int count = isFrameSizeVariable() ? frameCount() : 1; int count = isFrameSizeVariable() ? frameCount() : 1;
@ -590,8 +590,8 @@ bool StreamBase::preflightCheck(QString &result) const
{ {
if (frameLen(i) < (frameProtocolLength(i) + kFcsSize)) if (frameLen(i) < (frameProtocolLength(i) + kFcsSize))
{ {
result += QString("One or more frames may be truncated - " result << QObject::tr("One or more frames may be truncated - "
"frame length should be at least %1.\n") "frame length should be at least %1")
.arg(frameProtocolLength(i) + kFcsSize); .arg(frameProtocolLength(i) + kFcsSize);
pass = false; pass = false;
break; break;
@ -602,8 +602,8 @@ bool StreamBase::preflightCheck(QString &result) const
{ {
if (frameLen(i) > 1522) if (frameLen(i) > 1522)
{ {
result += QString("Jumbo frames may be truncated or dropped " result << QObject::tr("Jumbo frames may be truncated or dropped "
"if not supported by the hardware\n"); "if not supported by the hardware");
pass = false; pass = false;
break; break;
} }
@ -611,12 +611,12 @@ bool StreamBase::preflightCheck(QString &result) const
if (frameCount() <= averagePacketRate() && nextWhat() != e_nw_goto_id) if (frameCount() <= averagePacketRate() && nextWhat() != e_nw_goto_id)
{ {
result += QObject::tr("Only %L1 frames at the rate of " result << QObject::tr("Only %L1 frames at the rate of "
"%L2 frames/sec are configured to be transmitted - " "%L2 frames/sec are configured to be transmitted. "
"transmission will last for only %L3 second " "Transmission will last for only %L3 second - "
"(if you wish to transmit for a longer duration, " "to transmit for a longer duration, "
"increase the number of bursts/packets and/or set the " "increase the number of packets (bursts) and/or "
"'After this stream' action as 'Goto First').\n") "set the 'After this stream' action as 'Goto First'")
.arg(frameCount()) .arg(frameCount())
.arg(averagePacketRate(), 0, 'f', 2) .arg(averagePacketRate(), 0, 'f', 2)
.arg(frameCount()/averagePacketRate(), 0, 'f'); .arg(frameCount()/averagePacketRate(), 0, 'f');

View File

@ -140,7 +140,7 @@ public:
quint64 deviceMacAddress(int frameIndex) const; quint64 deviceMacAddress(int frameIndex) const;
quint64 neighborMacAddress(int frameIndex) const; quint64 neighborMacAddress(int frameIndex) const;
bool preflightCheck(QString &result) const; bool preflightCheck(QStringList &result) const;
static bool StreamLessThan(StreamBase* stream1, StreamBase* stream2); static bool StreamLessThan(StreamBase* stream1, StreamBase* stream2);