SDRDaemonSink: GUI cosmetic changes

pull/60/head
f4exb 2017-06-06 01:53:21 +02:00
rodzic 5e62da4437
commit e4332a16b6
3 zmienionych plików z 70 dodań i 10 usunięć

Wyświetl plik

@ -60,6 +60,9 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
nn_setsockopt (m_nnSender, NN_SOL_SOCKET, NN_SNDTIMEO, &millis, sizeof (millis));
assert (rc == 0);
m_countUnrecoverable = 0;
m_countRecovered = 0;
m_paletteGreenText.setColor(QPalette::WindowText, Qt::green);
m_paletteRedText.setColor(QPalette::WindowText, Qt::red);
m_paletteWhiteText.setColor(QPalette::WindowText, Qt::white);
@ -83,6 +86,10 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
m_time.start();
displayEventCounts();
displayEventTimer();
displaySettings();
sendControl(true);
sendSettings();
@ -509,6 +516,32 @@ void SDRdaemonSinkGui::on_startStop_toggled(bool checked)
}
}
void SDRdaemonSinkGui::on_eventCountsReset_clicked(bool checked __attribute__((unused)))
{
m_countUnrecoverable = 0;
m_countRecovered = 0;
m_time.start();
displayEventCounts();
displayEventTimer();
}
void SDRdaemonSinkGui::displayEventCounts()
{
QString nstr = QString("%1").arg(m_countUnrecoverable, 3, 10, QChar('0'));
ui->eventUnrecText->setText(nstr);
nstr = QString("%1").arg(m_countRecovered, 3, 10, QChar('0'));
ui->eventRecText->setText(nstr);
}
void SDRdaemonSinkGui::displayEventTimer()
{
int elapsedTimeMillis = m_time.elapsed();
QTime recordLength(0, 0, 0, 0);
recordLength = recordLength.addSecs(elapsedTimeMillis/1000);
QString s_time = recordLength.toString("hh:mm:ss");
ui->eventCountsTimeText->setText(s_time);
}
void SDRdaemonSinkGui::updateWithStreamTime()
{
int t_sec = 0;
@ -540,11 +573,11 @@ void SDRdaemonSinkGui::tick()
if ((len > 0) && msgBuf)
{
std::string msg((char *) msgBuf, len);
//qDebug("SDRdaemonSinkGui::tick: %s", msg.c_str());
std::vector<std::string> strs;
boost::split(strs, msg, boost::is_any_of(":"));
unsigned int nbTokens = strs.size();
unsigned int status = 0;
bool updateEventCounts = false;
if (nbTokens > 0) // at least the queue length is given
{
@ -591,10 +624,22 @@ void SDRdaemonSinkGui::tick()
if (nbTokens > 1) // the quality status is given also
{
if (strs[1] == "2") {
if (strs[1] == "2")
{
status = 2;
} else if (strs[1] == "1") {
}
else if (strs[1] == "1")
{
status = 1;
if (m_countUnrecoverable < 999) m_countUnrecoverable++;
updateEventCounts = true;
qDebug("SDRdaemonSinkGui::tick: %s", msg.c_str());
}
else
{
if (m_countRecovered < 999) m_countRecovered++;
updateEventCounts = true;
qDebug("SDRdaemonSinkGui::tick: %s", msg.c_str());
}
}
@ -610,6 +655,13 @@ void SDRdaemonSinkGui::tick()
} else { // recoverable errors or unknown status
ui->allFramesDecoded->setStyleSheet("QToolButton { background:rgb(56,56,56); }");
}
if (updateEventCounts)
{
displayEventCounts();
}
}
displayEventTimer();
}
}

Wyświetl plik

@ -18,6 +18,7 @@
#define INCLUDE_SDRDAEMONSINKGUI_H
#include <QTimer>
#include <QTime>
#include "plugin/plugingui.h"
#include "sdrdaemonsinksettings.h"
@ -69,6 +70,10 @@ private:
int m_nnSender;
uint32_t m_countUnrecoverable;
uint32_t m_countRecovered;
QTime m_time;
QPalette m_paletteGreenText;
QPalette m_paletteRedText;
QPalette m_paletteWhiteText;
@ -80,6 +85,8 @@ private:
void sendSettings();
void updateWithStreamTime();
void updateSampleRateAndFrequency();
void displayEventCounts();
void displayEventTimer();
private slots:
void handleDSPMessages();
@ -96,6 +103,7 @@ private slots:
void on_applyButton_clicked(bool checked);
void on_sendButton_clicked(bool checked);
void on_startStop_toggled(bool checked);
void on_eventCountsReset_clicked(bool checked);
void updateHardware();
void updateStatus();
void tick();

Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>380</width>
<width>411</width>
<height>217</height>
</rect>
</property>
@ -371,7 +371,7 @@
</size>
</property>
<property name="text">
<string>000/000</string>
<string>000/00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -439,7 +439,7 @@
<widget class="QLabel" name="qualityStatusText">
<property name="minimumSize">
<size>
<width>50</width>
<width>52</width>
<height>0</height>
</size>
</property>
@ -471,7 +471,7 @@
<widget class="QLabel" name="eventUnrecText">
<property name="minimumSize">
<size>
<width>18</width>
<width>25</width>
<height>0</height>
</size>
</property>
@ -479,7 +479,7 @@
<string>Number of uncrecoverable errors since event counts reset</string>
</property>
<property name="text">
<string>00</string>
<string>000</string>
</property>
</widget>
</item>
@ -487,7 +487,7 @@
<widget class="QLabel" name="eventRecText">
<property name="minimumSize">
<size>
<width>18</width>
<width>25</width>
<height>0</height>
</size>
</property>
@ -495,7 +495,7 @@
<string>Number of correctable errors since event counts reset</string>
</property>
<property name="text">
<string>00</string>
<string>000</string>
</property>
</widget>
</item>