1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-27 15:26:33 -04:00

FileRecord improvement: added visual indicator for CRC check in the GUI

This commit is contained in:
f4exb 2018-10-09 18:52:39 +02:00
parent bfb7583544
commit 4032d62b3d
4 changed files with 60 additions and 0 deletions

View File

@ -57,6 +57,7 @@ FileSourceGui::FileSourceGui(DeviceUISet *deviceUISet, QWidget* parent) :
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->centerFrequency->setValueRange(7, 0, pow(10,7));
ui->fileNameText->setText(m_fileName);
ui->crcLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
connect(&(m_deviceUISet->m_deviceSourceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
@ -198,6 +199,17 @@ bool FileSourceGui::handleMessage(const Message& message)
return true;
}
else if (FileSourceInput::MsgReportHeaderCRC::match(message))
{
FileSourceInput::MsgReportHeaderCRC& notif = (FileSourceInput::MsgReportHeaderCRC&) message;
if (notif.isOK()) {
ui->crcLabel->setStyleSheet("QLabel { background-color : green; }");
} else {
ui->crcLabel->setStyleSheet("QLabel { background-color : red; }");
}
return true;
}
else
{
return false;
@ -292,6 +304,7 @@ void FileSourceGui::on_showFileDialog_clicked(bool checked __attribute__((unused
{
m_fileName = fileName;
ui->fileNameText->setText(m_fileName);
ui->crcLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
configureFileName();
}
}

View File

@ -287,6 +287,28 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="crcLabel">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>CRC status: Green: OK Red: KO Grey: undefined</string>
</property>
<property name="text">
<string>CRC</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

View File

@ -43,6 +43,7 @@ MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgReportFileSourceAcquisition, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgReportFileSourceStreamData, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgReportFileSourceStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(FileSourceInput::MsgReportHeaderCRC, Message)
FileSourceInput::FileSourceInput(DeviceSourceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
@ -105,6 +106,11 @@ void FileSourceInput::openFileStream()
qCritical("FileSourceInput::openFileStream: bad CRC32 for header: %s", qPrintable(crcHex));
m_recordLength = 0;
}
if (getMessageQueueToGUI()) {
MsgReportHeaderCRC *report = MsgReportHeaderCRC::create(crcOK);
getMessageQueueToGUI()->push(report);
}
}
else
{

View File

@ -228,6 +228,25 @@ public:
{ }
};
class MsgReportHeaderCRC : public Message {
MESSAGE_CLASS_DECLARATION
public:
bool isOK() const { return m_ok; }
static MsgReportHeaderCRC* create(bool ok) {
return new MsgReportHeaderCRC(ok);
}
protected:
bool m_ok;
MsgReportHeaderCRC(bool ok) :
Message(),
m_ok(ok)
{ }
};
FileSourceInput(DeviceSourceAPI *deviceAPI);
virtual ~FileSourceInput();
virtual void destroy();