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()
{
QString log;
QStringList log;
if ((mPort.transmitMode() == OstProto::kInterleavedTransmit)
&& (mpStream->isFrameVariable()))
{
log += "In 'Interleaved Streams' transmit mode, the count for "
"varying fields at transmit time may not be same as configured\n";
log << tr("In 'Interleaved Streams' transmit mode, the count for "
"varying fields at transmit time may not be same as configured");
}
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::No)
return false;

View File

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

View File

@ -140,7 +140,7 @@ public:
quint64 deviceMacAddress(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);